Summary

In this chapter, you started with the basics: ninjas. Actually, you started with some basic path-finding routines on a tile-based map, such as a randomized search and the popular "right hand on the wall" trick. Then you went to more advanced environments based on graphs and implemented a generic A* algorithm that could be used for graph- or tile-based environments (because tile-based worlds could be interpreted as a graph anyway). Finally, you merged your A* searching with the BSP tree you've been working with for the past couple of chapters, and you created a generic path bot that follows any type of path, whether it was created by an A* search or not. As usual, you made a demo to show off the stuff from this chapter. Path finding is one of those required elements of a game, and it's also the building block of a lot of artificial intelligence in games. Currently, your A* path bots are godlike, meaning they always "know" where the player is. In the next chapter, you'll use your path-finding capabilities to dumb down the bots' godlike powers, but you'll also give the bots a little more smarts about making decisions such as attacking, dodging, and chasing the player. In addition, you'll make the bots "strike back" so you can fight against your robots. Which makes me wonder, is killing robots okay?