Havok's Jeff Yates says you can breathe life into interactive game characters with the company's new Behaviour tool...

Never Say Die

The big challenges in creating cutting-edge game characters are not just the potential complexity of the assets that comprise them, but also the need to meld these assets seamlessly with new technologies that provide procedural animation and physical simulation; and to enable this process with a tool an efficient pipeline that does not stifle creativity or extensibility. Often creative flow can be lost in an array of functional, but disparate tools and processes that can kill iteration and experimentation.

The good news is that commercial game technology is evolving to include both run-time and tool-time technology in integrated, but extensible pipelines. We think Havok Behavior is one of those efforts as it provides WYSIWYG results for artists and tech leads working on cutting edge game characters.

It also takes full advantage of Havok Content Tools – plug-ins and exporters that support all major releases of Maya, 3ds Max and XSI – to accelerate run-time generation of character assets for use with all Havok products. And it exposes the power and functionality of more established technologies from Havok Physics and Havok Animation. But how would you use Havok Behavior in a real production environment? This guide shows you how.

Setting up your Character Export Pipeline

[img : 87]Havok Content Tools (see fig 1) export and filter character assets directly from all major modeling and animation tools, to give you a better sense of how things will look very early in the process. They also provide directly support for native scripting languages in each modeling package, so you can incorporate Havok export directly in batch asset processing schemes.

Perhaps most importantly, Havok Animation compression technology, found in the Havok Content Tools, provides comprehensive compression features and motion extraction analysis – all crucial features used directly by Havok Behavior.

Once you have all of your character assets prepared and exported using Havok Content Tools – animations, skeleton, rig, mesh, attachments, and rag-doll, as well as terrain and physical objects – you are ready to roll with Havok Behavior.

Configuring a Project in the Havok Behavior Tool

Start in HBT by creating a project that will identify the location of raw character assets created using the Havok Content Tools described above. You can load Havok-exported terrain and physical objects as well, to test out character behaviors more thoroughly.

With each HBT project, you’ll also want to identify triangle winding conventions (clockwise/counter clockwise), and axis handedness settings (right or left) that will be used in your game. Since your art tool of choice and the game engine may not match, you will want to use both the Havok Content Creation Tool filters and Havok Behavior Tool’s display options to visualise everything the way the game will (see Figure 2).

Creating Characters

Characters in HBT are comprised of references to a rig (the skeletal structure), a set of deformable skins (the mesh and textures), a list of interchangeable mesh attachments (e.g. guns, helmets, armor), a ragdoll (the physics objects that represent its mass), a behavior (a state machine and blend nodes, etc. that give it motion – to be created with HBT), its raw animations (the 100’s of animation files or ‘clips’ that generally live as ‘leaves’ in a behavior’s state machine), and an animation set (a subset of animations that can be swapped in a run-time for different characters who use the same behavior). You can create as many characters as you like in a single project and share these kinds of assets between them (see Figure 3).

Creating Behaviors

Behavior creation is the chief purpose of HBT. A basic behavior is comprised of states that each contain a simple animation clip, which references a raw animation file. Transitions between states represent the time-limited blending that occurs when a specific event is raised to cause a state transition. Havok Behavior hosts a range of transition effects, conditional logic, and timing controls. A simple walk/run behavior would look like the example given in figure 4.

Hierarchy and Randomisation

In Havok Behavior, you can create any number of states you need, along with transitions that allow you to jump easily between any states and any level. You can also create states that are themselves ‘mini’ state machines, so that jumping to a state that is itself a state machine takes the character into a structured ‘sub world’ of other behaviors.

Hierarchical organisation, in fact, is the real key to driving power and creativity (not to mention fun) out of a tool like HBT. You can achieve flexible behavioral controls that invoke a notion of ‘AI’ by using hierarchical structure in this way. Also, randomisation and alarm timers that raise transition events go a long way to giving characters a sense of emergent personality.

Crafting a Blended ‘Motion’ State

Havok Behavior’s blend nodes are really a workhorse and can blend anything with anything: clips with clips, blends with other blends, other state machines, etc. A powerful pattern is to create a parametric blend, which, for a major variable (like speed) chooses the nearest two clips to blend between (say from walk backwards, to idle, to walk, to run, and to sprint). The blend node takes care of synchronising and weighting velocities of all blends automatically, based on information stored in each clip (see Figure 5).

Blending State Machines

Behavior’s blend node can also be used to manage continuous blending of upper and lower body bone weights – each controlled by a separate state machine, bound together by a blend. This “layered blend” technique can be combined with parametric blending, and applied at any level of granularity – for example, a blend of three state machines: lower body, upper body and face bones. Each state machine can have its own event list and change states independently.

Adding Procedural Animation

It’s easy to think that the traditional state machine approach is ‘old school’ and synonymous with the necessity for thousands of animation assets. But with a clear understanding of the potential of blending, and more generally of a data flow or ‘node graph’ that can process animation poses in real time – what you really have is a totally general motion synthesising graph that lives inside states. This is really the best of both worlds.

Take something as simple as a walk straight loop. You can very easily extend that by placing a rotate modifier on top of the walk clip (inside the walk state) and bind the turn parameter to an input variable, and suddenly you have a basic walk that can move the character around.

Now if you apply that rotate modifier to a multi-layer parametric blend scenario as described above, you have a much more convincing result. Add a foot-IK modifier to adjust both the feet and the pelvis height based on uneven terrain exported from the Havok Content Tools, and now you can navigate a wide class of terrains with a behavior that needs no more than 4 unique animations – and yet it can be expanded or reused across characters via animation sets (see Figure 6). Mirroring operators also allow you to re-use directional animations easily, saving production time and run-time memory requirements.

Finally, with procedural modifiers like Look-At and Twist to enable a character to look at key targets at key times, to twist along its vertical spine, or ‘lean’ by twisting along its lateral axis, and you have procedural upper-body controls for targeting and gun effects – all controlled by variables that can be driven easily be AI at a higher level.

One of the new capabilities found in Havok Behavior, and a direction that hints at the future for in-game animation, is the ability to navigate a character from its relative position in the world to a specific target location and orientation. This is the proverbial ‘last mile’ of animation that gets a character to its desired location – vs. exploring the world in a relative motion fashion.

Havok Behavior supports all of these procedural modifier types, and more. And since you can add your own custom run-time procedural modifiers that snap into the Behavior SDK and Tool, there’s plenty of room for proprietary innovation.

Blending in Physics

The coup de grâce for Havok Behavior is to bring physics into the authoring process for character behaviors. Though rag-dolls are often considered lifeless bags of bones, the prospect of blending in animation poses changes that dramatically. As a tool, HBT does this for characters by leveraging the node graph and nested behaviors described above.

By placing ragdoll controller nodes above standard animation clips, animations can go from driving a character’s absolute pose, to informing the physics ‘desired pose’ for a character in a physics world. By transitioning in and out of these physical controllers via states, Havok Behavior achieves total integration and variability between physics, animation, and procedural controls (see Figure 7).

Havok Behavior exposes all of this possibility, and in no small way relies on Havok Physics and Animation to power the underlying concepts laid out here.


About MCV Staff

Check Also

Unsigned: Go on an epic journey in Return to Nangrim

A dark first-person fantasy adventure with survival and RPG elements. Grab your axe and go on an epic journey into the ominous depths of an ancient mountain.