O'Reilly logo

Learning Game AI Programming with Lua by David Young

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Direct animation control

The first approach we'll implement is direct control over the ASM, as it is the simplest approach to understand and implement. While the agent has a lot of advantages as it knows exactly what animation is playing on its body, this technique tends to scale very poorly as more and more animation states are introduced. Although scaling becomes a problem, this approach allows for the lowest grain of control in terms of animation selection and response times from the agent.

As the agent must be responsible for animation selection, we'll create some basic actions that the agent can perform and represent as states:

DirectSoldierAgent.lua:

-- Supported soldier states. local _soldierStates = { DEATH = "DEATH", FALLING = "FALLING", ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required