3
\$\begingroup\$

I want to implement a demo like creeps laning in Dota 2. So for simplicity, there is Left team and Right team, they are enemies.

  1. Units from Left team move toward Right base, and units from Right team move toward Left base.
  2. In their path, if those units encounter unit from enemy team, they will start to fight the enemy unit.
  3. One unit could attack an enemy unit.
  4. In their path, those units should avoid ally unit, they should not collide each other.

For 2 and 4, I want to have the feature that is: When encounters any enemy, one unit should seek its path to be able to fight the enemy unit. Consider this image: enter image description here

There are some units blocked by their ally, so when an unit blocking the path disappear, another closest ally unit should move on, or move to attack their nearest enemy unit.

I wonder if A* should be applied for the demo. My demo is more simple than Dota 2, it does not have static obstacles, it just has dynamic obstacles (moving units). My main question is, What strategies/algorithms should I apply to implement my demo?

Thanks

\$\endgroup\$
4
  • 2
    \$\begingroup\$ If you have no static obstacles, then you might want to look into avoidance behaviours rather than pathfinding per se. \$\endgroup\$
    – DMGregory
    Commented Apr 18, 2019 at 11:37
  • \$\begingroup\$ There are lots of solutions. Some keywords to look into: Swarm pathfinding, collision avoidance, potential fields, boids \$\endgroup\$ Commented Apr 18, 2019 at 19:20
  • \$\begingroup\$ Thanks @BlueRaja-DannyPflughoeft and DMGregory. I'll try Reciprocal n-body Collision Avoidance, hope it is not overkill. \$\endgroup\$ Commented Apr 19, 2019 at 1:45
  • \$\begingroup\$ Oh, another common term is "flocking algorithms" \$\endgroup\$ Commented Apr 20, 2019 at 18:17

0

You must log in to answer this question.

Browse other questions tagged .