The foley and footstep system allows to sync movement sounds with the animation. It also offers to alter the sound based on the character while using the same animation.
To enable character based foleys and footsteps it requires "CharacterSounds" entries inside the Entity Lua script.
Following example is taken from the player.lua which can be found under Game\Scripts\Entities\actor
.
footstepEffect = "footstep_player", -- Footstep mfx library to use
remoteFootstepEffect = "footstep", -- Footstep mfx library to use for remote players
bFootstepGearEffect = 0, -- This plays a sound from materialfx
footstepIndGearAudioSignal_Walk = "Player_Footstep_Gear_Walk", -- This directly plays the specified audiosignal on every footstep
footstepIndGearAudioSignal_Run = "Player_Footstep_Gear_Run", -- This directly plays the specified audiosignal on every footstep
foleyEffect = "foley_player", -- Foley signal effect name
footstepEffect | Specifies the Effect Library to use for first person player view |
remoteFootstepEffect | Specifies the Effect Library to use for third person player view |
bFootstepGearEffect | Specifies whether to play a hard coded gear sound |
footstepIndGearAudioSignal_Walk | Specifies an AudioSignal triggered when walking |
footstepIndGearAudioSignal_Run | Specifies an AudioSignal triggered when running |
foleyEffect | Specifies the Effect Library to use for foley entries |
After specifying the Footstep Effect Library this entry has to be created in the MaterialEffects.xml table under \Game\Libs\MaterialEffects
.
The corresponding effect depending on the material defines the actual FMOD SoundEvent to play. This is done in the Effect Library stored under \Game\Libs\MaterialEffects\FXLibs
.
Footsteps do take the FMOD parameter "speed" into account. This parameter offers to modify the sound depending on the game-world speed of the entity.
Now the "footstep" entry is required on each animation for the correct timing. This is done in the Character Editor inside the Animation Control Tab and stored in the animevents file.
The following example is taken from Game\Animations\human_male\human_male.animevents
.
With clicking on "New Event" and naming it "footstep" it generates a valid signal which will be send when the animation hits this specific point.
Once the Effects and SoundEvents are being specified the corresponding animations require the "foley" entry and effect selection to function correctly.
Please do notice that the Character Editor does not have a surface type and therefore uses "default" material. It can be changed by typing in an existing surface type into the "parameter" field.
Don't forget to remove it after adding the footstep entries otherwise it will override the surface type coming from the MaterialEffects table.
Character based Foleys do not require to be run through MaterialEffects.xml table since they are not depending on the material.
Therefore it requires an Effect Library specifying the FMOD Sound Events for the different foley actions inside the foley_player XML under Game\Libs\MaterialEffects\FXLibs
.
...
<Effect name="gear">
<Sound>
<Name>Sounds/physics:foleys/player:gear</Name>
</Sound>
</Effect>
<Effect name="gear_slow">
<Sound>
<Name>Sounds/physics:foleys/player:gear_slow</Name>
</Sound>
</Effect>
<Effect name="gear_medium">
<Sound>
<Name>Sounds/physics:foleys/player:gear_medium</Name>
</Sound>
</Effect>
<Effect name="gear_fast">
<Sound>
<Name>Sounds/physics:foleys/player:gear_fast</Name>
</Sound>
</Effect>
<Effect name="bodyhit">
<Sound>
<Name>Sounds/physics:foleys/player:bodyhit</Name>
</Sound>
</Effect>
...