Game Development Reference
In-Depth Information
Chapter 10. Animation and AI
Part of having realistic game AI is having characters play animations at times appro-
priate to the AI character's state. In this chapter, we will look at animation and how it
is integrated with RAIN, both with Unity's legacy animation system and Mecanim.
In this chapter, you will learn about the following:
• Why animation management is an important part of game AI
• Managing animation with behavior trees and Unity's legacy animation
• Managing animation by AI with Unity's Mecanim animation system
An overview of animation
When you think about game AI, first you probably think about things such as creating
virtual minds and making characters "think". When I first started learning about game
AI years ago, I didn't think animation was really important for game AI since it wasn't
part of creating a virtual mind. But then I attended some AI sessions at the Game
Developers Conference and found out that one of the most discussed topics in AI was
integrating AI with animation systems; this is when I realized it really is an important
part of game AI. This makes sense since game AI is about modeling real thinking in-
stead of focusing on giving characters the appearance of thinking, so having the char-
acters play animations that match their state is important. We can think of animations
as just a visual depiction of the current state of the character.
The method we'll look at for integrating animations with the AI is RAIN's animation in-
tegration with Unity. RAIN has an Animation tab (with an icon of a running man) in its
AIRig. In this tab, animation clips can be configured using one of two RAIN animators.
RAIN has a BasicAnimator option to configure clips with Unity's legacy animation
and a MecaninAnimator option used to set up Mecanim animations. Once these an-
imations are set up, RAIN has an animate node in its behavior tree system that can
be used to call different animation states. Usually, this is done in conjunction with a
parallel node with the animate node being one of its children. This way the animation
can run at the same time as the other logic is being executed in the tree.
Search WWH ::




Custom Search