
Determine the tile type based on the current biome of B, (if you are generating the tile x = 10, y = 15 of the noise A, you will read the type of biome from B from the tile x = 10, y = 15).Find the altitude, using the previous formula ( maximum x value + baseline), or your own.For each of the values in A (horizontal and vertical, or X and Y) :.Split B in chunks of 16×16, select the values for your current chunk.Split A in chunks of 16×16, select the values for your current chunk.Select a biome based on a new Perlin noise generated, (for example, below 0.5 is meadows and above 0.6 is mountains), let’s call it noise B.Generate a Perlin noise (remember, you generate a two-dimensional array of values between 0 and 1), this noise will be used for the entire world (not really but just go with it for now).The only difference is that Minecraft is “infinite”, and so, instead of generating the whole world as we did just now, they split it in chunks of 16x16x256 tiles.Ĭan you imagine what it’s like generating a chunk of these? Follow me: Take a look at the side on the right, notice the 1st layer of grass? Notice the 3 tiles of dirt below it? And the stone below the dirt? Sound familiar? If you said yes, then you’re right. Procedures (rules) are everything when using PG, that’s why it’s called Procedural Generation. You don’t need to do it this way, but I believe this is the easiest way to introduce people to PG. Now you only need your imagination and implement deserts, swamps and what not :). This is a very simple world that we just generated, but you get the gist. Value above 0.7, we spawn an adult tree.Value between 0.6 and 0.7, we spawn a tree sapling.Value between 0.1 and 0.3, we spawn an “adult shrub”.Value between 0 and 0.1, we spawn a “baby shrub”.Value between 0.7 and 0.85, it’s a stone tileĪnd finally, the vegetation part (my favorite) using noise C:.Value between 0.4 and 0.6, it’s a grass tile.Value between 0.2 and 0.3, it’s a dirt tile.Value between 0 and 0.1, it’s a water tile.If the value is below 0,5, the biome will be forestĪfter that, we will generate altitude, using noise B:.If the value is above 0,5 the biome will be mountainous.At the moment, we only care about forest and mountains, so for each value in the noise A: Vegetation (This helps keep your trees together and realistic)Īnd so, let’s generate biomes.Optional: If you generate a 4th noise ( multifractal) you can generate rivers 🙂.Using these noises, we will now generate our world in the following order: Now, for each tile, from left to right, we repeat this process, ending up with something that looks like this (baseline is now blue for visualization): So we would put the first tile (grass) on the Y position of 6 tiles above baseline, which is 36 tiles above Y = 0.Īfter this, all of the tiles below this one will be filled with dirt, unless the distance to the first tile is greater than 10, in which case, we put stone. The real position of the tile is (maximum x noise value) + baseline = (30 x 0.2) + 30 = 36. Multiply it by the first noise value and add the baseline value to get the real position of the tile. Let’s define the maximum height that we will use, for example, to 30 tiles. This allows us to generate, from left to right, the height of the map. Now, we have to picture the white part as 1, and the black as 0. We only care about 1 row of values from 0 to 1. Make sure you understand that it is only 1 row, expanded vertically so you can see it better.
