In this chapter, we're going to take a close look at some essential techniques in an area of video-game design called pathfinding:
Randomly moving through a maze
Chasing a player character
Using line of sight in a tile-based game world
Finding the shortest path through an environment using the A* algorithm
But first, let's set up a game environment that's easy for your characters to move through.
One of the advantages of tile-based games is their predictable symmetry. The entire game world is composed of tiles that are the same size. You can leverage those fixed sizes to help simplify your game engine. This ...