World generation has been a passion of mine for a long time, and especially realistic world generation. I thought I'd share some of my progress on a game that I have been working on lately.
I start with a customised Perlin noise generator to produce a fractal landscape. Eight octaves with another perlin noise (4 octaves) produced layer of soil on top:
Seeing as this looks very noisy, I apply a soil erosion algorithm producing the following image:
Note the rocky outcroppings becoming more accentuated and the basins forming in the flatter areas. Finally I apply contours and the reason for this is that realistic surface water generation is trickier than you would think. I've been through about four algorithms and perhaps I'm just an idiot but some algorithms just fail on certain edge cases and tend to flood the world. With realistic surface water I mean a source in high elevations that create a river. If this flows into a contained basin, a lake must form, if that fills the basin, it needs to overflow into another river and so forth. With contours, this process is simplified and optimised. A contour has a contour above it which can either be open or closed (touches the edge of the map) if the contour is open, you don't need to go higher, as it overflows off the edge of the map. If it is closed however, you can check how many "child contours" it has. If it has more than one, you have to generate a river from the one contour to another as it "overflows" into an adjacent contour. This can continue until either a river flows off the edge of the map or a lake is formed on the edge of the map. The contour map as generated is displayed below. Some of the "squareness" in the basins is due to the soil erosion algorithm based on the grid structure. The contour image is not of the same images as the first two btw.
Time to generate on 2.2GHz Intel Core i7:
Perlin: 2-3s
Erosion: 700ms or so
Contours: 200ms or so
World size: 512 x 512
All of this is written in Java as a proof of concept.. will most likely be a lot faster in C/C++