Minecraft Procedural Terrain Generation

(Image Credit: Paul Pham)

(Image Credit: Paul Pham)

(Image Credit: Marhit Varikuti - Medium)

July 24, 2024

Paul Pham

12th Grade

Fountain Valley High School



Minecraft Worlds


Minecraft, as many are familiar, contains expansive worlds through which players can freely explore and build upon their imagination. In a certain sense, as Minecraft and Mojang developer Henrik Kniberg puts it, Minecraft is an Earth simulator, with various creatures, mountains, trees, flora, daylight cycles, and climates across a seemingly endless world of blocks. These seemingly endless worlds are unique in landscape, terrain, and size. When you load into a new Minecraft world, it is almost certainly a world nobody has ever seen. 


Distinguishing these worlds from one another comes from their world seeds, with each world being assigned a unique world seed of several numerical values ranging from -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807 that determine how the blocky world generates. With this, there are then therefore 18,446,744,073,709,551,616, or 18 quintillion, or 264, different world seeds, meaning there are 18 quintillion worlds in Minecraft all vastly different in nature and terrain. Furthermore, each of these 18 quintillion worlds contains a total area of 3.6 billion km2, with each individual block being 1 m2. This value puts each world approximately seven times the size of Earth which is 0.5 billion km2. 18 quintillion worlds, then, with a size of 3.6 billion km2 exist in Minecraft. How quite extraordinary.


These incomprehensible numerical values that outline the expansive catalog of equally expansive and unique Minecraft worlds raise the question of how this came to be. How has Minecraft created 18 quintillion worlds with each world having 3.6 billion km2 of diverse landscape and each world being vastly different in nature from one another? Well, this great feat has been achieved through a method called procedural terrain generation, a highly efficient means of creating digital worlds.

Minecraft Procedural Terrain Generation


A 3.6 billion km2 Minecraft world would necessitate an approximate 97,000 Terabyte download, an enormous amount of data space considering the largest data disk is around 100 Terabytes. How is it, then, that humans can run several Minecraft worlds on their devices that cannot nearly come close to handling the enormous scale of Minecraft’s worlds’ disk space? In actuality, when a user loads up a Minecraft world, the complete 3.6 billion km2 of blocks and land do not all load in immediately, and therefore loading up a Minecraft world does not necessitate a download of 97,000 Terabytes. In actuality, regions measured in units called chunks (16 x 16 x 384 blocks of land) are generated as players enter or approach close to that chunk. It is a well-crafted illusion that makes seemingly true the idea that there is always land beyond the horizon when in reality it is generated as you approach nearer. Procedural terrain generation is the process when the terrain of a digital world is generated in live time as the player physically approaches the yet ungenerated region of the world. Intricate mathematics and coding allow the terrain to generate most naturally and appropriately despite its degree of randomness in procedural terrain generation.

(Image Credit: Henrik Kniberg, YouTube)

(Image Credit: Fandom)

As previously mentioned, procedural terrain generation generates worlds in units called chunks, generating each chunk next to one another. The process identifies what block and pattern of block would fit most properly next to the previous chunk, and generates a succeeding chunk with the most reasonable and proper continuity relative to the preceding chunk of blocks. 


Procedural terrain generation does this on a vast scale and identifies the most apt pattern and selection of blocks to place in continuous succession to make the landscape seem most natural and navigable no matter how far you travel.

Procedural terrain generation can be thought of as a function where the inputs are x, y, and z coordinates, respectively, and in return, it outputs a particular and appropriate block to put in that specified location. Written out in code, this function can be seen below. 

This function operates simultaneously throughout an entire chunk at one time, allowing for a complete chunk to load in at once.

(Image Credit: Henrik Kniberg, YouTube)

(Image Credit: Henrik Kniberg, YouTube)

Seven separate chunks that have been generated to produce a continual and natural landscape

(Image Credit: Henrik Kniberg, YouTube)

Procedural terrain generation occurs in various steps. 


The first and foremost step is terrain shaping, a process that determines which blocks in a chunk are solid and which others are not, initially placing either a stone block or an air block in each appropriate location. 


It is then determined which area of the chunk is in an ocean or sea level placement, and thereafter water is placed in these determined spots.


From there, the surface of the solid stone land is replaced according to the appropriate biome, where forest biomes have grassy surfaces, desert biomes have sandy surfaces, etc.

Step one

(Image Credit: Henrik Kniberg, YouTube)

Step two

(Image Credit: Henrik Kniberg, YouTube)

Step three

(Image Credit: Henrik Kniberg, YouTube)

Finally, the surface is decorated with details such as trees, long grass, villages, and structures while the underground is decorated with ores, cave systems, dungeons, and other structures.

(Image Credit: Henrik Kniberg, YouTube)

The foremost step of terrain shaping is the most intricate, in terms of mathematics and coding, and well-crafted aspect of procedural terrain generation. Terrain shaping takes care of making the generated lands most natural and realistic despite its randomness.


If the function to shape terrain was purely random, such that each block in a chunk had an equal probability of being supplemented with either a solid stone block or a space of air, the resulting output chunk would appear very unrealistic, unnavigable, and unenjoyable. It would appear as such: A column of an ugly and arbitrary assortment of stone and air. 

(Image Credit: Henrik Kniberg, YouTube)

(Image Credit: Henrik Kniberg, YouTube)

Setting it so that above the y-limit of, say 100, is air and below is solid then allows the chunk to be somewhat navigable. It is then possible to have a series of chunks, a world, that can be navigable and accessible. Yet this resulting world would be very flat and frankly quite unenjoyable, being a flat world with a surface at y=100 that stretches well beyond your reach, containing no mountains, valleys, oceans, or geographical abnormalities of any type.

(Image Credit: Henrik Kniberg, YouTube)

How, then, can it be that computers can procedurally generate terrain similar to that of valleys and mountains? Think, for a moment, the visual graph of a sin(x) function on a Cartesian plane. The graph proceeds smoothly and continually in moving up and down along the y-direction, infinitely in both directions along the x-axis. Separating any region of the graph along any arbitrary interval or x-domain, it is found that it fits nicely in place with the regions preceding or succeeding the arbitrary interval that has just been selected. Smooth and continually in vertical and horizontal directions, just as how mountains and valleys can be thought of in present nature. If, then, the function to procedurally generate terrain utilizes a sine function (10sin(x)), then we could have a terrain pattern emulative of a sine function with dips and peaks.

(Image Credit: Henrik Kniberg, YouTube)

(Image Credit: Desmos)

This looks slightly more similar to natural terrain consisting of mountains and valleys but still is quite difficult to navigate around. If we were to add two more variables, frequency and amplitude, and variate with respect to those variables, then we would grow nearer to the natural terrain.

Hitherto, the sine function has been applied only to the x and y dimensions, resulting in mountainous terrain that moves in a straight line, appearing like a 2-dimensional world. Adding the third dimension, the z value, the code that generates mountains and valleys corresponding to the inputted sine function does so in all directions, allowing for the terrain to level out continually and completely in all directions. Adding to the more natural and realism of the world, the sea level can be established, at say y=102, and therefore water can generate in appropriate places throughout the array of peaks and dips, of mountains and valleys. 

(Image Credit: Henrik Kniberg, YouTube)

(Image Credit: Henrik Kniberg, YouTube)

(Image Credit: Henrik Kniberg, YouTube)

There remains, though, the issue of randomness, as the previously outlined function applies this world generation uniformly throughout the world, eliminating all qualities of randomness and therefore enjoyment. How can degrees of randomness be implemented without sacrificing too much continuity? This is achieved through a mathematical trick called Perlin Noise, named after Ken Perlin who discovered it in 1983. Before proceeding, a basic knowledge of noise should be acquired; noise is irregular fluctuations that accompany a transmitted electrical signal but are not directly a part of that signal and tend to obscure it. 

(Image Credit: Henrik Kniberg, YouTube)

Perlin Noise is one method to achieve a state of what is called Gradient Noise. Perlin Noise is the method that takes a wide array of arbitrary pixels or entities and makes each pixel or entity blend similarly with the pixel or entity beside it, resulting in a smooth, gradient-like texture.


Imagine, then, that the gradient textured image is a topographical map showing the x and z axis of a world, with the black, darker spots representing dips and valleys and the white, lighter spots representing peaks and mountains. The world, then, contains a natural and smooth pattern of mountains and valleys. Perlin Noise can be calculated through third-party sources, meaning that a developer need not calculate it themselves, making it a convenient means of generating terrain. Applying the Perlin Noise to the procedural terrain generation function, we get a smooth world.

(Image Credits: Henrik Kniberg, YouTube)

Still, there remains a degree of bleakness, so to further variate this, a trick called octaves can be used. 

(Image Credit: Desmos)

Each y function with a certain sin(x) value can be thought of as one octave. Octave 1 being y1=sin(x), octave 2 being y2=sin4x/4, and octave 3 being y3=sin16x/16. Each of these octaves can be thought of as terrain heights, with each local maximum thought of as a mountain top and each local minimum thought of as a valley base. Layering these octaves together and combining them into one function, y4 = y1 + y2 + y3, a result would be a single graph, outlined above in purple, that contains smaller peaks and dips within the larger peaks and dips, similar to realistic mountains and valleys with smaller peaks and dips within them. Adding octaves to the procedural terrain generation function, the world comes to appear even more natural and smooth.

(Image Credit: Henrik Kniberg, YouTube)

However, despite its natural smoothness and randomness, it lacks geographical abnormalities, abnormalities that make real-life Earth beautiful and unique, resulting in a rather uneventful landscape repetitive in its nature of fluctuation. Among some of these geographical abnormalities can be harrowing cliffs, towering mountain ridges, regal river valleys, and quiet plateaus where nature grows freely. How can we implement these geographical abnormalities while maintaining realistic degrees of randomness and smoothness? This is achieved through noise transformation and the use of spline points on a spline curve. 


Spline curves are graphs that contain selected points called spine points, and a line or curve is drawn to fit most appropriately to the sequence of spline points. An example is provided here: 

(Image Credit: Wikipedia)

Values called continentalness ranging from -1 to +1 can be assigned to each block in a Minecraft world with relatively minor increases from one block to the next one beside it. For example, one block can have a continentalness of 0.016, the block next to it can have continentalness of 0.022, then the next 0.028 or the next 0.014, etc. Creating a splint curve thereafter by putting continentalness on the x-axis and terrain height on the y-axis and selecting various values of continental ness and assigning with a certain terrain height, the separate points assigned to each value can be connected to create an irregular graph as such:

(Image Credit: Henrik Kniberg, YouTube)

Integrating this noise transformation into our procedural terrain generation function, we can have some geographical abnormalities while maintaining some randomness, as such:

(Image Credit: Henrik Kniberg, YouTube)

Further variation is done beyond respecting just the parameter of continentalness, such as with respect to the parameters of erosion and peaks & valleys. Each parameter has its own configuration of amplitudes and octaves. Each block in a world not only has an assigned value of continentalness, but also of erosion and peaks & valleys. 

(Image Credit: Henrik Kniberg, YouTube)

(Image Credit: Henrik Kniberg, YouTube)

These parameters are then taken into consideration and given a spline curve that further variates the terrain of the world.

(Image Credit: Henrik Kniberg, YouTube)

This combination of variations produces an amazing world generation whose terrain is dramatic and unpredictable, as such:

(Image Credit: Paul Pham)

The code involving these noise transformations and parameters is quite simple and consistent throughout the entire set of code, making it a highly efficient and convenient method of generating terrain. The overhangs, arches, and complex cave systems are further added to the overall landscape scenes through the use of 3-dimensional noise functions. It uses a Perlin Noise function with 3 inputs, the x, y, and z coordinates, with 1 output, density. Each block, then, in a chunk or world gets assigned a density value ranging from -1 to +1, with each neighboring block having a gradual change in density value, of course aligning itself with a gradient texture seen in Perlin Noise functions. The world terrain then produces a pattern such as this:

(Image Credit: Henrik Kniberg, YouTube)

It can be further regulated by commanding that density decreases with higher altitudes and increases with lower altitudes, and adding a fixed line in the center of the vertical altitude values where density is unchanged. Base terrain generation is calculated in this way. 

(Image Credit: Henrik Kniberg, YouTube)

Squash factor and height offset are the two parameters that control this terrain generation. Flat terrain is most prominent with a high squashing factor while a low squashing factor produces wild, unorganized, and unpredictable terrain. Height offset shifts the base terrain elevation either up or down. These are determined with the previously mentioned spline curves and the three noise transformation parameters.


Cave systems are generated using the same approach of assigning individual blocks gradual density values and utilizing noise in noise fields. On a noise graph, darker blocks can be identified as either solid or air blocks, with the lighter blocks being the other option. With this, there is a gradual pattern of solid-to-air blocks deep underground to generate gradual caverns. Minecraft developer Henrik Kniberg terms these caves “cheese caves” for their apparent cheese texture.

(Image Credit: Henrik Kniberg, YouTube)

(Image Credit: Henrik Kniberg, YouTube)

If instead of determining each dark or light block as solid or air and determining the grey border between them to be air and both dark and light blocks to be solid, it would produce a lengthy cave system of tunnels, unlike the wide caverns produced previously. Kniberg terms these cave systems as “spaghetti caves” for their lengthy and wavy patterns. 


Both of these caves are then decorated with ores, different stones, dungeons, and flora to add more liveliness to them.

(Image Credit: Henrik Kniberg, YouTube)

(Image Credit: Henrik Kniberg, YouTube)

Contributing to the overarching liveliness and enjoyment of procedurally generated terrain and a huge portion of Minecraft are the biomes and climates. Biomes are determined appropriately to be assigned in specific regions of the Minecraft world through parameters including the previous three (continentalness, erosion, and peaks & valleys) as well as two others termed temperature and humidity, each with values similarly ranging from -1 to +1. The values of these five parameters determine precisely which biome to go in which region of the world. The gradual shift of these values following gradient noise allows neighboring biomes to be realistically relative, obscuring possibilities of, say, freezing snow biomes neighboring blazing hot desert biomes. A possible distribution of biomes can appear as such:

These individual yet carefully interlaced factors, terrain shaping, mathematics and trigonometry, coding, spline graphing, and Perlin Noise among some of them, synthesize together to generate awesome, dramatic, unpredictable, and unique worlds within the game of Minecraft on a simply grand scale. The wild generation of terrain is one of the iconic qualities of Minecraft’s imaginative nature and provides endless canvasses for a player’s creativity. 18 quintillion of these well-crafted worlds exist for players all around the world to load in and decorate with builds and memories. 


In my youth, I thought that Minecraft developers spent ages placing blocks individually to build each Minecraft world, and that amazed me. Yet procedural terrain generation, though much more convenient and efficient, amazes me much more with its digital and mathematical intricacies, yielding a much more sophisticated approach to world generation. I hope that perhaps you too have been fascinated by such methods, and to henceforth explore and adventure through Minecraft’s expansive worlds. 


I shall leave off with some wonderful scenes I have captured of Minecraft terrain generation. 

(Image Credit: Paul Pham)

(Image Credit: Paul Pham)

(Image Credit: Paul Pham)

Reference Sources

Jfokus. “Reinventing Minecraft World Generation by Henrik Kniberg.” YouTube, 8 May 2022, 

www.youtube.com/watch?v=ob3VwY4JyzE&t=1228s. Accessed 8 July 2024. 

Kniberg, Henrik. “Minecraft Terrain Generation in a Nutshell.” Www.youtube.com, 6 Feb. 2022, 

www.youtube.com/watch?v=CSa5O6knuwI.

Minecraft Wiki. “World Generation.” Minecraft Wiki, 2022, 

https://minecraft.wiki/w/World_generation.

Rempton Games. “How Minecraft Generates Massive Virtual Worlds from Scratch.” Rempton Games, 28 Feb. 2021,

https://remptongames.com/2021/02/28/how-minecraft-generates-massive-virtual-worlds-from-scratch/.