Weapons and Sound

Overview

Mannequin is the main tool for triggering character and weapon animations and also to trigger sounds for these animations. Sounds are added to weapons by placing them on the matching Fragments in Mannequin.

The distinction between first or third person, weapon type and fire mode all happens there by applying the corresponding tags. A detailed explanation of how it is done in the SDK can be found here: Tags

Fire Modes

In the SDK we usually distinguish three fire modes. Fire, rapid fire and burst all have their corresponding IDs in Mannequin. Fire describes single shot fire, rapid fire any kind of looping shooting behavior and burst a single fire mode that fires a certain amount of bullets when pressing the trigger.

Single Fire

Single fire mode is fairly easy to set up. We just have to add the sounds to the sound Scopes on the corresponding Fragment and make sure within FMOD that they are set to oneshot.

Rapid Fire

Rapid fire usually is either a loop or a set of loops that are stitched together while firing the weapon. Considering that the player can stop firing the weapon at any point of the loop we need to be able to finish the last shot and only stop playback shortly before we reach the following shot. We achieve this by adding sync points to the sound asset. The asset requires markers to be placed at the position of the sync point:

Further the Soundbank needs to be flagged accordingly inside the FMOD Designer:

Finally for the PlaySound clip in Mannequin that we use to play the rapid fire sound we need to set the synchedStop option to 1.

Burst Fire

Burst mode is for the most part also a oneshot sound that plays as many firing sounds in succession as our burst mode is set up to fire. Considering though that the number of bullets fired in burst mode might not be a common denominator of bullets in the clip – maybe because the player shot a few rounds in single fire mode – the clip will hold less bullets than the burst mode usually requires when we empty it. E.g. we have a three round burst fire mode and before firing our last shot we end up with having only two bullets in our clip. In this case we would want to trigger a sound with less repetitions. We can achieve this by sending the amount of bullets being fired to FMOD. This is done by setting the 'useBurstSoundParam' to 1 in the respective weapon xml like this:

<burst>
…
<param name="useBurstSoundParam" value="1" />
…
</burst>

In FMOD we then add a parameter called 'burst' and provide sounds with the different number of repetitions.

Tail Sounds

In order to not spam the soundscape too much a gun firing in rapid fire usually only triggers the sound of the gun tail after it finished shooting. Therefore shooting sounds and tail sounds are different events. Tail sounds, like the other gun sounds, are triggered via Mannequin. In the SDK this is done under the spin_down ID as you can see in the example below:

In the Fragment Browser you can also see that we used the OneShotSound Scope for the tails instead of the WeaponSound one. This is because we don't want the tail sound to conflict with the firing sound of the weapon.

For multiple tail setup the FMOD event requires a "environment" parameter. We have the option to either use an "environment_sound" or "environment_listener" parameter. They differ in that way that the "environment_sound" takes the location of the sound into consideration and "environment_listener" the location of the listener. It directly connects with the reverb entity Environment entry enabling to set different tail settings depending on the environmental design. Here an example from the FMOD sound event:

There we provide an "environment_sound" parameter and two tail sounds stretching from 0 to 1.75 for outdoor and from 1.25 to 3 for indoor. This system can easily be enhanced by increasing the environment parameter values and add more sound definitions. The value of the parameter is determined by the "Environment" value of the ReverbVolume and needs to be set by the Designer (default value is 1).


In this example the outdoor tail is being set (environment = 1).

Tips

Creating one FMOD project per weapon has proven to be a good choice. It not only helps keeping an eye on memory budget it also enables multiple designers to work at multiple weapons at the time.

Splitting the FMOD soundbanks according to the sound target as well as a "shared" bank for elements both targets use will decrease memory usage and also enables the AFCM to only load the soundbank which is needed via the gamehint system.

Also reusing the tails on single gunshot SoundEvents do save some memory since the actual attack of the gun is fairly short from an asset perspective.

Also using FMODs granular functionality helps to save memory while avoiding repetition. By this the original loop gets cut into small pieces of three to six shots and randomized via the SoundDefinition property as shown in the example below:

Lastly, i_reload is an important CVar. It will reload all weapon scripts.