Shedletsky's

So Real Surreal Boogy Buggy

Realistic Physics - Rev up the buggy, slam it into a mountain, and watch it bounce off! Just don't flip over...

Demo now leaking megabytes of RAM on your machine

 

A while ago I was wandering aimlessly across the net and I wound up at http://www.q12.org/ode - the website of the an open source physics engine ODE. One of the demos that comes with ODE was a little simulation that let you drive a buggy off a ramp. I thought it that was pretty cool - I had never seen a demo before that used real physics - it's a feature that is only recently making it into mainstream consumer games. Since it was a simple demo, all you could do was drive the car off the ramp, and, if it didn't flip over, go back, and drive off the ramp again. Driving the buggy was fun - like having a remote control car that would never break no matter what you threw at it - but there was just the one ramp. I decided that I would make a game that would randomly generate a world that was infinite in all directions with all kinds of obstacles to drive a little buggy around, in, and over. Then I started thinking that no - a single player game like that could get dull fast, like a flight simulator - I should make some kind of multiplayer network game that involved driving buggies around. The premise of the game would be to race against other players in a smallish playing field, trying to collect little purple spheres and boxes, and return them to a central location. Gameplay would be helped by giving all the players mounted nerf cannons on their vehicles so that they could go around shooting each other. But then college started up again and all my free time sublimated.

So I decided (as I'm on an airplace, flying back to Stanford) that what I had already was good enough to put online in hopes that someone else will either find my code either useful (there are very very few demos of realistic game physics online) or inspirational. In it's current state, the demo allows you to steer a buggy around over a randomly generated "landscape" (I use the word loosely), while spheres and boxes fall from the sky and bounce across the ground. There's some basic camera control keys, but nothing fancy. OpenGL is used to do the 3D graphics, but everything is kept simple graphically. All in all the buggy and the ground together look very CGA (Ah, remember the glorious red, green and brown palette? Or the white, cyan, and magenta? Who chose those colors anyway?!).

One interesting thing that the demo does is try to lock the frames per second to around 60 - if your computer is too slow to handle this, the performance of the demo will be degraded, but if you're running on a fast computer with a 3D card (I'm only on a GeForce4Go 440 and it works great) the demo will use your extra CPU power to provide a more realistic physics simulation by raising the Physics Iterations Per Frame number - computing the physics at a higher resolution. This is why you may notice that the FPS can start out really high - maybe around 130 - and then falls to 60 in the first couple of seconds the program is run. As more objects fall from the sky and the scene becomes more complex, you may see that the physics resolution goes down a bit.

Both the demo source and executeable and included in the following download, as well as the MSCV++ 6.0 project file for it, and a compiled copy of the ODE lib that you will need if you want to change the source at all (it can be a pain to build the ODE lib from scratch - for ODE information go to http://www.q12.org/ode). Read the readme.txt file included in the distribution for the key controls. Thanks go out to NeHe (http://nehe.gamedev.net) for his Windows basecode.

DOWNLOAD: So Real Surreal Boogy Buggy Source Code and Executable

 

This buggy driver stares death in the face and goes flying through the air!

 

Watch out for falling purple spheres and boxes. Surreal. Where's the flounder?

Back to the Nexus

Back to Shedletsky's Code Library