Things i've made

Looking for more? See a list of everything i've made.

Thursday, May 26, 2011

Stunts Remake

Have you ever played Stunts, aka 4D Sports Driving ? Well, if you haven't, let me tell you, its an old racing game where you could design your own tracks from a set of race track tiles, and race on them against the clock or one of the computer AI racers, complete with far-out personality. There is also a replay feature which allows you to save your best (or worst) races so you can show them to your friends.

To me, Stunts is a high point in racing games. It had everything else other racing games had at its time, plus the track builder. This makes the lifespan of the game longer than any other. There have been other racing games to come out with track builders, but the tracks you could build in stunts always seemed exciting whereas other games just ended up giving you a lot of freedom to make boring tracks.

Anyway, I liked this game so much that I decided it needed a remake. When I started I wasn't aware that there was already an open source remake in progress, know as ultimate stunts. Had I actually looked to see if there was a remake, I may have ended up just contributing to that instead of creating my own.
The loop is easily drivable with some practice
M remake consisted of a few logical parts put together to cover the functionality of the original game. There is a track editor, a racing simulation, a replay viewer, and a game state management interface. Deciding that supporting the original trace format gave easy access to hundreds of ready-made tracks. Actually implementing the support, while upgrading the graphics presented a few challenges. The original track format allowed you to put water sections in your tracks. These water sections rendered at flat blue sections on the track. When I upgraded the water section to true 3D tiles that have gradually deeper water, the edging of the water tiles' underwater sections made the total number of water tiles jump from nine to twenty seven. Equally as important, I had to convert to and from this new "edged" terrain format so that the saved files still matched the original track format but looked perfect in-game. 

Early development shot showing some track elements

The actual graphical improvement I provided came mostly from the use of modern rendering techniques while the geometry remained mostly the same to preserve the original feel of the tracks. Each track piece was constructed using a set of geometry construction functions which allowed for a very concise description and mathematically perfect representation. I had experimented with using modeling packages but found it difficult to keep the geometry numerically perfect, which ultimately resulted in a rough driving experience. Non-road segments show this history with scenery imported from 3d studio max.

I spent some time applying some important techniques I had learnt in my PHD to give a greater feel for the speed you are traveling at. Imagine that this game had no textures on the road, no grass texture, and few scenery objects. Under these circumstances it would be difficult to tell how fast you were going on a straight stretch of road. This was not the case in the original stunts since, even though there was no texturing, the broken white line on the road gave you a good sense of speed. Adding textures improves this but even more, adding grass on the side of the road seems to give an even better experience of speed.  As simple as it may seem, it made a huge difference. You will often see space or undersea game use space junk, dust, seaweed, anything that can fly at you just to make it feel like you are moving. Anyone remember NOX ?

Time of day is customizable going through a whole 24 hour cycle 
An interesting challenge I encountered while implementing the racing simulation was to determine when someone had taken an illegal short-cut. To solve this problem i wrote a simple recursive track tracer. I implemented it in such a way that you could either run the tracer in exploration mode, for the track editor, and find any issues with the track such as broken track, dead ends, junctions that put you going the wrong direction on the track. Another mode was a guided mode where the tracing was guided by external interaction, or in this case, driving the car round the track. If any unexpected detours were taken, a penalty time could be asses based on the shortest track path skipped, and wrong driving direction could be detected. Using the same tracer for two purposes allowed me to focus on correctness and handle a large number of exceptional cases, as is the way when you can design you own track that can have turn offs, jumps over roads or obstacles, even cycles in the track.

Debugging view of some more hairy track sections showing polygon edges and normals
 The graphical sections of the game were programmed to use OpenGL. Using OpenGL gave the benefit that the game could be run on Windows, Linux, and OSX with no differences in the rendering code. I teamed this with SDL and basically had a code base with no ifdefs or files for separate platforms, achieving identical functionality. Being somewhat of a computer graphics person, I spent some considerable effort ensuring the rendering achieved high performance. Even though the geometry is simple, a naive implementation could be outperformed one hundred times or more by an optimized implementation. The end result is over 100 frames per second at high resolution on a GeForce 2MX and processor from same era.
Car taking a corner
The physics of the original game were quite basic yet very fun and predictable to race. I achieved a similar feel with a more modern twist by use the Open Dynamics Engine. With some fine tuning I was able to get a car that could fly through the air, land without bouncing off the ground, and still have an accurate feel when cornering and transitioning between traction and losing traction.

Availability and Ownership
The source code for this project is entirely owned by myself and unreleased. The project is mostly complete, just with some polishing to do. I abruptly stopped working on this project when I had other projects start to make an income and was well aware that deriving any income from this project with some major diversion away from the original game would be immoral and possibly illegal.

If you are interested in the project, feel free to contact me directly with you queries.


  1. I was wondering when there will be a playable version of this? Will you only release it when it's finished, or will you also publish an early alpha or beta?

    I'm a big fan of the original Stunts. I still play it now and then. I hope this stays compatible with the original .TRK files.

    Are you trying to get the handling as close to the original as possible, or are you going for a better handling?

  2. Hi Toon,

    I hadn't thought about releasing this remake for quite some time but since i've posted a teaser on this blog I have had quite a few questions about when it will come out. If enough people are interested i'll devote some time to it.

    I love stunts as well! This remake uses the .TRK file format as its native format, so yes, that means all existing tracks work without any sort of conversion or what not. It also means that any tracks designed with the remake's editor can be used in the original stunts.

    The handling is a little different but I have tried to keep the same fun spirit with predictable driving that gives you confidence to take on dangerous stunts at high speed.

  3. Sounds very promising! I'm looking forward to it.

    By the way; I recently found a stunts forum with likeminded people. If you want more feedback, you can always go to

  4. This seems to be the best remake I’ve seen so far. We’re also working on one, although it’s more like a tech demo for our 3D engine than a full game, but this might change in the future. There’s a Youtube video for the lazy ones.

    We chose to use not just the tracks but also the models from the original game, and intend to spice it up with better lighting and post-processing effects instead of textures.

  5. Hi Patai,

    Nice looking remake you have there!

    Using the original models gives you a very authentic look.

    I had considered adding shadows to spice up this remake since it should look good ans help make the environment look more 3D but decided that the rest of the game should work before I add them. I would be interested to see how your remake looks after its spiced up.

  6. We are currently reworking the engine, because adding some of these advanced effects would require ugly hacks in the current setup. If all goes well, the demo will be upgraded around the end of the summer, and I’ll upload a new video then.

  7. hello friend how are you greetings from Colombia congratulations on the great work I can not wait to enjoy this whole is better than any remake has no comparison made ​​with the ultimate stunts that has many errors. however yours appears to be very promising, please write me friend when you finish ami mail please let me download it and I look forward to playing this great game.

  8. Hello.
    Is the open source playable? If so, do you think you can send it to me in a private message?
    Thank you.
    Keep up the good work, this looks fantastic. ♥


Note: Only a member of this blog may post a comment.