Hey!
For about two weeks I've been working on the improved world generation coming in 0.1.0.
Here's a screenshot:
How did I do it?
I am using 2D perlin noise to generate terrain in my game.
Previously, the following formula was used to generate:
height = (main height * 32 + additional height * 24).
I started looking for a way to improve the generation.
An idea appeared - to use the generation formula from old minecraft versions:
height = (main height + (roughness * details)) * 64 + 64.
It didn't work as expected.
I decided to temporarily remove the roughness and details and try to work on the main shape.
As a result, I deduced the necessary parameters for generating mountains from the plateau above.
Next, to make the plateau look less empty, I decided to add some roughness. Its role was played by the perlin noise function with other values.
As a result, we got the following formula:
height = ((min (0.9, (main height + 0.4) ^ 3)) ^ 2 + roughness / 2) * 64 + 48.
Or more simply:
height = (main height + roughness) * 64 + 48.
Then I decided that the landscape only looked dull from the mountains.
I added different types of terrain: mountainous and flat.
The result is the following formula (simplified notation):
height = ((main height + roughness) * 64 + 48) * (1-terrain coefficient) + (roughness * 64 + 48) * terrain coefficient.
What is the terrain coefficient in the above formula? This is another function of perlin noise.
Thus, landscapes appear in the game as in the picture.