Animating Characters Tutorial
|Line 326:||Line 326:|
Latest revision as of 02:08, 25 February 2014
- This page offers a walkthrough for Animators preparing the various character files required for Hero Engine.
This tutorial goes over various ways of applying Animation (vda) to a character, by briefly touching on the processes of different types of animations and the accompanying animation sequences (.asq's). Along with these, it is also necessary to review the information on the animation agent (.aas), in order to wire all of the animation sequences together.
Examples such as idle, turn, walk and run, death, transitions, impacts, and attacks are covered from a content creation standpoint. Wiring animation together is a much larger topic, which is covered in the animation wiring section of this wiki.
Details on error-free exporting are located at the Hero Export Guide.
This following process is the same for static and dynamic characters.
Some things to keep in mind when creating animation content:
- Ensure that Bip01 is at (0,0,z) on the x and y axis at the beginning and end of the animation. This is true of turn, idle and attack animations. Transition animations, such as death animations or those animations where the character moves position, will have different values at the end. The reason to stay consistent with this starting point, is to eliminate hitches when blending to a different animation. HeroEngine and the animation system do their best to blend animation, but the only way to be sure, is to take every precaution. If it is ever necessary to reset your character after some type of major error, then remembering 0,0,Z is much easier than some set of unusual values that may be different for each character. Animations can be started and ended on different values, as long as the offset is carried throughout the rest of the animation set, but this can be tedious and error-prone.
- Ensure that Bip01 (root joint) is at (0,Y,0) on the x and z axis at the beginning and end of the animation. This is true of turn, idle and attack animations. Transition animations, such as death animations or those animations where the character moves position, will have different values at the end. The reason to stay consistent with this starting point, is to eliminate hitches when blending to a different animation. HeroEngine and the animation system do their best to blend animation, but the only way to be sure, is to take every precaution. If it is ever necessary to reset your character after some type of major error, then remembering 0,Y,0 is much easier than some set of unusual values that may be different for each character. Animations can be started and ended on different values, as long as the offset is carried throughout the rest of the animation set, but this can be tedious and error-prone.
- The character should have an SRB (SyntheticRootBone)
- Use the skeleton or character base file as the template upon which to animate.
- HeroEngine will use the motion and translation of the character to derive motion in the game.
- By default, HeroEngine does not animate in place. So translate the character's movement in 3ds Max (or Maya), unless your team intends to alter the character controller to do otherwise
- The skeleton is a single root hierarchy. Bones must be parented to other bones. Do not use a broken hierarchy (bone to helper to bone).
- Hide any helpers, IK rigging, or geometry before exporting.
After the animation content is created:
- The animations will need to have .asq sequences created for them (so that they know they can be played)
- The .asq sequences must be added to the animationset.dat, so the animation agent knows what animations are available for it to play.
- The animation agent, .aas, needs to wire all this stuff together, sort of like a fuse box which keeps everything running. For more information on how to wire animations into the engine, see Animation Agent Script.
- Please review the Animation Panel page for information about the animation Panel which will be used below.
The following three file types are all located in a given character's animation folder:
- Animation Agent files are .aas and have the same name as the character's .dat file
- Sequence files are .asq. Every Animation file has at least one .asq associated with it. This is generally the same name as the animation file.
- The animationset.dat is just a list of all .asq files that are available for the given character.
Using the SRB in 3ds Max
The SRB (Synthetic Root Bone) is used by HeroEngine to track and control a character's position and orientation as well as syncing animations. As an Animator, think of it as a portal that links all your animations together. The rest of the rig is really just aesthetic. To keep it from popping, keep the pose the same.
For best results, the SRB should be controlled in different ways depending on the goal of the specific animation. Since HeroEngine thinks about this bone as the location of the character, its motion should probably be restricted as much as possible. By default, it stays on the ground plane and directly under the Bip01 bone.
To gain familiarity with how this works:
- In 3ds Max, select the SyntheticRootBone and go to your links panel. Select the Links Info button. There are two sections:
- The upper section contains locks, which may not be used very often, but can still be helpful. When the Lock for a given Move, Rotate, or Scale is on, you cannot move the SRB. If you uncheck any of them, you will be able to key frame and use that specific axis to better control the motion of the SRB.
- The Inherit section on the bottom section allows for the SRB to have automated motion. By checking any of the Move, Rotate, or Scale boxes, the SRB is unrestricted, and allowed to move on its own, relative to the Bip01 bone. 98% of the time this is how the SRB is controlled, and rarely is it necessary to override this with the Locks.
- Tip for posing with the SRB: Don't worry about the SRB while posing the character to its initial stance. Worry about the pose, then use the above mentioned switches to get it facing forward and directly under the Bip01, which should be at 0,0.
Using the SRB in Maya
The SRB (Synthetic Root Bone) is used by HeroEngine to track and control a character's position and orientation as well as syncing animations. As an Animator, think of it as the portal that links all your animations together. The rest of the rig is really just aesthetic. To keep it from popping, keep the pose the same.
For best results, the SRB should be controlled in different ways depending on the goal of the specific animation. Since HeroEngine thinks about this bone as the location of the character, its motion should probably be restricted as much as possible. By default, it follows the Bip01 (or root joint) in an offset location at ground level.
To gain familiarity with how this works:
- In Maya, go to the HeroTools Shelf
- there are 6 buttons with the SRB icon that are used for toggling the motion of the SRB on or off. They are:
- tx toggle
- ty toggle
- tz toggle
- rx toggle
- ry toggle
- rz toggle
- When the border around the icon is red, this means that the axis of motion has been muted, so it will not inherit the motion from the bip01/root joint on that axis.
- If the border is green, that means that it will inherit the motion from the bip01/root joint on that axis.
- Export using the *Animation (VDA) setting on the HeroBlade exporter
- Hide any unwanted objects/helpers, or additional parts in the background before export
- Any additional rigging components (helpers), do not need to be exported.
- Export unhidden(3ds Max) / Export Visible(Maya) is the most common way to export animation
- Exporting animation exports the animation based on the visible workspace and in the timeline.
- Therefore, you can keep multiple animations in the same file by just having them on different parts of the time line. This just helps out with file management and is up to you to decide if you want to do this or not.
- Our artists typically keep sets of animations together in one file
- Normal idles
- Combat idles
- Walks, runs, and locomotion
- Combat turns
- Specialty cases
- Anything that gets additional or alternate rigging will get its own file as well.
The section highlighted in Orange is for Curve Tolerances. Changing these values controls how the animation curves are compressed on export. Position and scale Tolerances are rarely used since almost all character animation is based on Orientation Tolerances. If you find your characters' feet are not staying put or you need to have a bit more accuracy with a certain animation, simply dial down the Orientation Tolerance to a lower number. This results in a bigger file, so only dial down the animations that really need it.
All of the following animations will be exported with the animation(vda) mode checked.
That all being said, Let's Animate! It is important to note here, that All of the code you see on this page involving ASQ sequences no longer needs to to be edited by hand. The animation panel in the engine now handles all the editing of these nodes. The code on this page will be left intact as a reference to what is going on under the hood. Also, these can still be edited by hand without the panel if the need should ever arise.
Idle animations Start and Stop in the same pose, position, and orientation. Even though your character may sway a little bit, or move and come back to the starting spot, you want the SRB to stay perfectly still.
- In this case, turn off all the Inherit check boxes so the SRB stays put
- Make sure to turn the switch off at the beginning of the animation, or else it will stop inheriting motion at whatever frame you turned it off, which would give inaccurate results.
- Walk Backwards
On the SRB Inherit panel, check the Move Y check box, once again at the beginning of your animation. This allows the SRB to move underneath the Bip01 along the Y axis, accurately displaying its movement to HeroEngine.
- When blending walk and run together, make sure that your Lead foot is the same. By having the Lead foot be the same on your walks and run, you allow HeroEngine to make a better blend, keeping the feet sticking to the ground during locomotion.
Once your animations are exported, Animation Sequence files, .asq's, need to be created. There will be three sequences to create a walk/run blend. To apply animation sequences:
- 1 for walk
- 1 for run
- A sequence that is a speed blend between the walk and run, called walk/run.
This is what your walk .asq will look like:
! ! Animation Sequence Spec ! Version=1 [ABILITIES] Apply Animation .Animation=walk.hgm .InitialSpeed=1 .InitialLoop=true .InitialAlign=false
This is what your run .asq will look like:
! ! Animation Sequence Spec ! Version=1 [ABILITIES] Apply Animation .Animation=run.hgm .InitialSpeed=1 .InitialLoop=true .InitialAlign=false
This is what your walk/run .asq will look like:
! ! Animation Sequence Spec ! Version=1 [ABILITIES] Speed Blend .SequenceA=walk .SequenceB=run .SpeedController=Speed .LowSpeedA=0 .HighSpeedA=.4 .LowSpeedB=.2 .HighSpeedB=1 .SequenceAFeedbackName=Feedback_WalkSpeed .SequenceBFeedbackName=Feedback_RunSpeed
Now that the sequences have been created, add them to the Animationset.dat file located in your creatures animation folder. The following is an excerpt from the animationset.dat file. All sequences for a creature should be listed in the animationset.dat:
! ! Version=1 [SEQUENCES] walk run walkrun
Turn AnimationsSRB Inherit Panel, check the Rotate Z axis box. This will restrict the SRB to always face straight ahead from the Character while staying beneath where the Bip01 started out, origin.
We generally do 7 turns for a character set: Left 45, 90, 135, and 180, and Right 45, 90, and 135. It is up to you to decide if this is appropriate for your game.
- Next, create an apply animation sequence for each turn animation that you created.
turn_left_90 would look like this:
! ! Animation Sequence Spec ! Version=1 [ABILITIES] Apply Animation .Animation=turn_left_90.hgm .InitialSpeed=1 .InitialLoop=false .InitialAlign=true
! ! Version=1 [SEQUENCES] walk run walkrun turn_left_180 turn_left_135 turn_left_45 turn_left_90 turn_right_135 turn_right_45 turn_right_90
Jump/fall AnimationsSRB in this case stays completely still, just like an idle.
Your .asq will look like this, minus the name of the animation, which will probably be different.
! ! Animation Sequence Spec ! Version=1 [ABILITIES] Apply Animation .Animation=fall_loop_run.hgm .InitialSpeed=1 .InitialLoop=false .InitialAlign=true
Impact animations are treated like idles as well. The SRB should stay still and the character should come back to its initial pose. It is then added into the animation agent with the ability to fall through and play on a second animation channel, in this case, the impact channel.
The .asq is a simple apply animation ability as follows:
! ! Animation Sequence Spec ! Version=1 [ABILITIES] Apply Animation .Animation=Impact.hgm .InitialSpeed=1 .InitialLoop=false .InitialAlign=true
Attack animations are also treated like Idle animations. The SRB should stay completely still. Most of the time your character will come back to rest in the same pose.
An .asq for a basic attack is once again, just an apply animation ability.
! ! Animation Sequence Spec ! Version=1 [ABILITIES] Apply Animation .Animation=Sunok_juggle.hgm .InitialSpeed=1 .InitialLoop=false .InitialAlign=true
But, if you capitalize on what the animation sequencing can do, then your character can make decisions about what animations to play next. In this case the pose could be different where these decisions are made. For example, after the character slashes, we use the extreme pose of the followthrough to cut the animation. The next animation can be any animation that starts there and then returns to combat pose. You can daisy chain as many of these as you like.
There are 2 ways to approach the SRB in this case.
- Allow the SRB to move on the x and z move axis. This allows for accurate placement if the attack is interrupted.
- The method I tend to use is to just keep the SRB in the same location through all possible sequences. Since I know that the character will return to the same combat pose and location, I can have the SRB stay put by turning off all inherits at the beginning of the very first slash.
Your .asq file for this sort of attack would look like this:
! ! Animation Sequence Spec ! Version=1 [ABILITIES] Apply Animation .Animation=combat_sideslash_open_end.hgm .InitialSpeed=1 .InitialLoop=false .InitialAlign=false Next Multiplex .AddSequence=combat_sideslash_followup_backslash 10 align .AddSequence=combat_sideslash_followup_thrust 10 align .AddSequence=combat_sideslash_followup_spin 10 align
The .asq for an animation like this, is once again just an apply animation ability:
! ! Animation Sequence Spec ! Version=1 [ABILITIES] Apply Animation .Animation=cauldron_dump.hgm .InitialSpeed=1 .InitialLoop=false .InitialAlign=true
Animation notes can be used on a character animation to trigger in game events. An example would be the release point of a particle effect or projectile during a spell cast or attack animation. Both the FX system and any HSL script can read these notes. Thus, notes can be a very powerful way of creating engaging content.
Animation notes are added via the animation panel as an ability.
As an example, we can add a note to the character_sample character. By default, your character in clean engine is of the spec character_sample. Select your character with the select tool and open the animation panel. Under the Animation Set section, choose the animationSet.dat file for the character_sample character. This is located in Character/Character_sample/animation/AnimationSet.dat. This will give you a list of all the sequences on your character. When you select the sequence a dialog should be seen below that is an apply animation ability. Click add Ability at the bottom of it as seen in the example below on the left. Choose Notes. You can put any string you want in the Note field, it can even be animation commands or macros. Most of the time, it will just be a string that the design and animation team agree upon. In this case, "Release". Then use the slider to adjust where the note is during the animation playback. Press commit changes, and you are done. Now the fx system as well as script can see this note firing off and you can tie to anything ion your game. Also, multiple note can be added if need be.
Select the sequence Combat_spellcast_left_sidearm
Now that your animations have been properly created and you have animation sequences(.asq) and your animationset.dat set up, you can wire them all together in the animation agent (.aas). For more detailed information, please see the Animation Agent Script.