Simplex noise based minecraft map generator
This is an experiment adapted from Notch’s Javascript Minecraft renderer, but extended with new aditions, like random terrain generation, fog and fake shadows, possibility to navigate and look over the generated landmark.
As a fundation is using the simplex noise random seed distribution algorithm. For the Javascript port of simplex noise algorithm check simplexnoise.js.
npm install
to install the node-static
packagenode app.js
to run the serverlocalhost:3000
to run in the browserIf you wish to change the default seed distribution you can change the code below:
for (var pixel = 0; pixel < noise.length; pixel += 4) {
var x = (pixel / 4) % ww;
var y = Math.floor(pixel / hh / 4);
x /= ww;
y /= hh; // normalize
var size = GUI.frequency || 2; // pick a scaling value
// add octaves
var value = Math.floor(
(simplex.noise(size * x * GUI.x, size * y * GUI.y, 0.1 + GUI.z) +
simplex.noise(2 * size * x * GUI.x, 2 * size * y * GUI.y, 0.1 + GUI.z) * 0.5)
* 177);
noise[pixel] = noise[pixel + 1] = noise[pixel + 2] = value;
noise[pixel + 3] = 255;
}
If you wish to replace the simplex noise algorithm to Perlin noise you need to change the line below:
var simplex = new NOISE.Simplex();
simplex.init();
simplex.noiseDetail(4, 2);
with
var simplex = new NOISE.Perlin();
simplex.init();
simplex.noiseDetail(4, 2);
The Perlin noise algorithm is included in the package.
Running example:
www.esimov.com/experiments/javascript/minecraft_v2/
Copyright © 2016 Endre Simo
This software is distributed under the MIT license. See the LICENSE file for the full license text.