Game Development Reference
In-Depth Information
if the player is spotted while the guard is patrolling. Combine these criteria togeth-
er, and we can draw a simple flow chart for our state machine, as in Figure 9.9 .
Figure 9.9 Basic stealth AI state machine.
Although this AI would be functional, it is lacking compared to the AI in most
stealth games. Suppose the guard is patrolling and hears a suspicious sound. In our
current state machine, the AI would go about its business with no reaction. Ideally,
we would want an “Investigate” state, where the AI starts searching for the player
in that vicinity. Furthermore, if the guard detects the player, it currently always at-
tacks. Perhaps we instead want an“Alert” state that, uponbeing entered, randomly
decides whether to start attacking or to trigger an alarm.
If we add in these elements, our state machine starts to become more complex, as
in Figure 9.10 .
Search WWH ::




Custom Search