A comprehensive tutorial on implementing map pathfinding in your games.

Article by Richard Davey. Posted on 11th Feb 2016.   @phaser_

image

From GameDev Academy: "Suppose you’re building a strategy game. The game will have player and enemy units which navigate through a map full of obstacles. While the player units will be controlled by clicking on the map positions, the enemies will walk alone, following any AI strategy.

You may have noticed that, given an origin and target positions, the units must find a path connecting those two points avoiding any obstacles in the way. In addition, it is important that this path is the shortest as possible.

The process just described is called pathfinding and it is used in many games, as well as other AI problems. In this tutorial I’ll show how to use a pathfinding library to solve this problem in your game. At the end, we will build a map where we can click to where we want our character to move, and it will find the shortest path from its position to the desired position."

Read More