From 8df13da10e4511e80d1cecc3723961a3b1a357fb Mon Sep 17 00:00:00 2001 From: Simon Campero <70719312+Simon34545@users.noreply.github.com> Date: Tue, 3 May 2022 16:16:17 -0700 Subject: [PATCH] (https://imgur.com/a/mAG38BN) The number of underground water sources seeded is actually width x depth / 8000 (typo?). The number of tree patches is actually width x depth / 4000 (forgot to remove height after copying and pasting?). Also, the "Eroding..." step seems to be missing. I can't figure out how it works, though, so you will have to pick variable names. --- Minecraft-Classic-map-generation-algorithm.md | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Minecraft-Classic-map-generation-algorithm.md b/Minecraft-Classic-map-generation-algorithm.md index 9d31042..fbff587 100644 --- a/Minecraft-Classic-map-generation-algorithm.md +++ b/Minecraft-Classic-map-generation-algorithm.md @@ -26,6 +26,7 @@ Where x, y are the given 2D coords and noise1, noise2 are the two noise function Generation of a Classic Minecraft map, as seen on the sadly defunct browser-embedded version of creative mode that used to be hosted on the main Minecraft site, goes through a sequence of generation steps each time a new map is created: * choose map size * create height-map, _"Raising..."_ +* smooth out height-map, _"Eroding..."_ * create strata, _"Soiling..."_ * carve out caves, _"Carving..."_ * create ore veins @@ -67,6 +68,22 @@ If heightResult < 0 { heightMap(x,z) is then set to the integer component of heightResult + waterLevel. ``` +## Smooth out height-map + +Using: +* 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. + +For each column in the x,z plane assign a new elevation value to heightMap computed from: +``` +Let a be noise1.compute( x*2, z*2) / 8 +Let b be 1 if noise2.compute( x*2, z*2) > 0, otherwise 0 + +If a > 2 { + heightMap(x,z) is then set to: (int)((heightMap(x,z) - b) / 2) * 2 + b +} +``` + ## Create strata Using: @@ -185,7 +202,7 @@ for len in veinLength { Water is flood-filled into the map, spreading horizontally and down vertically, from the x,z edges of the map at a height of water level - 1. Some underground water sources are then added to the block array to create flooded caves. The number seeded is: -width x depth / 800 +width x depth / 8000 For each water source a random x and z coordinate value is chosen and the y coordinate is set to water level - 1, or water level - 2. If this position in the block array is AIR then the water flood-fills out and downwards. @@ -280,7 +297,7 @@ Repeat 20 times { ### Trees -Finally trees are added to the map, there will be width x height x depth / 4000 patches of trees created. +Finally trees are added to the map, there will be width x depth / 4000 patches of trees created. For each tree patch: ```