Book Image

Learning Game AI Programming with Lua

By : David Young
Book Image

Learning Game AI Programming with Lua

By: David Young

Overview of this book

Table of Contents (16 chapters)
Learning Game AI Programming with Lua
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
Getting Started with AI Sandbox
Index

Building a soldier animation state machine


Building the soldier's ASM is very similar to the weapon ASM, except that we have a lot more animations to think about. In this case, we're only going to flush out the standing idle and standing run poses of the soldier. A spoke-wheel-designed ASM can easily accomplish each of the animation states with their corresponding transitions.

One large restriction to this simple design is that whenever an animation plays, we must return to the idle stand animation before being able to play another animation. In a fully connected ASM, you can add additional transition animations to go from reload to fire immediately, for example:

The soldier animation state machine

You should pay attention to where transitions exist as well as their blend durations, as this will ultimately affect how reactive your agent will appear. As this design requires going back to the idle_aim state for a minimum of the blend duration, there will always be a slight delay before an agent...