Progressive path forward


I’m trying to implement a feature on a game where the player controls a group of AI agents. I’m using the Recast Graph. One of the possible commands is to order the agents to move forward up until a specific distance while reacting to what’s going on around them. This video from Overlord 2 shows what is intended, at around 2 minutes:

My question is: what is the best way to implement these kind of paths, where we don’t have a specific end point? The idea is to have the agents move forward until they reach a given distance from the start or until there is no more path forward.

For example, if there is a wall in front of them and the max distance is beyond that wall (and is a reachable node), they must end their path at the wall, and not try to go around it, since there is no more way moving only forward.

Thanks in advance!



I would make them repeatedly search for a path to a point a relatively small distance ahead of them (say maybe 10-20% of the max distance) until they have moved up to [max distance] units. That way they can avoid small obstacles, but will not move much further than the max distance.