Sunday, March 28, 2010

Groovy sound bytes

Another week wasted. No poop for me this time though, Nah, this weeks turn was for our little daughter. The doctor sais she has an ear infection (again), but so far the antibiotics aren't really working, and she has a serious ugly cough. As if she smoked cigars for 16 years. Problem is that she can't really tell what's going on yet. One hour she is happily destroying the house as usual, 10 minutes later she sits there as a zombie, throwing up on daddy's new shirt.

So, I spend a few days at home. And while she was asleep I still got a chance to research a few things. Maybe one of the reasons many game-programmers are always focusing on the visuals is because they are, well, pressentable. If you want to impress or motivate yourself, create some new shaders or 3D maps and capture a screenshot. However, many game aspects are invisible techniques. Enemy AI, path-finding algorithms, entity structures, editors, scripting, and how about sound?

So, this week I can't really show you something again. But I found quite interesting stuff about sound. So far, sound was just a matter of playing .WAV files or streaming some music. Later on OpenAL added 3D sound to my engine, including some cool reverb ("EAX") effects like firing a shotgun in a sewerpipe or underwater. But there is more than that. Managing the many sound resources in the limited memory is a challenge. And how about 'true' 3D sound? Did you ever notice the noise dims when you close a door?

As you may have noticed, most parts of the game will be indoor. Meaning there will be a lot of occlusion by walls, doors, and thick ceilings. Basic 3D roll-off calculations like OpenAL offer are not enough to get a realistic soundbyte. It matters a whole lot if you shout in the open-air or inside a closed complex. Not only for you as a listener; also enemies who use their ears to detect threats.

I'm pretty sure OpenAL can be tweaked to do this kind of stuff, but I also had a look at FMOD this week, another Sound API used in commercial games, including Crysis. Commercial usage requires a license, but you can still download the full thing, including a handy tool called "Designer". So far I always had to create my own editor for defining sounds, properties, channels and so on. Possibly that was a waste of time, because Designer offers a nice toolset and testing environment to create a sound library.

Besides that, FMOD has functions to setup a 3D world-mesh to do the occlusion I discussed earlier. Too bad it doesn't have functions to test if AI enemies can hear you as well at a certain position, so I still have to figure something out. We don't want the enemies to cheat by hearing your squeezy farts through a 6 meter concrete wall of course. But nevertheless, I'm impressed by FMOD. In fact, I'm creating a wrapper DLL right now. Time to finish, I hear cigar coughs...

No comments:

Post a Comment