Sunday, July 29, 2007

Sound Woes

Sound problems in TGB (Torque Game Builder).

I'm using GarageGames TGB engine because it is amazingly fast to get something up and running quickly. It's easy to find some roadblocks along the way though when using the 'C'-like scripting engine "torque script". Luckily it ships with the source so you can change the shortcomings as they arise.

TGB uses openAL for sound. My latest problem is that they didn't expose alot of the functions that are available with openAL to the scripting engine. For instance, there is no function to change the sound pitch, modulation, or reference a point in time for a sound. I want to make the engine sound like it's working harder as you drive it. Something you would immediately notice if it wasn't done right. I figured I could do this two ways:

a) change the pitch of a sound as the car goes faster.
b) use a long sound bite of the car shifting through the gears, and referencing a point in the sound clip relative to the current speed of the car.

Option B is probably the most realistic, and simple way to accomplish the basic car sound. The problem is that getting torque script to use this functionality in openAL means I will have to do some engine hacking. This isn't a terrible problem, but getting MsDev up and running and working out all the dependancy problems is a bear. I've done it a few times now and am avoiding it. I'll probably move onto some of the more pressing gameplay issues before coming back to this sound. Currently I am just using a crappy engine loop and stopping it once I let off the gas.

No comments: