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", IDLE = "IDLE", MOVING = "MOVING", SHOOTING = "SHOOTING" }
The death state
The first action we'll implement is the death state of the agent. As the ASM provides both a crouch and standing death variation, the action simply slows the...