Advertisement

Hwo to Smooth the A* Path?

Started by February 07, 2005 05:40 AM
1 comment, last by JTippetts 20 years ago
A* will give us the way from the start point to the end across other nodes. but if the distances between the nodes are small the path will be bad like the following. start*----| |___ | | | * end (i.e. the player will move like the warm ). i do smoothing the path by an expensive algo (high costed time). what the way to less the smoothing of the path? Thanks advanced
I forget which book I read it in, but I think it was one of the Game Programming Gems series.

Basically, if you tweak the heuristic used by your implementation so it favours going in the same direction over changing direction you'll get a lot more "natural" looking path. Note that this will probably end up being less optimal than your original heuristic.

The context I read it in was for cars/driving - where it's best to go a little further (less optimal path) but in longer straight sections than a short path (most optimal) with lots and lots of turns.

Alternatively, I once used a catmull-rom/Hermite spline based interpolation between the nodes my A* picked out. This *visually* made it look a bit better, but you then have to worry about the curved line it generates still being a valid path (e.g. if 2 nodes are close to the corner joint of a wall, the curve might go through the wall!).

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Advertisement
double post

This topic is closed to new replies.

Advertisement