From d540a014f41f84806c650ed317ad03df10d0f320 Mon Sep 17 00:00:00 2001 From: Alex Mulkerrin Date: Wed, 2 Dec 2015 17:22:43 +0000 Subject: [PATCH] added strata generation --- Minecraft-Classic-map-generation-algorithm.md | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/Minecraft-Classic-map-generation-algorithm.md b/Minecraft-Classic-map-generation-algorithm.md index df6f305..9310df6 100644 --- a/Minecraft-Classic-map-generation-algorithm.md +++ b/Minecraft-Classic-map-generation-algorithm.md @@ -42,6 +42,7 @@ The players is prompted to choose from 3 default sizes; small medium or large. S Using: * heightMap, a 2D array of size width X depth +* waterLevel, a constant of 32 * noise1, a combined noise function with two octave noise functions (of octave 8) as input. * noise2, a combined noise function with two octave noise functions (of octave 8) as input. * noise3, an octave noise function (of octave 6) @@ -61,11 +62,32 @@ if heightResult < 0 { set heightResult to 8/10 its value } -heightMap(x,z) is then set to the integer component of heightResult. +heightMap(x,z) is then set to the integer component of heightResult + waterLevel. ``` ## Create strata -// Todo + +Using: +* blocks, a 3D array of size width x height x depth +* noise, an octave noise function (of octave 8) + +For each column in the x,z plane populate blocks in array with stone-to-dirt and dirt-to-air transitions: +``` +Let dirtThickness be noise.compute(x,z) / 24 - 4 +Let dirtTransition be heightMap(x,z) +Let stoneTransition be dirtTransition + dirtThickness + +for y in height { + Let blockType be AIR + if y equals 0 then blockType is LAVA + else if y <= stoneTransition then blockType is STONE + else if y <= dirtTransition then blockType is DIRT + + set block(x,y,z) to blockType +} +``` +By doing so the block array is populated with lava at height 0, stone along with a variable thickness layer of dirt up to the heightMap elevation for that column and then air above. + ## Carve out caves // Todo ## Create ore veins