Random Terrain Generator
This creates a random heightfield using the fault algorithm.
benjamin lee
(benjamin)
This creates a random heightfield with the fault algorithm. It takes a somewhat lengthy time to finish increasing a lot with the resolution and number of blocks of the finished file. It saves it as a jpeg file.
The fault algorithm is where the computer makes a random ax+by=c line and everything on one side is raised a certain amount. Everything on the other side is lowered. After around 500 passes it starts to look like terrain. In my implementation I changed it so that things were raised or lowered based on the arctangent of their distance from the line which makes it look smoother.
Changes
Links
- Home Page
- http://www.pygame.org/
Releases
Random Terrain Generator 1.0 — 12 Mar, 2012
Pygame.org account Comments
-
Rho1 2012-03-21 12:27
Quite nice. Finding proper values to generate something good looking is kinda hard at start, could use some kind of default/example parameters set.
100x100 blocks 1 pixel per block (substituted by 2 in code?), 1000 passes, height variation =2, smoothness =2 give more or less terrainish look, sorta depends on luck thou. -
Benjamin 2012-03-22 03:47
It is substituted by 2 because for some reason I cannot figure out it never displays anything if it is 1. I thought that I should put that in there as a precaution.