0

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?

Cristina
  • 400
  • 1
  • 9
  • 19
Gul
  • 1

1 Answers1

2

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
Howie
  • 332
  • 1
  • 7