Monday, October 12, 2009 at 3:30 PM |  
Over the week I've been working on a very important feature; Track system. The need for this system was due to requirements of a racing game. In a racing title, we need to know if our player craft is inside or outside of the track. We also need to know how to respawn back into the track. Last but not least, we need to have a way to know if a player has finished a lap.

Thus the track system come into place. With a way to define tracks, all of these will be possible. What's even cooler is the ability to give a good estimate of how long a track level is. :)

However, the problem lies in defining the track. Because it's impossible to do it outside by text file, we need an editor to lay our tracks. This turned out to be quite a pain in the ass to implement. In fact it's more complex than prefab placement since we need to link tracks together to form a track chain.

Anyways, I've finally got a usable editor tool in our world editor.

Here's a screen shot of this WIP track edit mode:

Ignore the lighting. The main point is the track. Obviously lighting is just default crap since I created a new level just to test this in a quick manner.

P.S. For those who are wondering, I'm using cubic bezier curves for each path segment. Thanks to my bro, we've got quite an advanced bezier curve functions like getting arc length, finding closest point on path and splitting a set of points evenly along the path. Trust me it's no easy feat. Requires lots of integration maths and Newtonian Interpolation. That plus our rusty math, this took us almost two days to figure out. :P
Posted by Lf3T-Hn4D

3 comments:

Prometheus said...

Excellent work man ! 2 thumbs and 2 toes up !

October 12, 2009 at 4:56 PM  
Xavier said...

Make sure there are no seams in these zones.
You wouldn't want someone boosting through one and shortcutting a huge part of the track.

However: allow some shortcuts for the eventually skilled players to accomplish. Try to find a just middle between the two. ;)

October 12, 2009 at 7:32 PM  
Lf3T-Hn4D said...

No worries there :) Once a craft flies out of the track for more than a given number of seconds, it will be forced to respawn back into the last known position on the track. So there's not much room for cheats.

Besides, it's actually very hard to get back on track once you fly yourself out. So it'll be a skilled feat or pure luck if you managed to accomplish it. :P

October 13, 2009 at 2:57 AM  

Post a Comment

Liquid Rock Games and Project Aftershock. All Rights Reserved.