Controlling the Sound

For my next project, I needed to have a sound controller. However, my initial implementation was very, very sloppy. It consisted of one sound controller for background music, one for sound controller that exists after an object has been destroyed, and one to have individual objects play sound so that the player can position the object by it’s sound. I ended with different objects for all three and two different scripts for their functions. I’m not happy with the way the code ended for these sound controllers and I know there’s many ways to simplify it, however I ran out of time and the game needed to be shipped. Thankfully the messy code had no noticeable effect on the game during run time.

 

I would have prefered to use the single sound controller, and place multiple functions within it. I would then use it to generate sound at all points and when necessary, I would destroy the instantiated sound controller at the appropriate time. This system does not, however, allow for any further tweaking to the sound before its player. The code does not have the capacity to adjust volume or pitch before playing the sound, it also requires any randomisation of the selected sound to be done outside of the controller(however this is not so much of an issue). It clearly is possible to do these things and many tutorials on the unity forums give great examples of sound controllers that do just this. For example, this tutorial gives instructions for a sound controller that allows for randomised pitch, volume and sound file.
Interestingly, after I implemented this system into a VR project I’ve been working on in my spare time(the little I get). I found that the difficulty of the game dropped massively. Prior to implementing this sound functionality, the enemies seemed to overwhelm the player at the beginning of the game, making  me believe it needed to be toned down to help the player adjust. But the moment I added sound, the player dealt with enemies with ease. This is not what I expected at all. I thought that the player might improve slightly from being able to earlier position the enemies, but going from regularly losing lives, to losing none in the first 5 waves, is a big change. So sound clearly has a much larger effect on a game’s difficulty than I thought, I’ll take this into account before trying to stabilize a game in the future.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s