How do I…
I’m making an arena game with a top-down view - what’s the best way to make enemies don’t cluster at one point when pathfinding their way to the player - so that they walk in a crowd so that each enemy is visible
I’m making an arena game with a top-down view - what’s the best way to make enemies don’t cluster at one point when pathfinding their way to the player - so that they walk in a crowd so that each enemy is visible
Never find a good way for it
So i never bothered with it and accepted the fact it will happen
I know there is boids behavior but its not performance friendly when it comes to tons of objects
So what i do i separate them only when they are not moving
Which is just checking if distance between them is below some pixels
And if so i add instant force toward angle Random(360) with some absurd speed

In games like Warcraft 2, Starcraft, old BG games etc.,they used formations .keep the distance short and you get a crowd erffect.
I think you should aim for something similar. I would create a grid-like object around the player and then use something like “pick nearest” and move to the next enemy to the nearest unoccupied minimum distance (maybe randomizing things).ofc only when reached the player.
Avoid checking for collisions if you have too many enemies — it would be too heavy on performance.
edit: lol that orc
Do you see this one a few months back
Multi-Agent Path Finding - How do I…? - GDevelop Forum
yep that is (i believe) the correct way…
in fact this…
edit: problem is…i dun think it’s performances friendly…but i may be wrong…
here u notice the lag the moment you go a bit high…


but i gues 32x32 px isn’t that bad…considering the second ss
I haven’t tried it myself, and i dont really do much pathfinding - There might be ways to optimise it based on distance from player etc
also there is another problem…
if u notice the whithe dots they never stack on a cell…
i believe u don’t want this behaviour as long as they don’t reach the player…
now I’ve checked how it works- and yet when there are a lot of enemies, it lags - about 50 enemies and that’s it. - I’d like at least 100
guess with that number it gonna lags…no matter what you do.
i never seen 100 enemies …not even in musou games
I’m thinking aloud here …could you have the nearest marked as leader. He pathfinds to player and the other pathfind to points relative to (edit …where the leader is going). You could use a variable to adjust how close those relative points are, and read the relative positions from an array.
The leadership would then be constantly changing as they approach.
if you’re making a vampire survivor clone, i guess not even there are 100 enemies…i guess…