A* Pathfinding Project

Cornered FleePath


Hi Aron!

FleePath works really well, tweaking the value can result in a really panicked looking AI (which is the goal!).

However one thing I’ve noticed is that if the AI is cornered on the edge of the map, the calculated path will move toward the flee position. Is this by design? In scenarios where there essentially is no flee path, I think I’d have expected an error instead?




The flee path will try to find the best path it can of a certain length. If there are no “good” paths it will pick the least bad one.


Makes sense, thanks for the response!


Hi there!

Sorry to revive this. But I don’t suppose you have a reliable way of knowing whether the flee path goes back towards the initial flee target or not?




The only way I think would be to go through the points in the path and check if any point is closer to the flee point than the first point in the path.