Building Tension With Sound in Your Game! đź“Ł
This post will explain how to create an ambience that reacts to gameplay using FMOD like in our game Project Ghost.
First Things First
For those that do not know, FMOD is a sound effects engine used by sound designers to create systems with custom logic, and it connects to Unity seamlessly. Learn more about this tool here.
In order to create a convincing ambience, we need audio files, a way to play them so that payers don’t notice any repeating or looping, and a way to make them react to gameplay.
Sound Effects
An ambience usually consists of dozens of individual sound effects. If you want to know more about recording your own sound effects, you can read more about our recording session inside actual haunted buildings here.
FMOD Events and Tracks
The main takeaway here is that the ambience is actually a collection of sound effects called events that trigger all its sound effects according to a specific logic. The image below shows Project Ghost’s ambience event. Each track contains sound instruments that trigger the sound effects themselves.
The first two tracks in blue are Single Instruments. They are 15 seconds sound effects that loop endlessly. They provide the base onto which we build the ambience.
The other tracks in green are one-shot sound effects that are triggered by FMOD Scatterer instruments.
Scatterer instruments contain sound effects that are randomly triggered according to the instrument’s settings like the minimum and maximum distance a sound can play from the listener and the interval at which sounds are being triggered. We are using multiple Scatterer instruments because each of them contains sound effects that are similar to each other.
FMOD Parameters
Using only Single and Scatterer instruments can create convincing ambiences. A player might never notice that all the sounds they hear are looping forever using these two tools only. However, it will not react to player input. For that, we need to create an FMOD parameter that will connect to the state of the game.
For example, in Project Ghost, players are contracted to enter a haunted mansion in order to get rid of the ghost inside. As players interact with the mansion, they accrue agro. When a player’s agro reaches 100, the ghost will appear and attack.
Therefore, we want to create a system that builds up according to a player’s agro to make the gameplay more exciting and give feedback to the player that “something” is happening.
In this case, we need to create an FMOD parameter that matches the player agro variable in-game. Its range is 0 to 120.
With a parameter, your event plays audio asynchronously with time. Typically, a sound plays from left to right with a playhead representing the passage of time. With a parameter, the play head represents player agro. This is extremely powerful because you can change the settings of your audio tracks with automations that will change the nature of the sounds over player agro instead of over time.
FMOD Automations
All that is left to do, is to automate track settings so that your event evolves over player agro. For example, volume changes are great for raising tension.
Therefore, we automated the first track’s volume to increase with player agro. We are also changing the pitch of this track ever so slightly. The red lines represent automation. In this case, it changes volume and pitch.
We can also automate settings on the Scatterer instruments. For example, as player agro increases, we increase the frequency of jump scares to occur. We are also muting jump scares until the player has at least 20 agro.
Result
Here is what it sounds like all together: