Sunday, August 3, 2008

Sounds and Battle

This week I took a look at introducing sound into the client. I found OgreAL a snap to use, it's API is modelled after the built-in Ogre managers such as material and resource manager, so not only was it familiar but also cleanly designed. Unfortunately, technical problems (crashes without any indication of the error - my favourite!) arose when I tried running the code, which I attributed to driver issues, as switching to "generic software" audio drivers - done by passing in a parameter during creation - solved the problem. This parameter is not available for Python-Ogre 1.1 which uses an older OgreAL API.

So all I had left to do were the sound effects.

As I mentioned, I found a program for generating ambient soundtracks last week. It's really a sine wave generator and I'm currently trying it out as a background track. I haven't thought much about what sort of music would be suitable for a game of Thousand Parsec, perhaps I will have the client play any .ogg files it finds in the directory, similar to how Oblivion does it. This way, the user can specify his own soundtrack, although it would be nice to have some original music of our own too.

I spent a while trying to create sounds for other parts of the client. Right now, I've put in a "engine rumble" and clicking sounds for buttons on the gui. Once again, I found a useful utility for these sounds, called sfxr. Most of the sounds produced are pretty lo-fi, but it's suitable for stuff like laser noises and the engine rumble was made from this too (plus some processing in audacity). Hm, there should be some way to embed sounds in blogs too...

I think that the background track does add a lot of atmosphere, but my taste in music is pretty much like that anyway (see Drone Zone on SomaFM) so hopefully it won't annoy others. The sound effects will require a bit of tweaking as well, as their volume varies based on the user's location (automatically handled by OpenAL) and they can sound too loud or too soft at times.

One of the primary motivations for adding sound was to supplement the Battle module, a standalone program for viewing BattleXML files.

Currently, it does not process the actual battle, but it does create and show the initial locations of the fleets. I'm still figuring out how to define weapon locations and attach them to the ships, which should be fun once it is done. Also, there seems to be some texturing issues with the models as well, hopefully I can fix them in Blender.

An additional windows installer script has been created as well, which actually just places the compiled client into your program files directory and create start menu shortcuts. The process of creating the installer actually exposed some bugs - although everything works, on shutdown the client outputs an error log, saying that some background threads had been forcefully shutdown, which made me realise that perhaps I hadn't been closing the client library threads properly, something that I have yet to look into.

Next week, I will be finishing up the battle module and tying up loose ends:
- the starmap could use a navigation bar for zooming and centering
- the title screen should have the TP logo
- using theora to display the intro movie
- a minimap for lost players
- writing up documentation
- packaging linux and mac binaries (big problem here)

No comments: