Generating a track for a racing game

Started by
5 comments, last by Life unlived 16 years, 1 month ago
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?

www.marklightforunity.com | MarkLight: Markup Extension Framework for Unity

Advertisement
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/
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.

www.marklightforunity.com | MarkLight: Markup Extension Framework for Unity

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.

www.marklightforunity.com | MarkLight: Markup Extension Framework for Unity

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).

Omae Wa Mou Shindeiru

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.

www.marklightforunity.com | MarkLight: Markup Extension Framework for Unity

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.
"But I don't want to go among mad people," Alice remarked. "Oh, you can't help that," said the Cat: "We're all mad here. I'm mad. You're mad." "How do you know I'm mad?" said Alice. "You must be," said the Cat, "otherwise you wouldn't have come here."

This topic is closed to new replies.

Advertisement