added strata generation

Alex Mulkerrin 2015-12-02 17:22:43 +00:00
parent 67bf739960
commit d540a014f4

@ -42,6 +42,7 @@ The players is prompted to choose from 3 default sizes; small medium or large. S
Using: Using:
* heightMap, a 2D array of size width X depth * 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. * 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. * noise2, a combined noise function with two octave noise functions (of octave 8) as input.
* noise3, an octave noise function (of octave 6) * noise3, an octave noise function (of octave 6)
@ -61,11 +62,32 @@ if heightResult < 0 {
set heightResult to 8/10 its value 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 ## 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 ## Carve out caves
// Todo // Todo
## Create ore veins ## Create ore veins