Article

Why Do Your AI Behaviors Need Concurrency?

Alex J. Champandard on June 12, 2007

Most games today require purposeful yet responsive behaviors from the AI actors. This implies that actors must do two things:

  1. Pursue active long-term goals in the game.

  2. Respond to events from the world.

A solution without concurrency would have to resolve each goal one by one in a sequence, and incoming events would presumably suspend the current goal (or, less often, be enqueued for later). This isn’t ideal for many reasons:

  • Different behaviors are often mutually compatible and can run in parallel.

  • For the overall performance of the actor to be realistic, it must often do multiple things at the same time.

  • Games are highly dynamic, so both events and current goals must be dealt with as soon as possible, rather than enqueued or suspended.

In practice, with good support for concurrency in your AI engine, you’ll notice the following:

  1. Actors deal with events in the world at the same time as the main behavior.

  2. There are no limitations on what actors should do when handling events.

  3. The engine supports actors doing anything at the same time, though it may look unrealistic.

  4. The designer can impose restrictions on what behaviors should not be done concurrently.

The next post in this section looks at concurrent behaviors in more detail. What are they exactly, and what makes them different from other behaviors?

Discussion 0 Comments

If you'd like to add a comment or question on this page, simply log-in to the site. You can create an account from the sign-up page if necessary... It takes less than a minute!