I am building a racing game in OpenGL using Glut, and I’m a bit lost in the details. First of all, any suggestions or a road map would be more than great.
So far what I am thinking is this:
- Tree implementation for transformations.
- Simulated dynamics.(*)
- Octree implementation for collision detection.
- Actual collision detection.(*)
- Modelling in Maya and export them as .OBJs.
- Polishing the game with GLSL or something like that for graphics quality.
(*): I am not sure the order of these two.
So I started with the simulated dynamics without a tree implementation, and it turned out to be a huge chaos for me. Is there any way you can think of something that could help me to build such a tree to use in racing game?
I thought of something like this but I have no idea how to implement it.

Reds are static, yellows are dynamic nodes
I would suggest the exact opposite of @bezad.
Start with a single car and an infinite road.
Split the problem of rendering and dynamics into two completely different things. The common
Carupdates and/or is the link between theCarRenderModeland theCarPhysicsModel.What shapes the
Carputs into the GL scene is up to theCar.Among other things, this means you can have a really simple
Carshow up on screen, and attach a really simple physics model to it, and either make theCarprettier or make it behave physically better without having to tie the two together. And, ideally, at each stage you have something playable.So, a car that is a rectangle, 5 long 3 wide and 1 unit high. A road that is 13 units wide, and goes on forever. A stationary camera. Maybe a horizon. The first physics model is a rocket ship, where every second you push down on an arrow key the car gains x units/second of velocity in that direction. Note that this car doesn’t rotate — it is axis aligned. If the car leaves the road, it explodes, and the “game” ends.
You now have something on the screen that responds to user input. You could spend time making a fancier car model (wheels, etc), or you could improve the car physics and control model (direction! Angle! Breaking != speeding up!), or you could make the environment more interesting (add black-and-white stripes so you can see velocity at the edge of the road. An off-road portion near the road, and maybe trees that blow up the car), or you could make the camera more interesting (say, it stays behind the car, and looks over its shoulder).
Now, for dynamics, I’d treat universe-car interaction using distinct code from car-car interaction, just to keep my sanity intact. The car doesn’t get to modify the environment.
This means you can write a bunch of the car-universe interaction easier than you can the car-car interaction.
…
Building an arbitrary tree in C++ is easy.
the above is pretty rough (I didn’t get end-node handling quite right in the printer, for example), but it demonstrates a non-homogenious, non-leaking, n-ary tree structure in C++.