Lessons learned: Sound libraries


First of all I want to kick off by saying thank you for voting! We got 30% of all votes in the 2BeeGames competition (a nice second place, in a competition that started out with 120 games!), and while we didn't win the poll, it goes to show that there's definite interest in roleplaying games. We're especially happy to have done so well with this preview version of Driftmoon, as the development of the game is still very much in progress. We also got featured in a lot of places, and are very thankful for all the support we received! We also want to congratulate all the other 2BeeGames-finalists for their success in the competition!

And on to the show. It's technical, but I'll keep it short (just kidding!). As most of you know, I spent a couple of very nice weeks redeveloping our sound engine. Why? Because I chose a poorly supported library earlier, and it crashed the game at random now that the preview was being tested on more machines. The library was Audiere, a very easy and clean library. You could very nearly play a sound by calling play(filename). I chose it back in 2005, when it was still in active development. Since then, more and more computers have got at least two CPU cores, which seems to induce a threading bug in the library. Unfortunately Audiere hasn't been updated in years, so I had to look for a new library.

I went with Microsoft's new XAct3. It looks easy enough, it has a really nice tool to set up all the sounds, supports both XBox 360 and Windows, and it's the newest from one of the most largest software companies out there. Also, Microsoft clearly states that their older DirectSound technology is deprecated, which usually means they're not supporting it, and that developers should use the newer libraries XAct3 or Xaudio2. I completely overhauled our sound engine to XAct3, now happy with this new technology. But as it turns out, new technologies often have bugs, and so did XAct3. It crashed at random when releasing finished sounds, and at random it would reuse a sound, resulting in the previous sound being played instead of the new sound. Since XAct3 was built as an easy to use wrapper around XAudio2, and the bugs were in the wrapper layer, I moved on to using XAudio2.

Now I completely overhauled our sound engine to XAudio2. To its credit I can say that it worked, and didn't have any bugs that I could see. But it had one little flaw - it required the absolutely newest DirectX version. That's not going to be a problem in a few years time, and it's not a problem for any larger games where your average user is willing to upgrade his whole computer to play the game. But I couldn't just put in a message saying you need a new DirectX pronto, chop chop to Microsoft and install it, hope it runs on your outdated hardware, then if you still remember, try our game.

So I completely overhauled our sound engine to DirectSound. I've been using it in all of my previous games, starting from the year 1999. It works just as perfectly as it ever did, and even though Microsoft says it's deprecated, I'm sure they don't really mean that. So that's what I was doing for the past two or three weeks. I'm really glad I can get to working on the actual game now...

blog comments powered by Disqus