donmccurdy/three-pathfinding

Adding variations in the path.[suggestion]

Closed this issue · 2 comments

The path between two point always give the same path, maybe adding a post processing code to make variations of the path would make AI a bit more natural.

I think natural variations for AI is probably outside the scope of this library. I'd suggest adding procedural waypoints for your AI along the way, or adding some noise to the destinations. If a character is patrolling between two fixed points, random drift in a suboptimal path is likely to look a bit unnatural too.

For a bit more info, see http://digestingduck.blogspot.com/2010/03/simple-stupid-funnel-algorithm.html. In particular:

  1. A* transforms graph into a linear set of polygons which will leave you to target.
  2. String pulling will tell you where to towards in order to move towards target
  3. Locomotion/steering will be in charge of the final smooth path.

This project does (1) and (2), but it's up to your application to smooth out the final path or make it more natural.