Terrain: Source Code

By Shamus Posted Saturday Feb 25, 2006

Filed under: Programming 17 comments

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.

Download Terrain Project (4.3mb)

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:

Chunked LOD
Virtual Terrain Project

(Hat tip: This MeFi thread)

Good luck. I hope it’s useful to you.

 


 

Technorati

By Shamus Posted Friday Feb 24, 2006

Filed under: Rants 4 comments

What the heck? Yesterday one of the “top 100” blogs linked to my terrain project series. I’ve been watching the Technorati listing of this site, curious to see what sort of effect this would have and who would blog about the terrain project. (In 24 hours my rating hasn’t changed. Strange, but whatever.) Then I see this:

So that’s the problem. I haven’t updated my blog since 1970. That explains it. Geeze, you’d think that in the last 36 years someone would have linked me.

I signed up for Technorati so I could see when people linked to me. If someone is trying to start a conversation, it’s helpful if I know about it so I can respond here or in their own comments. If someone links me, I don’t want to ignore them. So far Technorati doesn’t seem to be working as intended. Metafilter linked me yesterday and Technorati didn’t notice. Someone had to tell me in my own comments. Mefi is a big site, how could Technorati miss it? How many other sites am I missing? If they miss MeFi, then lower traffic sites like Kaedrin Weblog, Chizumatic, and Tales of the Rampant Coyote aren’t going to register at all, and they are exactly the sort of sites I’m looking for.

Something like this needs to just work, or its useless. I was really into the idea when I joined, but every time I visit TechRa it has little ads for stuff like “Who are Joe Q. Policy Wonk‘s Favorite Blogs?” There are millions of blogs in the world and the whole thing seems to go out of its way to shine the spotlight on the top couple dozen. That doesn’t do anyone any good. I’m not doing politics here, which means the blogs that interest me are WAY down the list. I need to know who’s reading my stuff, and I don’t care what the popular kids are doing.

Trackbacks are flakey and prone to spam. Technorati is a buggy popularity contest. Is there some other way to know who’s linking you? Since I have my own domain name I can use the site log files, but sites will only show up if they send a noticable ammount of traffic my way. Again, small sites will get lost in the noise, and small sites are going to be the ones that most interest me.

This doesn’t seem like it should be so hard. Is there some tool or site that I’m missing?

 


 

Mindbender

By Shamus Posted Friday Feb 24, 2006

Filed under: Video Games 11 comments

Dust off your old copy of Unreal Tournament and check this out:

Way back in the primordial ooze of 2001, I made an Unreal Tournament level that tries to create an Escher-esque world where the walls and floors are confused. Let’s take a look:


Yes, you can walk on all of the red carpet you see here. You can start on the left side of the screen, run up (or is it down?) those steps, and through the door on the right.


From here, you can run up the steps past the statue in the foreground, then run along and go “up the wall” in the distance, turn around, and go through the door in the “floor”.


Same scene as above, but from a different angle. From this viewpoint, the statue seems to be coming out of the wall.


You get the idea.

You can download the map here. Have fun. If you figure out how this is done just drop a comment.

 


 

Radioactive Goo

By Shamus Posted Friday Feb 24, 2006

Filed under: Pictures 3 comments



Radioactive Goo





Have a nice refreshing glass of radioactive sludge!

This is a glowstick in a glass of flour mixed with hot water. I needed an exposure time of about 4 seconds to the the right glow effect, and to get enough light to pick up the wet tabletop. Despite what Doom has taught us, I’m pretty sure this won’t explode in a destructive fireball if shot.

Anyway, I just wanted to see what it would look like.

 


 

Terrain Feedback

By Shamus Posted Thursday Feb 23, 2006

Filed under: Programming 27 comments

MAKE linked to my terrain project and since then a few people have expressed interest in the code. I’m not sure why this is catching on now. I tried putting the story on digg a few days ago and it was more or less ignored. Go figure.

Anyway, I’ll go over the project and will probably be releasing the code this weekend. If anyone else is interested, just drop a note in the comments. Thanks.

UPDATE 2/25/2006: I have now released the source code.

 


 

You are So Special

By Shamus Posted Thursday Feb 23, 2006

Filed under: Pictures 9 comments



You’re So Special

Originally uploaded by ShamusYoung.



Because I don’t have anything clever to say right now, I’ll just post this picture. I can’t even think of a good caption, so you’ll have to come up with something witty on your own.

Do your best, I’m counting on you.

 


 

BIOSHOCK

By Shamus Posted Wednesday Feb 22, 2006

Filed under: Game Reviews 3 comments

Last weekend I wrote about my enduring affection for System Shock. Now from Mike’s Pensieve I learn that there is a game coming that re-unites the System Shock 2 team to try to recreate the magic of the original games. It isn’t based on System Shock, but it IS based on the ideas behind it. The game is called BIOSHOCK, and isn’t due until sometime in 2007.

They don’t seem to have a website going yet, but the guys over at SSHOCK2.com have gathered a bit of info, or perhaps rumor, about the game. Instead of being set in space, it looks like the game is set in an underwater lab, so it still has the isolation and solitude of the original. It looks like the game has even more open-ended gameplay.

There isn’t much news available, but here is what I could find:

Ken Levine (General Manager at Irrational Games) interview with IGN
The Looking Glass BIOSHOCK fansite
Here is a first-look overview of the game, courtesy of the From the spamming shills at Gamespot
A BIOSHOCK fansite based in the UK. These guys have a heap of screenshots worth seeing.

The game doesn’t even have an official website yet, and I don’t expect we’ll see anything we can sink our teeth into, news-wise, for many months.

It’s going to be a long year. Sigh.