For those of you who expressed interest in the source for the terrain project, I am making it available for download. Some people suggested I release it under the GPL, but I’m not going to do anything that formal. I’m releasing it under the “as is” system, where you take it, study it, use it, and see what you can do with it. I do request that if you make use of it you give credit. It’s your conscience, though.
The project is a Microsoft Visual Studio 6.0 project. I tried to keep the windows-centric code all in one place to make it easier to port to other platforms, although I’ve never tried to port anything so I don’t make any claim as to how easy it would be.
I know at the very beginning I said this was all new code from scratch, but there are actually a number of helper modules I wrote some time ago that I need to mention. The gl* files (glVector.cpp, glMatrix, glBbox, etc) has code that I use in ALL my OpenGL projects. It has stuff for calculating dot products, reflection vectors, manipulating rgba color values, adding vectors together, interpolating values, and a bunch of other stuff that you just need when working with OpenGL. I’m pretty fond of this code. In a lot of ways I think these are worth a lot more than the terrain engine itself. This stuff is just key, and every programmer should have these tools on his or her bat-belt. I could have taken all of these and moved them into a seperate static library, I suppose. That might be a good move if you plan on working with the code for any length of time.
In regards to the rest of the code, I’ve tried to add comments and explain things as well as I could. If you have questions please post them in the comments on this post so I can avoid answering the same questions multiple times.
Also, I’ve included all of the textures I used in the project, but I should warn you that I got the textures via Google Image Search, so I don’t know who owns them. I didn’t even look. You ought to replace them if you plan to release the results of your work for the world to see.
For further reading, here are several Publications by Peter Lindstrom, who (as far as I can tell) is the one who came up with the triangulation technique I allude to in Terrain Part 2 . The one I read is the third from the top, “Terrain Simplification Simplified”. If you read the article (beware, it can be a bit heavy) you’ll see a lot of it focuses on terrain which is optimized every frame. This is different from my system, where I spend many frames on a single set of terrain polygons. Both systems have their merits. Mine is easier on the CPU, but is less than ideal if you plan to jump from one area of the terrain to another very quickly. Also, here is NeHe OpenGL, which is a great site that teaches OpenGL by example, with lots of tutorials and miles of source code.
And just to show that lots of people are into this sort of thing, here are some other more ambitious terrain projects:
(Hat tip: This MeFi thread)
Good luck. I hope it’s useful to you.
Bethesda felt the need to jam a morality system into Fallout 3, and they blew it. Good and evil make no sense and the moral compass points sideways.
A video discussing Megatexture technology. Why we needed it, what it was supposed to do, and why it maybe didn't totally work.
id Software Coding Style
When the source code for Doom 3 was released, we got a look at some of the style conventions used by the developers. Here I analyze this style and explain what it all means.
The story of me. If you're looking for a picture of what it was like growing up in the seventies, then this is for you.
Starcraft: Bot Fight
Let's do some scripting to make the Starcraft AI fight itself, and see how smart it is. Or isn't.