Skip to content
Matt Basta edited this page Aug 17, 2014 · 1 revision

Overworld terrain transitions between different types of land features. This is done with a multi-stage noise generation process.

Land Features

The following land features are available:

  • Mud
  • Dirt plain
  • Grass plain
  • Tall grass plain
  • Grass field
  • Flowers field

In the future, this will be augmented further. The planned land feature list is:

  • Lake
  • Marsh
  • Bog
  • Flatland (dirt plain)
  • Mountains (spawned as a subset of flatlands)
  • Grass plain
  • Tall grass plain
  • Grass field
  • Flowers field (spawned as a subset of grass fields)
  • Beach
  • Ocean
  • Deep ocean
  • Beach
  • Jungle

Biome Generation

The first pass creates the biome gradient seen above. If each biome is represented by an integer, this step uses simplex noise to choose a biome for each tile. This smoothly transitions from one biome to another across regions and extends infinitely. Because biomes tend to be quite large, this gradient is often subtle.

The second pass creates noise along the surface of the biome. This breaks up the solid repetition of the biome into more interesting-looking terrain. This second pass uses simplex noise with a much lower frequency, at a scale which can be seen by the user at a normal zoom level.

Presently, the second pass simply pushes the biome value up or down to the next or previous biome. In the future, this process will create variations of the current biome.

This process is done entirely with floating point numbers. When integer math is used alone, biome edges are clearly discernable, even with the adjustments made by the second pass. This is because the biome change is sudden and causes the second pass to push up or down by one as well, leading to visible hard edges. By using floating point numbers and smooth decimal values that are rounded to the nearest integer at the end of the terrain generation process, the biome edges become invisible and hard edges become soft.

Finishing

The final step is finishing. Finishing involves inspecting each tile and its adjacent tiles. First, a pass is made to remove lone values. For example:

4444445555554444
4444444556554444
3444444555544444
3444444455544444
4444444444444444
4444444444444444
4444444444444445
4433344444444445
4333333444444455
4332333444444455
3333333444444455
3333333344444455

In the example above, notice the 6 and the 2. These values are expected and are caused by the smooth gradient's "z-edge" being just above the integer boundary for a biome.

The first pass removes any of these lone values by searching for tiles where no adjacent tile (except diagonal) shares its value. In this case, it takes on an adjacent value.

The second pass identifies tiles which are edges and corners. Tiles against another tile of a different integer value will take on a different position on the tileset sheet to match the edge that is represented. This is also done for "corner" tiles. This step is done to remove hard edges between terrain components.

Clone this wiki locally