Cover ERCIM News 57

This issue in pdf
(72 pages; 11,6 Mb)

Cover ERCIM News 56
previous issue:
Number 56
January 2004:
Special theme:
Analysis, Planning, Diagnosis and Simulation of Industrial Systems

all previous issues

Next issue:
July 2004

Next Special theme:
Automated Software Engineering

About ERCIM News

Valid HTML 4.01!

< Contents ERCIM News No. 57, April 2004

Sequencing Animations Intelligently

by Stéphane Assadourian

One of the main problems to tackle for Artificial Intelligence (AI) in 3D first person shooters/sneakers is that non-player characters (NPCs) are constantly taking actions. These creatures should show flexibility and consistency in their general activity, and the ability to react to decisions based on the changing environment. Whenever a change of action is required, it causes a change of animation and therefore the possibility of a failure to achieve a believable behaviour.

We will take the common example of a patrolling NPC that can go into a sitting idle state. Developers simply rely on motion blending to handle transitions. The purpose here is to understand why, where blending fails, sequencing works well.

Transition versus Sequence
Most systems rely solely on motion blending, which establishes a smooth transition between two animations. It is a black box and there is no need to know the starting or the ending animation. Motion blending provides a transition between two not so different animations (eg dying while jumping). The idea is to change the current animation so that it becomes the next one. Transitions should be used when the animation we want to play is so important that we will blend it into the current one, not even finishing it. Transitions mark a clear opposition to the concept of terminating an action, which is exactly what a sequencer does. It takes several animations and plays them from beginning to end. Blending and sequencing are two different methods which should work together as they encompass all the game needs and both add realism to it (see Table 1).

Table 1: Conceptual differences between blending and sequencing.
Table 1: Conceptual differences between blending and sequencing.

Behaviour Execution
There is often a natural sequence of actions in real life. Indeed, we let most of our actions terminate, particularly those 'dangerous' ones, for instance pouring wine into a glass. Table 2 shows the three layers used to describe the actions of the creatures.

Table 2: Three different languages and layers describe the actions of the creature.
Table 2: Three different languages and layers describe the actions of the creature.

You must know all the actions the creature can perform and how to play the animations (eg once, looped). They must not be too long because you are going to de-synchronize decision and action by letting every action terminate.

Delaying the most current behaviour has a price, and you would end up completely de-synchronized if your animations were too long. Cutting an action down to smaller ones (start/loop/end) allows flexibility.

AI System Layout
The sequencer interfaces the behaviour (decision) layer and the animation (action) layer. The layout of our AI system is shown in Figure 1.

Figure 1: The artificial iIntelligence system.
Figure 1: The artificial iIntelligence system.

There are two main advantages to adopting such a layout:

  • behaviour code can be kept as simple as it should be thanks to the sequencer
  • it is easy to create the logic of transition.

The behaviour asks the mind for high-level actions. The mind then asks the sequencer to assess the current one. The sequencer breaks this action into tokens and then asks the animation layer to play the sequence it has come up with, until it ends.

De-synchronize Decision and Action
By allowing your creature to terminate the current action of behaviour A when behaviour B tells it to do something else, we are de-synchronizing decision and action.

In our example, the creature sits in idle state and suddenly decides it needs to move to a patrol point. Table 3 shows the contents of the sequencer when a behaviour switch occurs.

Table 3: Contents of the stack before and after a switch of behaviour, from idle to patrol.
Table 3: Contents of the stack before and after a switch of behaviour, from idle to patrol.

The animation system is playing an idle_sit animation, which is looped. The behaviour suddenly wants a movement action to be performed. As the sequencer receives the order, it finishes playing idle_sit, then inserts a sit to stand animation immediately after it. Such a sit to stand transition done purely by blending would clearly look strange.

The algorithm has only been briefly presented but has been implemented and a demo is available. It complements motion blending, which can produce poor results when used alone, mainly because it should be used in all the cases where the behaviour must not drive, but certainly not when the behaviour is executing as designed.

Playing animations with fluidity is one very important key to believable AI, and sequencing them is an invaluable addition.

Please contact:
Stéphane Assadourian, Warthog Games Ltd., UK