Sign in to follow this  
Opwiz

Generating a track for a racing game

Recommended Posts

I want to be able to randomly generate a stripe-like track that runs through a 3d environment. The stripe is to bend and twist and joined together in both ends. Something like this: The racing car is to run on the track and it only moves in the direction along the track. Any ideas on how to do this?

Share this post


Link to post
Share on other sites
Quote:
Original post by Ivo Leitao
On Benjamin Nitschke book (Professional XNA Game Programming: For Xbox 360 and Windows) you have a very good example on how to fow it. You can grab the source here: http://creators.xna.com/


Thanks alot.

Share this post


Link to post
Share on other sites
The XNA Racing Game Starter Kit uses Catmull-Rom Splines to represent the track. Info about the technique is available here. When the track is generated a normal and direction vector is calculated for each point. The normal can be tweaked to make the track twist and bend.

Share this post


Link to post
Share on other sites
You could use a parametric representation, with a single parameter t giving a 3D closed curve plus the orientation of the track normal (only one additional degree of freedom) and possibly the width of the track.
It would be easy to randomize (self-intersections can be ignored and you only need to worry about excessive curvature) and easy to draw (just build triangle strips or the like from evaluations for increasing and decreasing t around the camera target, stopping when the next slice of geometry is out of view).

Share this post


Link to post
Share on other sites
Quote:
Original post by LorenzoGatti
You could use a parametric representation, with a single parameter t giving a 3D closed curve plus the orientation of the track normal (only one additional degree of freedom) and possibly the width of the track.
It would be easy to randomize (self-intersections can be ignored and you only need to worry about excessive curvature) and easy to draw (just build triangle strips or the like from evaluations for increasing and decreasing t around the camera target, stopping when the next slice of geometry is out of view).


Sounds interesting. Not sure how to generate a parametric representation for a track though.

Share this post


Link to post
Share on other sites
Couldn't you just write a tile map maker and have it randomly place tiles. each tile being a piece of the track. of course you would have to add functions and variables to make sure there are no dead ends and everything fits together right. If you want email me at moha82@juno.com and ill send you a pretty easy to understand tile map generator i made a while back.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this