Creating a more ideal pathing for following a character?

Hey guys,

I’m currently working on our enemy behavior when following our character. what I wanted to ask is:

Is there a way to have the enemy characters follow the main character (either the character standing still or in transit) happen a little more naturally.

Right now the way it works is.

they all seem to pile into a single file line then try to conga their way to the character.

If the character is standing still, avoidance kicks and lets them stay relatively well spaced which is ideal enough for me.

So I basically wanna know if there’s a good way to setup a more natural feeling path following(finding?) to the character where my enemies don’t conga line it up.

Thank you for your time,
Alex Batista

PS: My knowledge of pathfinding in this case is, the ideal shortest path to the character is the same for each one of the enemies. so they promote to follow along a line because they’re finding the least path of resistance. If this isn’t the case, educate me! I just wanna leaarrnnnn :’(

You can set it up so that, on the behavior tree, if there is another enemy around a certain range, they slow down a bit, or just stay away from another enemy while moving towards the character.

would you say that would be inside a service node?

Hmmm, probably Service. You may even want to make a Decorator/Task for it. It could be its own separate thing to check.

You should dig into Character Movement Component “RVO Avoidance”, there are some variables for this kind of stuff. Also there are some tutorials on the subject, i dont know about their quality so i cant recommend any, but i definetly saw some, the subject what you interested in called “Crowd AI”, so google it.

def. I already setup a detour crowd AI controller for my minions(hehehe) but they still conga line it because of how the shortest path to a point is done. I was hoping to gain some understanding in possibly making it so that they don’t always choose the shortest path in this sense. I’ve been googling these concepts but I don’t think I’m finding the right things on google. I def need help googling the right concept or idea in this context.

True story +1

Hey,

The correct way to do this in my opinion is to create a grid behind your player evenly spaced and give each AI a point on this grid to follow. It is like your player is the ‘commander’ of the AI’s in some other games.
You could even calculate this grid on runtime based on how many AI’s are following the player.
This grid could exist only as xyz-locations or as invisible ‘Actors’.

Good luck!
Elias

oooh I really like this idea! I’m gonna test this out when I get home. Thank you for your input, it seems like this hits it on the nose.

Looking forward for the result, but as prediction, i think this idea would fail miserably in any inviroment with walls separating rooms(doesnt really have to be a maze, just separated space), mostly because when you would get to actual placement of grid points, you would discover a need in complicated pathfinding logic, just to place the points.

The ai pathfinding, especially crowd ai pathfinding its the whole, really big and complicated, area of research, so i doubt you would be cappable of making decent solution in any real term. Also, i do think, the result like this looks good enough implementation. But it doesnt looks like the person on the video making something special, just enable rvo avoidance.

would a proper EQS with a decent test help out lower this issue?

yeah man kinda scary how much info there is out there and research papers I’ve had to skim haha. It has given me a big appreciation in AI though, which I might just give a go at for a masters.

Dunno what is eqs, quick google search shows that’s different approach to tackle behaviour trees and im not an expert in any of those, also i didnt saw any real(or even decent) expertise in the ai area on this answerhub, so you would do your research and system building almost completely on your own.

They have a really good tutorial on AI that they did on twitch. Make Game Ready AI. they delved into EQS there and gave some good examples of how to use it, but not much into tests. I’ve messed with this stuff before and done some research for a bit now so yeah I’ll be building my own tests and systems. :smiley:

Yes a good EQS will be able to help with these issues :slight_smile:

EQS is not that hard once you get to know it! But for full control of them I would suggest going into c++. It might be that blueprints are enough for what you are looking for though.

My initial tests with EQS have returned near ideal results! Now the only thing I need to do is create a better EQS test wise and I think I’ll get the actual ideal solution. I have some ideas of what to do but thank you again for sharing this idea with me.

Hey. I have been trying to achieve something similar, and EQS was one thing that got me curious. Sadly, there aren’t many examples or walkthroughs for it. Would you mind sharing your your setup for the EQS queries and the basic idea of how you have implemented the system? It will be a ton of help for my project :slight_smile: