Chapter 15. Finite State Machines and Game State Management
IN THIS CHAPTER
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 ...