I am attempting to create a new Game in which a vehicle drives along the ground, but also has the capability to use thrusters to become temporarily airborne.
I am relatively new to game programming, but I am rather good at coding in Java, C, C++ etc., so I do not think that should be an issue (thought the first iteration of the game is in Java). My problem is that I am starting from scratch, and can not think of a way for the terrain to be a barrier so the vehicles do not fall right through it. And how can I have them possibly take fall damage?
In the past people have directed me to the Replica Island source since it has this already in it, and I see the whole Collision System, but so far I have not been able to make sense of it and I was hoping somebody would be willing to lend me a hand.
Thank you
-Roflha
What are you using to develop the game? An engine or a graphics library? There are basically three levels (as I like to think about them): graphics libraries, graphics engines, and game engines.
Graphics libraries are pretty much as low level as you can get: OpenGL or DirectX. When you want to draw out your terrain, you will be drawing as a mesh of triangles, and defining the vertices of those triangles, etc.
Graphics engines are one layer on top of that. Examples of those (for C++ at least) are Ogre3D, Horde3D, and Irrlicht. They will take care of a lot of the lower level commands, and let you focus on graphics from more of a higher level standpoint.
Game engines will pretty much take care of anything graphics related. Examples of these (again C++) are Unity and UDK. They can generally do a lot of the game programming for you. You would probably draw your terrain in a modeling program (3dsmax, etc), export it to some format, then the engine will slurp it up and know exactly how to handle it.
I have played with all three, and find the graphics libraries most interesting. However, they'll probably take the longest to make a game. They also involve a lot more math (linear algebra).
As far as collision detection with a terrain. You have to know about the triangles that compose that terrain. If you are using a game engine, you should be able to store the mesh for your terrain and the mesh for your character in some sort of "Scene Node", and it will handle collision detection automagically. However, if you are dealing with everything yourself, there are many popular algorithms to do this:
An excellent article on bounding sphere collision detection
I've written a sample OpenGL program that basically lets a character, which is represented by a bounding box, walk around a terrain, which requires collision detection. Let me know if you're more interested in how it works.
You can handle the fall damage several ways: