Week 2, I am sure you had a good amount of fun trying to kick my chunky behind around. Perhaps it is the typical transition from winter to spring, or simply a manifestation of Murphy's law. I did sort of encourage you to bring it on, didn't I? I really did not mean it like that. Please Fate, be nicer to me from now on, Ok? Do we have a deal?
Yes, I am by nature very dramatic and prone to exaggeration. But it has been a very rough 7 days. The whole family has been sick most of that time. I have a cough and my first chest congestion in at least 10 years, so I could not work out more than 2 or 3 times this week. It did not help that I spent a good few days trolling the internet fruitlessly searching for the right libraries and programs to help me create a little world for my demo. I swear I was not trying to get too fancy for my boots. All that this poor little game programmer wannabe wanted to do was create a little hilly landscape with some grass, perhaps a few trees here and there, some rocks. That does not sound like much, right?
People in the industry like to call this terrain rendering. For the outdoorsy scene that I was planning I needed to somehow create a few virtual acres of land with some nice little hills. It would be hard to manually create three dimensional models of the land and the hills for even the smallest of game worlds, so a few techniques have been developed to create these landscapes with a lot less work. The graphics library that I am using (Ogre3d) can take a grayscale image (that is, an image with no colors, just white, black and shades of gray) and display it as terrain. Light areas become peaks and hills, dark areas become valleys. On top of that I wrote a little code to take additional images and in a similar way use them to represent different attributes of the land (grass, dirt, rocks, etc). In a way, the world is created from the map, and not the usual way around. Computer people are backwards like that. A nice explanation of how these images are used to render the terrain can be found here. And by nice, I mean computer geek friendly, of course.
And finally, the terrain generated from this map looks like this on the screen:
I tried and tried to find a good free program to help me shape the landscape. A lot of people start writing free software, but very few are really inclined to finish them. No surprise there. So you end up with many unfinished, useless almost-programs out there and a lot of people (like me) fooled into trying them and ending up frustrated and screaming. A few spend a little more time on theirs and sell them for very cheap. Some of these just crashed after a few seconds of playing around and none would let me really figure out if they would work for me without paying first. That was a lot of wasted time. In the end, good ol' Photoshop came to the rescue. It's not fancy, but it was enough for now.
Download the demo if you dare try it. If you have done it before, first uninstall the previous version. Finally writing some game related code was fun, in a very geeky way. I needed it. At some point I spent a couple of hours chasing down and fixing a strange problem: If you got too close to the world's edge you would be shot into space and pitch darkness. Quickly after verifying that it was indeed fixed, I realized my big mistake: That little glitch was the only fun part of the demo. Oh well.
Coming up next: trees and plants. And hopefully some nice weather and good health!
No comments:
Post a Comment