Chapter 15. Finite State Machines and Game State Management


The next two chapters discuss artificial intelligence (AI). However, this chapter discusses our game engine structure as well. Using finite state machines (FSMs) is critical for believable objects. We discuss FSMs and how we can set up our game itself as an FSM as we structure our game.

Finite State Machine

A finite state machine (FSM) is a machine with a finite set of states. Maybe we should first talk about a state. We discussed this some in Chapter 11, “Creating a 2D Game,” where we created the SimpleGame. We had StartMenu, Scene, Won, and Lost as states the game could be in. The finite ...

Get Microsoft® XNA™ Unleashed: Graphics and Game Programming for Xbox 360 and Windows now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.