Pathfinding is a technique that consists in computing the shortest path between two points. It is ubiquitous in video games to compute the paths that AI-controlled NPCs should follow, or even to compute the path that the player character should take in games where the player doesn’t directly control the movements of the character (for example click-based games).
In this tutorial, we’ll be using the great Easystar pathfinding library to compute paths for us in a basic Phaser 3 game, and see how we can translate the paths computed by Easystar into actual smooth motions of the player character using a Phaser 3 timeline. We will used Tiled (with which I assume basic familiarity on your part) to set up the tilemap and indicate the obstacles, as well as see how to make some terrains less preferable than others by attributing costs to them.
Read more at: Dynetis Games blog.
HTML5 Game Developer, Enclave Games indie studio founder, js13kGames competition creator and Gamedev.js Weekly newsletter publisher. Mozilla Tech Speaker, Gamedev.js community firestarter. Organizes meetups / workshops / hackathons in Poland, passionate about new, Open Web technologies, excited about WebXR and PWAs. Likes eating sushi and playing Neuroshima Hex.
Leave a Reply