This page deals with the AnimEvent Database and the Tracks Database. For general information about the .chrparams File and on how to map animations, see the Mapping Animation Assets and Character Parameters File (chrparams) documentation.
The .chrparams file, or Character Parameters File, contains a reference list of animation files (.caf) to character specific animations in the game. The .chrparams file has the same name as the character file to which it refers.
Aside from listing all animations that the engine should load for the character, the .chrparams file has special entries the allow the specification of an animation events database and a tracks database. Both entries are optional.
The AnimEventDatabase Entry
Animation Events in Character Editor
To explain the AnimEventDatabase entry, it will help to refer to the Animation Control tab in the Character Editor.
This panel allows you to preview and to explore animations frame by frame. It also allows attaching events to selected animation assets. Events are user defined notifications for the base application. It uses the callback system to inform the base application that a certain keyframe was passed in an animation and that this is the right moment for the application to start an action (set foot-plant, print text, play sound, or trigger a particle-effect). Every event has a name and a keytime 0-1. It can also have a custom parameters or a bone-name. Events are directly tied to the animation-asset (and not to the animation-name in the .chrparams file). Each animation asset can have an unlimited amount of events, but each event needs to have a different name. Because of this, you cannot call the same effect twice unless you have a copy of it with a different name.
When loading a CDF or a CHR it automatically loads the event database as well if there is an entry in the .chrparams file.
Usually there is one single event database per model-type. All humans could share the same database. It is possible to create a different database per character, but this is not recommended. Try to avoid identical event-names for cleanliness.
- Save: Saves the updated event database.
- New Event: Creates a new animation event. You need to specify the event name and the keytime.
- Delete Event: Deletes the currently selected animation event.
- Select Sound: A convenient function because events were, in Crysis, mainly to trigger sound effects. Events are, however, by no means limited to sound. In this case you can select a sound path as a parameter. A parameter can be any string or number. It's also possible to choose a joint where you want to play the sound. All sounds are in 3d-space.
- Use Selected Effect: Opens the database view where you may select a particle effect. Now you are able to assign this effect to the character and trigger it and preview it CharEdit. Its also possible to choose a joint where you want to attach the particle-emitter.
Animation Events in Game Code
When an animation is played and it's time hits or passes the animation event's time that is defined on it, the event will trigger and be send to the the game object.
There are functions inside actor and player that will receive the event along with the event parameters (which animation triggered it, the event's name and the custom parameters like dir, offset and the parameters string.
This allows you to create your own markup inside an animation to trigger any system that you need it for - be it melee, IK, sounds, or other effects or mechanisms.The function handling the events can be found inside Actor.cpp and Player.cpp, and it is called: