Archived

This topic is now archived and is closed to further replies.

Random Terrain Generation Algorithm

This topic is 5330 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

you are in ogl forum here.
Post this in the mathematic or game programing forum.
You will get more chances to get a better answer.

(sorry about my english):
Me personnaly, for terrain generation, I use heightmap.. But its not random.
I have never done a "random" terrain, but If I make one, I sould make it like that :

Supose you got a map 1000x1000.
At each 100x100 square, specefi a random for the height.
.. ground to the higher ..
So you have 100 cells, each cell 100x100
after that, generate smooth transition between these cells
What I mean is between the first cell and the second, you have 100 little cells, so compute a curve.

At now, you got a big terrain, but with No detail. So, take your 100x100 cells, and divide it by 10. You got now 10x10 cells. Do the same thing, but dont generate random from ground to the higher. You already have a height at this cells, so just generate a random 10 or 100 unit around it, depend of your unit.
Example: take a 10x10 cell, and check his height. We have for example a height of 200.
So the random result at this point will be 200+-10, 190 to 210
And after that, generate a curve between each cell of 10x10.
So now you got a general terran nivelation, and you got detail on it to make it look cool. After you can make the same thing with the 1x1 cells. If you want robust terrain.

[edited by - daivuk on May 8, 2003 6:35:34 AM]

[edited by - daivuk on May 8, 2003 6:35:55 AM]

Share this post


Link to post
Share on other sites
Ok, it work perfectly. I have just tested it.

So if you dont understand what I said, just send me e-mail, I will explain more easily trought e-mail with screen shot examples.

Share this post


Link to post
Share on other sites
use some kind of noise.

u could use random noise and smooth it
or perlin noise (which is much better)
or Ridged Fractal Browmian noise which is the coolest (it uses perlin noise as well)

there is much stuff about this on the net

Share this post


Link to post
Share on other sites
Here is my code I use in my engine to generate perlin noise for heightmapping: http://studentweb.nait.ab.ca/cst1766/MiscCode/PerlinNoise.h

Here's some eye candy to what the final output is like =)

http://studentweb.nait.ab.ca/cst1766/Exodus/Screenshots/Screenshot21.jpg

Here is an older version of my heightmapped landscape using the perlin noise output, without multitexturing, lighting, or blending effects. Still looks pretty nice though

http://studentweb.nait.ab.ca/cst1766/Exodus/Screenshots/Screenshot6.jpg

Hope that helps you out

~Graham

[edited by - gwihlidal on May 10, 2003 5:33:29 AM]

Share this post


Link to post
Share on other sites