FicEngine: Sound

Amplifier This is a fairly quick entry on a fairly simple system. The point of this post is not so much to brag about my Sound system- it works quite well but it’s nothing remarkable- but to sing the praises of leveraging existing code.

The FicEngine Sound Manager is built on top of SDL_mixer: a free and extremely easy sound library. For my first game, Kill Dr. Cote, SDL_mixer allowed me to get sounds working in a matter of hours, and using a system that has served me through several games. Instead of writing a whole sound system from scratch, I simply gave my sound manager a few new tricks that I know I’ll want, for instance, using my Catalogs (see Asset Management to easily reference sounds in code, and adding panning based on the position of a sound source on screen. It’s actually surprising that I’ve written so many games without that seemingly required feature. But now sounds will come out of the right speaker when an explosion occurs on the right side of the screen, and the sound can optionally move across the screen along with the source if necessary.

Adding these improvements will increase the quality of in-game audio, the clarity of audio code, and best of all, it took about half a day to code. The simplicity of the system also results in good stability. I give a lot of credit to the ease of use of SDL_mixer. While I could code a complex audio system from scratch, it’s a downright stupid thing to do. Why? Because there are already plenty of libraries out there that do a perfect job of it! I’m talking SDL_mixer, OpenAL, fmod… here are libraries that have teams devoted to making sure they run correctly and stay updated. It’s not a case of “if you want it done right, you gotta do it yourself.” In software development, it’s quite the opposite. Every system you code yourself is another system that will fuck up and have to be debugged. Note I didn’t say “can fuck up”… I said “will fuck up.” Because it will. And every second you spend trying to figure out why your sounds aren’t loading correctly or garbage noise is exploding out of your speakers is a second you’re not making games.

So could I have gone with a more elaborate system such as OpenAL or fmod? Sure. But that’s also extra coding time, just to get to the point I’m already at. Those systems require much more code just to load and play sounds, at the tradeoff of getting cooler features later on. If I need features and effects that only those complex systems can offer, then yeah, it will be time to evaluate switching over. But right now, I have a very good system that gets the job done, is easy to use, and took very little time to create. THAT’S smart coding.

FIC OUT.

Thursday, October 11th, 2007 FicEngine

1 Comment to FicEngine: Sound

  1. Yeah, but how long did it take to write this entry? Huh? Alot of time spent there not making games! Hmm, hmm? That’s right.

  2. reallyjoel on October 30th, 2007

Leave a comment