Chapter 9: Continuing with Intelligent Enemies
In the previous chapter, we imported an enemy object (a fearsome chick) and created a first-person controller for the player and the environment that both the player and enemy will traverse. In this chapter, we'll build on that foundation by focusing on the theory and implementation of creating an intelligent enemy. We'll imbue our enemy chick with the ability to have multiple different behaviors and to swap between those behaviors depending on the state of the world.
In this chapter, we will discuss the following:
- How to enable the chick to see the player by using a line of sight and field of view
- How to code a Finite State Machine (FSM): This will become the brain of the chick—ensuring that behaviors are executed and transitions to different states happen at the right time
- How to create individual behavior states, and how these states fit cohesively to produce complex behavior. Each state will encompass...