- This line was added.
- This line was removed.
- Formatting was changed.
After adding sounds of gunfire and ambience to our Chinese garden level in the previous chapter, we now move towards adding sounds of footsteps and foley to the first-person player character.
Take a moment to go through the audio files located in the chapter_02 folder of your chosen middleware implementation, located within the Audio Showcase assets' installation directory. The files c_player_fts_wood_01 - 03 (or Play_c_player_fts_wood_L/R, if using SDLMixer) are sounds for footsteps, while c_player_foley_leather_long_01 - 03 (or Play_c_leather_long, if using SDL Mixer) can be used as foley for the player character's leather outfit.
In this chapter, these audio files will be added as sounds and foley to the player character's footsteps via your choice of middleware implementation and the Character tool.
Chapter 02: Audio for Animations is compatible with CRYENGINE releases 5.6 and later only.
Creating Triggers for Footsteps and Foley
Three events need to be created and added to our first-person character:
To do this, as in Chapter 01, the audio files need to first be added to FMOD's Audio Bin.
While the foley sound in this tutorial plays in the center of the stereo panorama, it's more appropriate to hear the c_player_fts_L event on the left and the c_player_fts_R event on the right, since they correspond to the left and right footsteps respectively.
To position the sounds of these two Events:
The last thing that needs to be done is to create a new Soundbank that will contain the metadata relevant to the Play_c_player_foley_leather, Play_c_player_fts_L and Play_c_player_fts_R Events.
Once done, save your FMOD project and build all Soundbanks by pressing F7. If you now switch to the ACE, you'll find the new Events and the Animation Soundbank listed in the Middleware Data panel. Recall that in order to use Events and their Soundbanks within your CRYENGINE project, Events need to be connected to Triggers and Soundbanks to Preload Requests.
As always, remember to save and refresh the ACE before proceeding.
Creating and Positioning Events
Three Events, for foley, left and right footsteps respectively, need to be created for our first person character.
Since we need only a generic 2D Container for foley, the c_player_foley_leather_long Random Container can use the same simple setup as the l_cg_amb_one_shot_tree_movement Container created in the previous chapter.
We'd like to hear the footsteps on both the right and left positions of the stereo however, which is why we'd like to set the c_player_fts_wood_L Container to 3D playback. Normally the sounds in a 3D Container would be positioned by the game engine; but since we'd like them to play at a specific position on the left/right foot, we'll position the sounds ourselves.
We do this by first selecting the c_player_fts_wood Random Container, and then the Positioning tab in the Property Editor on the right.
Press the spacebar at any time to preview the outcome of your positioning. When satisfied, go ahead and rename the Random Container to c_player_fts_wood_L since it now corresponds to the sound of the left footstep. To create a similar Random Container for the right footstep, create a copy of the c_player_fts_wood_L Container in the Animation Actor-Mixer, then simply rename the copy to c_player_fts_wood_R and set its playback position to the right.
To make Events of the three Random Containers we've created in this section:
Finally, create a new Soundbank called Animation and add the Animation Events folder to it as we did in Chapter 01.
Once done, save your Wwise project and generate Soundbanks by pressing the Generate All button. If you now switch to the ACE, you'll find the new Events and the Animation Soundbank listed in the Middleware Data panel. Recall that in order to use Events and their Soundbanks within your CRYENGINE project, Events need to be connected to Triggers and Soundbanks to Preload Requests.
As always, remember to save and refresh the ACE before proceeding.
Save and reload the audio engine before proceeding.
Adding Triggers to Animations via the Character Tool
The Triggers that were created for footsteps and foley have to now be associated with our character's movements.
For this we use the Character Tool, that which allows users to define and set up characters by importing assets authored in third party tools. A fully authored character usually consists of a 3D model, a skeleton, physical properties and an associated animation set.
Go ahead and open the Character Tool by clicking on the Tools -> Animation -> Character Tool option from the Sandbox's Main Menu.
For more information on the Character Tool, please refer to our user documentation.
On the left of the tool window is the Assets panel which provides an overview of all character-related assets. Navigate to the skeleton of the player character located under Skeletons/Objects/Characters/SampleCharacter/skelProxy.chrparams.
Creating an Animevents file
The first step is to create and associate an .animevents file to the skeleton of the character, which will contain information regarding the different triggers an animation must execute while running. These triggers can be audio Triggers, Switches, or even particle effects.
Create new Animation Events file
Click on the Create a new Animevents File... button under the Character Tool's Properties panel on the right, and create a new .animevents file under ../Objects/Characters/SampleCharacter/.
Let's name it player.
Note Save the Skeletons/Objects/Characters/SampleCharacter/skelProxy.chrparams file by right-clicking it in the Assets panel, and selecting the Save option from the menu.
Once created, open the player character's Character Definition File (.cdf) from the Assets panel under Characters/Objects/Characters/SampleCharacter/firstperson.cdf.
Double-click the CDF to choose it as the active character; this loads the character model in the middle of the tool window, and its properties on the right.
If you're seeing proxies/physics helpers over the character model, deactivate them by clicking the little mannequin and cross at the top of the screen.
You can now open the animations for the first-person character, which are stored under the Animations panel situated on the left of the Character Tool.
The left panel of the Character Tool can be split, so that the bottom half is filtered to only show animations for the active Character Definition File.
To do so, click the icon above the left panel to split it, then click the All Types dropdown to select which type files you'd like to see.
Since we're looking to add triggers to the player's footsteps, it's the walk-cycle animation of the character we're interested in, stored as 2DONE-BSpace_MoveStrafeRIFLE in the bspace folder. Click it to play the animation.
If the walk-cycle animation fails to play on click, deactivate the Bind Pose toggle in the Scene Parameters column on the upper-right of the character tool.
As the animation plays, the timeline at the bottom of the Character tool displays its progress in seconds, frames or normalized units where the length of the animation is scaled to 1.0.
Creating Animation Events
You now need to create Animation Events for the character's left footstep, right footstep and foley respectivelyeach, associating the Play_c_player_fts_wood_L, Play_c_fts_wood_R and the Play_c_player_foley_leather audio triggers to them respectively.
Since Animation Events use normalized units for timestamps, it is recommended to set the animation timeline's units to 'normalized'.
- With the animation playing, double-click the animation timeline as soon as the character's right foot hits the floor, which is normally around the 0.35 mark (in normalized units). The created Animation Event will now be listed under the Animation Events panel at the bottom-right corner of the Character Tool window. Then, assign the Play_c_player_fts_wood_R trigger to this Animation Event by clicking the icon against next to it.
- Similarly, create Animation Events for the left footstep trigger Play_c_player_fts_wood_L, and foley trigger Play_c_player_foley_leather_long, respectively. Feel free to use the timestamps shown in the image below.
For animations that play in third person, it makes more sense to attach triggers to specific bones of a character. To associate a trigger to a joint at a specific Animation Event, click the icon against next to an Animation Event's listing.
This brings up a list of all joints used by the character. Select the most appropriate one by double clicking it.
Character Tool Best Practices
If using CRYENGINE 5.5, you might find that although the footstep/foley triggers play within the character tool, they're inaudible within the level.
This is because custom code that is needed to direct audio triggers from the animation system to the audio system has been omitted from the Showcase_Audio level. From CRYENGINE release 5.6 onwards, users will be able to connect between the animation and audio systems by enabling a CVar.
You're now ready to test the character's footsteps. Make sure to save all changes made in the character tool by selecting the File → Save All option from the menu, before jumping into game mode (Ctrl + G) in the viewport.
If timed correctly, the left/right footstep audio triggers should play with every step of the player character, interjected by the sound of foley. This concludes Chapter 02 of our level's audio design.
You might feel that the footsteps are quite repetitive, especially since only three assets have been used for both feet. Variations can be added by adding pitch randomization to the sounds on FMOD or Wwise.
You may have noticed a campfire in the center of your Chinese garden level. The next chapter will have us adding audio effects to this campfire, before we finally move towards developing a dynamic ambience for the entire scene in Chapter 04.
On This Page
|Table of Contents|