Planning the zombie Artificial Intelligence
The zombie character needs intelligence, that is, the ability to take appropriate actions and responses in front of the player. Specifically, the zombie should balance actions between idling, chasing, and attacking at appropriate times. To achieve this, we'll need Artificial Intelligence (AI). This essentially involves coding functionality to help the computer make good decisions under specific conditions where multiple outcomes are possible. AI (for video games) is not, however, about coding an inward consciousness or phenomenology; and it's not about replicating the workings of the human mind. Rather, it's about deciding how NPCs behave, creating the illusion or appearance of intelligence, to enhance the experience and realism for the player. For the zombie, we'll code AI by using Finite State Machines (FSMs).
The FSMÂ is essentially a decision-making structure. The simplest example of an FSM is a traffic light. This exists in only one of three...