Game AI is fundamentally about behaviors. You need to design and implement a program that controls your actors to make the game fun. To achieve this, most often, you’ll need to do the following:
Gather information about the world
Remember certain things when necessary
Decide what to do ahead of time
Attempt to follow the plan, checking for problems
This breaks up the architecture into four parts.
The sensory system deals with perception for actors. Typically, it involves accessing or computing information from the world representation. For example:
Line of sight checks using the physics collision bounds.
Determining nearby objects or actors.
Gathering information about sound events.
Specialized algorithms deal with each of these things, and the AI system can typically re-use most of the work done in the engine.
The counterpart of the sensory system is the actuator system. It helps the AI achieve things in the game by modifying the world representation. For example:
Controlling a body using motion-captured animations.
Playing sounds for voice or other special effects.
Communicating with other actors, or sending events.
The tricky part is working out which actions to execute, and when…
Decision Making and Control
Making decisions, and then executing them is the main part of the AI. This is traditionally done with a scripting language or a state machine. Each actor is then controlled by a small program that the designer writes.
The challenge here is to create a system that deals with game specific problems:
Pursuing long-term goals.
Responding to short-term events.
Handling large quantities of content!
To make decisions, a control program mostly uses global information about the world. However, this can be customized for each actor…
When actors store their own pieces of information in their memory, it’s called a world model. The AI essentially use little facts to express what an actor should know about the world.
There are two main ways of doing this:
A specific data-structure that’s not extensible, just contains a limited number of facts.
An extensible data-structure that can store any piece of information.
The second approach is known as a blackboard architecture. It’s slower, but in practice is more powerful.