In this chapter, we'll cover the following recipes:
Artificial Intelligence (AI) is an extremely vast field. Even for games it can be very diverse, depending on the type of game and requirements.
Many developers enjoy working with AI. It gives you a sense of creating something alive, something intelligent, and rational. A good question to ask before designing AI for a game is what the expected behavior should be, from a player's perspective. In an FPS, it might be the case that the AI can separate the friend from the foe, find cover when attacked, flee when injured, and not get stuck on things as they move around. AI in an RTS might need to not only evaluate the current situation, but also plan ahead and divide resources between aggressive and defensive behavior. A group of soldiers and a tactical shooter might have advanced and dynamic group behavior. Another option is to have individual behaviors that still make them appear to work together, to the player.
The recipes in this chapter will, in most cases, work with isolated functionality, but revolve around a central AI control class. As such, the results might not always be impressive on their own, but at the same time, it should be quite easy to combine several of them into a more powerful AI.
18.118.31.67