Algorithm allowing a good waypoint path following?

Posted by Thierry Savard Saucier on Game Development See other posts from Game Development or by Thierry Savard Saucier
Published on 2014-08-20T23:15:29Z Indexed on 2014/08/21 4:33 UTC
Read the original article Hit count: 335

Filed under:

I'm more looking into how should I implement this, either a tutorial or even the name of the concept I'm missing. I'm pretty sure some basic pathfinding algorithm could help me here, but I dont know which one ...

I have a worldmap, with different cities on it. The player can choose a city from a menu, or click on an available cities on the world map, and the toon should walk over there.

But I want him to follow a predefine path.

cities

Lets say our hero is on the city 1. He clicks on city 4. I want him to follow the path to city 2 and from there to city 4.

I was handling this easily with arrow movement (left right top bottom) since its a single check.

Now I'm not sure how I should do this. Should I loop threw each possible path and check which one leads me to D the fastest ... and if I do how do I avoid running in circle forever with cities 1-5-2 ?

© Game Development or respective owner

Related posts about ai