The Daily Click ::. Projects ::. The Orphanage
 

Project: The Orphanage
Project Started: 21st February, 2008 Last Update: 27th May, 2009
Project Owner: ben mercer Project Members:
Project Type: Tactical shooter/Survival horror Project Progress:

Faking Acoustics
Posted 30th Jan 09, by ben mercer  
Sound has become an increasingly large part of this project. It is a great way to add ambience to a game and also can be used to provide cues to the player where a visual cue would be unnatural.

Compared to the directsound 2 extension available in MMF1.5, MMF2's built in sound system is woefully underpowered. In previous versions of the game, there was no positional sound; all sounds played at the same volume no matter where they came from. This made adding ambient effects very awkward because they would suddenly "switch on" as the player got close, rather than fading in smoothly.

In the end I said "screw it" and coded a custom 2D positional audio system in MMF2. It is not the most efficient of solutions since it must loop to find available sound channels each time a sound is played, but it this didn't have any noticable impact on performance.

Now positional sound is all very well, but for sound effects in an action game to feel realistic it takes more than just fade and pan. For a sound wave in real life, there are many different things that affect the sound; attenuation, diffraction, scattering, reflection which all affect what the state of the sound will be once it finally reaches the listener. These would be practically impossible to model in MMF2 (unless someone would be kind enough to add a real time DSP convolution mod!) but pretty cool results can be achieved simply by faking it.

For example, sounds heard from afar are muffled, because high frequencies attenuate more quickly than low. Since gunshots and explosions are the only sounds you can really hear from far away, I made muffled, more reverberant versions of a gunshot sound, and used a mix between the two depending on the source distance.

Gunshot getting steadily nearer.
http://stuckengine.sitesled.com/devlogsound/gunfarnear.mp3

Explosion getting steadily nearer.
http://stuckengine.sitesled.com/devlogsound/EXPfarnear.mp3

Sound is also a huge part of the player weapons. A really powerful sounding gun feels viscerally cool to fire, just like driving a car with a loud engine, and will probably affect the feel the player gets for the weapon just as much as it's accuracy and recoil etc. However sheer volume is not enough to make a gun sound powerful. Firstly you must make a distinction between single shot and automatic weapons. Single shot weapons can have a nice long envelope to enhance the notion that the shot is really powerful.

Sound of a railgun being fired.
http://stuckengine.sitesled.com/devlogsound/railgunfire.mp3

Now consider an automatic rifle. You want it to sound powerful if you let off a single round, but you don't want it to swamp your speakers with reverb noise when you fire it in automatic, because this is not how guns sound in real life. When a gun is fired it creates a pressure impulse which reaches our ears directly, and shortly afterwards indirectly (via reverberation), but the direct impulse is of such a high amplitude that it masks the indirect sound almost completely during automatic fire (due to a psychoacoustic phenomenon known as masking).

Here's an early sound I made for the pistol. It sounds ok(ish) for single shots but for repeating fire it just sounds plain awful.
http://stuckengine.sitesled.com/devlogsound/badsound.mp3

You can "fake" the effects of auditory masking by considering two ideas:
1) Make the reverberation tail much quieter than the initial impulse. Then the masking will occur naturally in the player's auditory system during play! But there is a problem with this method. For the auditory system to experience the same level of masking as it would for a real gunshot, the speakers need to be as loud as an actual gunshot; if the volume is turned down you end up with a rather unimpressive "pop" sound. Either that or really irritated neighbours.
2) Make the reverberation tail initially quieter, but then allow it to regain some of its volume by fading in. This is the solution I have used, and makes for some absolutely wicked sounding machine guns (see the screenshot).

l85 firing some shots.
http://stuckengine.sitesled.com/devlogsound/l85-newest.mp3

M249 firing a long burst.
http://stuckengine.sitesled.com/devlogsound/m249fire4.mp3

AK47 firing some shots.
http://stuckengine.sitesled.com/devlogsound/AK101_3.mp3
Preview


Posted by Marko 30th January, 2009

The effort your putting into this game is mind-blowing - looking forward to the final product so much!!
 
Posted by Fanotherpg 30th January, 2009

Ben you are madman... But I love you!
 
Posted by Codemonkey 31st January, 2009

Fancy stuff ben!
 


 



Project Forums


Favourite

Advertisement

Worth A Click