Generating a track for a racing game
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?
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.
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.
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).
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).
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement