Programming Blog 13 – What Was That Noise!?

Hey there guys and gals, it’s been a while hasn’t it? You remember me right? This time I get to tell you all about the other things I do here for Monstrum. Not only do I program the beasts that hunt you down, I also put Jaime’s sounds into the game to creep you all out. So Hi, I might be the guy you love to hate as you play through it.

So how do the sounds of Monstrum get from our workspaces into your ears and get you involved in our game? By our own Audio System of course!

When we first started work on Monstrum we realised that we needed to do more than just play sounds in the right places to give you scares every now and then. We decided we would need to do everything we can with the sounds and use sound to its full potential. This includes cross-fading between various sound sources, audio being occluded by walls and also sounds that affect the game itself! So how does it all work?

After I import the raw sound files into the assets of our game we import those files straight into our audio system. Basically, the audio assets are all broken down into folders in Unity. These folders are then used to create Audio Libraries, with each folder being its own separate library. These allow us to edit all of the monster’s roars all at the same time in one easy to use system.

Possibly the least scary screenshot of a roar to ever exist

 

Once this Audio Library has been created we can start to mold the sound into what we want it to be.

So do we:

(Audio Type) Want it to be a sound effect or a piece of music?

(Loop Type) Want the sound to loop or to only play once?

(Randomness Type) Want to randomize and pick a sound from the library at random or just list through them?

(Occlusion Type) Want the sound to be occluded by walls?

(Start Granular) Want it to play right away or play it after some time has passed?

(Start Volume) Want it to be loud or quiet?

(Start Pitch) Want to increase or decrease the pitch?

(Fade This) Want this sound to fade in or just play it right away?

*Catches breath*

The most eagle eyed of our readers will also notice that there are some randomness variables in there as well. These are to give us a bit more variation from a fewer sources, as pitch shifting a group of 10 samples is lighter than having a group of 50 hanging around!

These variables let us finely tune each sound’s playback properties. When we call for a sound to be played within the game the audio source refers back to the Audio Library of the sound needing to be played and follows what the library tells it to do. Therefore our lovely monster roar behaves in a completely different way from your character’s footsteps, falling over traps… being killed by the monsters. You know, all those things that you might do in the game.

 

Occlusion? What’s That?

Monstrum is a procedurally generated horror game where you encounter a monster that occupies the ship you are stranded on. So, you are not the only thing on the ship making sounds, and these sounds may not be coming from the room you are currently in. It may be the monster walking about in the rooms close by, up the stairs, anywhere. By changing how you hear the sound you are given an idea of where that monster is. We do this by occluding the sound to make it sound quieter and more muffled depending on how many things are between you and the monster.

Every wall that is between you and the sound’s current location will decrease the sound’s volume and lower the cutoff point of a Low Pass Filter. The filter modifies the sound by stopping frequencies above a cutoff point from being played, only frequencies below that to pass through. This gives the impression of the sound being muffled by the walls. The more walls between you the sound means you will get lower volume and a more muffled sound. So when you are hiding terrified in your metal coffin (sometimes referred to as lockers) you will be able to say something like this:

“I HEAR IT! I HEAR IT! IT’S THERE! IT’S RIGHT IN FRONT OF ME!”

or

“It’s to the right, but it sounds quiet and a bit muffled. I think it may be safe now”

I got scared a used a radio instead of a monster to demonstrate

 

Sounds That Affect The Gameplay?

All of the above just tells the game how to play the sounds, how does all of that affect how you play Monstrum? What’s missing in the post is an extra little script not only allows you to hear the sound, but it allows the monsters to hear it as well! Some sounds have greater effect than others but all have the ability to alert them towards that area. During your time on the ship this feature could be a blessing or a curse. You could use it to your advantage and try to distract the monster to another location or you could just bring him right to you as you were making too much noise. No matter how you cause these sounds, expect to have company soon.

 

That will be all for now.

Gary.