So I want to make a race game in 3D. I know my limitations; without the proper experience I’m not going to be able to create a full 3D racetrack with fancy graphics. So I’m going to generate the track geometry much like a slotcar racetrack.
I haven’t made a 3D racer before, but I did create a 2D (pseudo3D) race game. With some thought these principles can translate to 3D. It may be quite different from the way modern racers are made, so let’s see where this is headed.
As in the 2D racer, each track will be built up using segments. Each segment will have some properties to it: is it a curve? if yes, how sharp is the turn? Does it have kerbstones? What is the width? And so on. This can be expanded later with more properties.
Stringing theses sections together will create a track. The cars on the track will have knowledge of the section they’re on and the sections ahead of them. So internally the cars only work with these sections and not actually interact with the 3D model at all! The model of the track is just to display the game’s internal state.
Once the list of the sections is known, a 3D model of the track can be generated.