6
\$\begingroup\$

A path is defined as a list of positions for units to follow sequentially to navigate terrain. For example,

var Path = new List<Vector2> (){
    new Vector2 (0,0),
    new Vector2 (10,5),
    new Vector2 (20,5)
};

Conceptually, how would a group of 10 clumped-up units navigate to each of the waypoints? When each unit checks its distance to the waypoint to decide whether or not to move on to the next waypoint, units may start running into each other, trying to occupy the same waypoint.

Units trying to occupy the same waypoint

Are there any clearcut solutions for group path following or ideas for how to solve it?

\$\endgroup\$
  • \$\begingroup\$ For many units you'd want use swarm pathfinding. If 10 is the maximum, you could path-find each unit separately and just add some collision avoidance. \$\endgroup\$ – BlueRaja - Danny Pflughoeft Oct 17 '17 at 1:19
1
\$\begingroup\$

For 10 units I would probably use some hack where I would adjust the tolerance for hitting waypoints. The denser the crowd, the more lax with hitting waypoints. Not the cleanest, and not necessarily a robust solution, but it may suffice, so it's worth trying.

For large crowds, look into Continuum Crowds.

This method solves the path to the goal not for a specific source to a specific goal. Instead it computes the path (in the form of a gradient field) for every location on the map, to a goal.

This is of course computationally expensive, but if crowd sizes get really large, and many in the crowd share a common goal, then that extra cost is amortized, and you pretty much get larger crowds essentially for free.

I've used it myself, and the results are very impressive. The agents will avoid bottlenecks, take alternate routes, and will even automatically form lanes if two groups (with different goals) travel in opposite directions.

If in your case, you want the group to always stay together, then a flow field approach like Continuum Crowds may not be the best, as it would not guarantee this.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.