Game Dev Blog #8: Sound!

This entry is part 9 of 13 in the series EDX CS50G Game Dev Course Final Project

Three Achievements, Two Things Learned, One Thing Coming Up.

Three Achievements

  1. Sound Manager. I’d been thinking about how I want to manage sound in my game. My approach has been to create an abstract SoundManager component, that can be game agnostic (usable in other games I make) with a tagging system, when loading in sounds. Which let’s me add sounds like this:

    SoundManager:loadSound(“hurt”, {“assets/sounds/hurt0.wav”, “assets/sounds/hurt1.wav”}, {“pitchable”, “sfx”})

    Which I can then use like:

    • Adjust the volume of all sfx sounds setVolumeForTag(“sfx”, 0.5)
    • Play a variation of a sound, e.g, SoundManager:playTaggedSound(“hurt”)
    • Pitch the player sounds for different characters: SoundManager:setPitchForTag(“pitchable”, 1.7)

  2. Sounds added! With the sound manager in place, I’ve now got sounds added for player walking (on dirt and stone), digging, jumping, getting hurt, death, pulling themselves up, and whistling when idle.
  3. Background music and ambience! I thought it’d be cool to have sounds of birds when the game starts, but as you go underground, the ambience changes to cave sounds like dripping water.

Two Things Learned

  1. OpenGameArt is great! I’ve been able to find a lot of sound effects on this website, which I will credit in my game. At some point in the future I will likely swap them out for custom sounds.
  2. Sometimes you have to make your own libraries. I did wonder if there was a sound manager library that already existed. A saw a couple but they were either not maintained or didn’t do what I wanted. Sometimes you’re better off just making your own component library, which gives you the added bonus of being able to customise it to your needs.

One Thing Coming Up

  1. Build 0.1.0.9 will contain sounds to go with the animations added in 0.1.0.8 – it’s starting to feel like a real game. Next job will either be to make the health bar tween when taking damage, and then working on customisation options to let the player decide how they want the game to function. I already have a config.ini file in my projec to store the version number. I’ll probably create another abstract game-agnostic ConfigManager component that works for this game, but can be re-used in other projects.

Series Navigation<< Game Dev Blog #7: Animations!Game Dev Blog #9: More component libraries! >>

category:

Game Development

Tags:

No responses yet

Leave a Reply

Your email address will not be published. Required fields are marked *

Series

Recent posts

Categories

Latest Comments