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.

Wednesday, July 18, 2007

waypoint Arrow for off screen destinations
















I created a "streachy arrow" to point to the next waypoint so the driver can find his way around a foreign place to his destination. Took some fenagling, and the usual trig + vector math, but nothing to harry. I used some functions from my other game in development "Red Shift" to help this along. It's nice to borrow from your other projects.. makes things go faster sometimes.



example of the angle function:

function calculateAngle(%source,%target)
{
// get the desired angle required to point at the target
%vec = t2dVectorSub(%source, %target);

%angle = -mRadToDeg(mATan(getWord(%vec,0),getWord(%vec,1))); return %angle;
}

setting the position, and vector length etc, for the destination vector.

function updateDestinationArrow(){
%tmp = $pCar.getPosition();

%tmp1 = $waypoint[$currentTarget.parkOrder+1].getPosition();
%angleVector=calculateAngle(%tmp,%tmp1);
%angleAdd=t2dVectorDistance(%tmp1,%tmp);
%angleAdd*=2; //double the lengh since I'm using a half image

$destinationArrow.setRotation(%angleVector-90);
$destinationArrow.setWidth(%angleAdd);
$destinationArrow.setPosition($pCar.getPosition());
}

Friday, July 6, 2007

Waypoint System




I have a waypoint system set up for creating the levels objectives. Currently you can just copy and existing waypoint, and move it somewhere.
Give it an angle to represent the direction that you want the player to park, the order it should be processed in relation to the other waypoints, and how long the player has to reach it.

zoom example
















Here is a picture of the car driving faster. The camera is pulled back so you can see further, hopefully giving you more advanced notice of objects that you might be barreling towards.

new art, zoom


I've been dinking away at the game with my limited art skills. Building a block system for the editor. Basically I have a basic block with grass on it, and I'm creating different surfaces and buildigs to put on the blocks.

I added a zoom, that pulls the camera back a bit as you drive faster, and zooms in more for precision parking. Starting to look ok. Adding shadows to the objects helps make the objects fit in the world better. Wow, it always surprises me how long it takes to build art resources for games.