I have one player and many enemies. The enemies are following my player through the navigation mesh. Sometimes enemies get stuck because there is another enemy in-front of them. You can say both are in line.

Is it possible that when one enemy collides with other enemy in-front of it to change direction so that it avoids colliding with one another?

  • 1
    \$\begingroup\$ Yes? Have you tried? Did it not work? It's not very clear what you're asking here. Can you provide more detail? \$\endgroup\$ Jun 12, 2014 at 18:26

1 Answer 1


This is an AI problem typically found in RTS games. Many of such games have solved the problem via different methods.

I personally like this article and the implementation follow-up article as an introduction into advanced pathfinding.

So, the answer is definitely a yes. Off the top of my head you could try some of the following:

  • Check for local enemy collisions and repath one of the unit
  • Check for local enemy collisions and move aside the unit that's blocking the way
  • Implement a flow-field pathfinding algorithm (used by Supreme Commander 2), (theory, more practical paper)
  • Implement a flocking algorithm like BOIDS which is pretty intuitive

Not the answer you're looking for? Browse other questions tagged .