Friday, September 08, 2006

Overview II

I decided on a few things for this project.

First, I don't want to load info from a bitmap. Constructing the bitmaps is an extra step and to modify the data requires loading all that information into an array. Instead I'll come up with a way to generate random heights depending on some user variables.

The way it could be is if the user chooses how many rivers, flat areas, bodies of water, etc. there are, and then describing how mountainous or flat the area will be, how many mountainous areas there are, etc. Basically the algorithm will select certain squares and assign definitions to them, such as a square containing river, or lake, or mountain. Then the heightmap can be generated based on what the map says should be there. Later, these same variables will be used to employ texture mapping.

The controls for generating the map will be slider bars which is going to be cannibalized from code from MiniCAD.

No picture. Sorry. But it seems my work is cut out for me.

Wednesday, August 23, 2006

Terramancer Begins


Hello,

This is the second project geared for game design. The first one, MiniCAD, is nearly complete, having just a few bugs to smooth out. Since I'm able to construct models with it, I'm happy, and won't worry about fixing everything until later.

This is Project Terramancer, and it is for generating a "heightmap", or terrain for a 3d game.

The basis is fairly simple. There is already an ability to generate a heightmap from a square bitmap as follows:

1. A square bitmap is created using a piece of software like Terragen. This makes what appears to be a grayscale aerial view of the desired landscape.

2. A program is run against the bitmap and creates polygons using the alpha channel of each pixel of the bitmap. The closer a particular pixel is to the color white, the higher up from the ground that point is. For Terramancer, I opted for quads to better facilitate texturing.

3. The data generated is stored either in main memory or in the video card's memory.

The result is a grid of squares, where every intersection point contains a height value. It looks pretty neat.

For now, it can show a wire mesh of points that are color-coded according to their height. Red is high terrain, yellow is mid level and green is flat ground. Since I chose to load the data in main memory, a speed optimization has been included in that only squares currently visible are to be drawn.

This project will be a standalone one, since the common thread for all 3d games I'd make will probably need this terrain mesh. Level editing and scripting will be taken care of as needed for each game.

So uh... I'm practically done. All that's left is putting in the ability to change the landscape via mouse click and to generate the normals for each quad.