O'Reilly logo

Game Programming in C++: Creating 3D Games, First Edition by Sanjay Madhav

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4

Artificial Intelligence

Artificial intelligence (AI) algorithms are used to determine the actions of computer-controlled entities in games. This chapter covers three useful game AI techniques: changing behaviors with state machines, computing paths for entities to move through the world (pathfinding), and making decisions in two-player turn-based games (minimax and game trees). The chapter shows you how to apply some of these AI techniques to create a tower defense game project.

State Machine Behaviors

For very simple games, the AI always has the same behavior. For instance, an AI for two-player Pong tracks the position of the ball as it moves. Because this behavior doesn’t change throughout the game, it’s stateless. But for more complex ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required