An overview of attack AI
Attack AI is a large and much studied subject. When you start dealing with things such as different attack moves based on different player actions or having enemies coordinate attacks, the AI can become quite complex. However, designing good AI that attacks is the same as designing for other AI scenarios we have looked at so far in this book. First, we need sensors for our AI characters to perceive game events and to create aspects in the game world, tagging what they can sense. Then, we define behavior trees for the characters, directing them to change actions based on sensor response or other game states, such as running out of ammo. Defining different behaviors is the main part of setting up attack AI.
We'll look at two foundational AI attack behaviors in our demos in this chapter. The first will use multiple sensors on the AI to determine when to chase and when to stop and attack. The second behavior we will look at is the duck and cover type, where the enemy...