Page 1 of 1

Procedural terrain generation

Posted: Sun Apr 24, 2005 8:38 am
by zarthrag
I'm looking to build maps for PLSM2 in the "laziest" way possible (i.e. procedurally). I plan to use some sort for fractal terrain generation for each page, which is then brushed/stitched together to the adjecent pages - or something like that.

The idea is to create an expansive, high-resolution set of heightmaps based off of lower detail ones. The "main"/high-level image should be RGB, with varying combinations of color indicating the *type* of terrain in that page. (Steppe, Desert, Plains, Forest, Mountains, Hills, etc.) The alpha value determines the overall/average altitude of that page/area. (To allow for oceans and such.)

The game this is being used for is somewhat of a (but not really) a flight-simulator. I hope to be using the listener to add-in (VERY large) cities/buildings.

My question is: Are there already implementations of terrain generators that can produce generic terrain heightmaps using just a few variables as a guide? (I plan to pre-process every bit of data that I possibly can. Including PVS.) I've seen lots of "by hand" editors, and those are great. But I need an entire planet's worth of heightmaps! Are there tutorials on how to manipulate reams of heightfield data?

Posted: Sun Apr 24, 2005 10:17 am
by tuan kuranes
Look at libnoise (link in assembling a toolset wiki).
they even have a sample of how to generate a planet.

Posted: Sun Apr 24, 2005 12:22 pm
by Azatoth
The Mercator lib in the Worldforge project does this. You define "basepoints" (heighvalues) at an set interval (64 units), and then a heightmap is generated. There are also shaders available, which can generate cover maps for grass,snow etc.

Re: Procedural terrain generation

Posted: Sun Apr 24, 2005 1:03 pm
by Lucky_Luciano
zarthrag wrote:(I plan to pre-process every bit of data that I possibly can. Including PVS.)
Just as a side note: if you are going to use your terrain in a flight simulator there isn't much use in calculating the PVS. When high above the terrain nothing will get culled anyway...
PVS is only helpfull when the player walks on a rocky terrrain where the view gets obscured by many mountains/valleys.

Posted: Sun Apr 24, 2005 6:28 pm
by zarthrag
More accurately, it's a "multi-vehicle" sim. There are many mech-equivalents as well as flying things, and most of the player's flying is in close proximity to the ground/buildings. Some river-valleys are supposed to be present too. The story takes place across an entire (but not quite to scale) planet, with combat over every inch of it.

I just looked at the mercator lib right now, it's pretty close to what I need, but I can't tell if it allows varied terrain types right off the bat. It does the basics, but not quite enough.

I checked out libnoise, that's an *excellent* suggestion. By building modules to generate each selected terrain type, it's easy to build a selector that will smoothly toggle between terrain types based on the data for that sector. Writing a command-line app to preprocess maps and compress them in batches should be a snap. Additionally, A billion other things can be done with this, thanks!