What Are Concurrent Behaviors?

Alex J. Champandard on June 20, 2007

In game design, behaviors are concurrent if they are active within the world at the same logical time. Typically, this implies that your actors can do multiple things at once.

Note: Traditionally, in computer science, two tasks are concurrent if they are running simultaneously on the hardware. Now, you can still implement concurrent behaviors like this, or simply execute the code for each behavior one after the other; the end result would be the same.

So, you may ask, what’s stopping you from just running any two behaviors at the same time?

Behavior Resources

Most low-level behaviors require objects or concepts in the world to achieve their purpose. These are called resources. Resources are what make your actors come to life. For example, a sword object in the world, a body part, or an actor’s voice are all resources that can be used.

Now, resources make it possible for your behaviors to have an effect in the world. But at the same time, they are also what prevents concurrency! You want both ideally, hence the need to think about resources carefully when designing the AI.

So, in terms of resources, there are two key stumbling points for concurrent behaviors.

  • It may be unrealistic/not believable for multiple behaviors to use the same resource at the same time.

  • The implementation of the game engine prevents multiple behaviors from using one resource simultaneously.

Non-Compete Agreements

For behaviors to be concurrent, one of two things is required. Either:

  1. They do not require the same resources, and therefore, do not compete together.

  2. They can cooperate together despite using the same resources.

When you build your behaviors, you need to try as much as possible to fit them in these two categories, either making independent of each other, or allowing them to cooperate. Otherwise, you might end up with an AI that’s concurrency-challenged!

The next article in this category shows you how to do that in more detail…

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!