MCTCP / TerrainControl

Minecraft Terrain Generator for SpigotMC and Forge
https://www.spigotmc.org/threads/terraincontrol.37980/
MIT License
231 stars 161 forks source link

Wiki... #472

Closed ghost closed 8 years ago

ghost commented 8 years ago

Hello. You can add one wiki how is calculate height of biomes ?

rutgerkok commented 8 years ago

That is a very complicated formula, spanning thousands of lines of code. It is based on different noise functions, like "Perlin noise" (you can Google that).

An interesting quote from Notch:

In the very earliest version of Minecraft, I used a 2D Perlin noise heightmap to set the shape of the world. Or, rather, I used quite a few of them. One for overall elevation, one for terrain roughness, and one for local detail. For each column of blocks, the height was (elevation + (roughness_detail))_64+64. Both elevation and roughness were smooth, large scale noises, and detail was a more intricate one. This method had the great advantage of being very fast as there’s just 1616(noiseNum) samples per chunk to generate, but the disadvantage of being rather dull. Specifically, there’s no way for this method to generate any overhangs.

So I switched the system over into a similar system based off 3D Perlin noise. Instead of sampling the “ground height”, I treated the noise value as the “density”, where anything lower than 0 would be air, and anything higher than or equal to 0 would be ground. To make sure the bottom layer is solid and the top isn’t, I just add the height (offset by the water level) to the sampled result. Unfortunately, I immediately ran into both performance issues and playability issues. Performance issues because of the huge amount of sampling needed to be done, and playability issues because there were no flat areas or smooth hills. The solution to both problems turned out to be just sampling at a lower resolution (scaled 8x along the horizontals, 4x along the vertical) and doing a linear interpolation. Suddenly, the game had flat areas, smooth hills, and also most single floating blocks were gone.

The exact formula I use is a bit involved (and secret!), but it evolved slowly over time as I worked on the game. It still uses the 2D elevation and noisyness maps, though.

I would either copy settings from existing biomes, or experiment with the values in the config files, and document what you get.

ghost commented 8 years ago

@rutgerkok I need height for BiomeMaster ( plugin ) for Nukkit. If you want heights ( Elevation ) to biomes, please you can tell me?