Mods for Minecraft Java Edition
Home Decorations Plants RealWorld

World Generation


Index

Click on these links to jump to that section on this page.


Biomes
Habitats
Default Settings
Scanning the World
Plant/Tree Selection
Plant/Tree Spawning
Randomness
The Code



Biomes

PMP defines its own set of biome types to accomodate both Minecraft and modded biomes. There are over 50 biomes in Minecraft, and even more when you consider biomes that other mods may introduce into the game.

The Biome Dictionary in Forge provides a list of 'tags' for each biome. PMP uses these tags, and other attributes such as temperature, to map each biome to its own biome types. This allows PMP to generate plants and trees in any biome with reasonable accuracy. For modded biomes, the tags that a mod developer uses to define their biomes determines how accurate PMP will be when mapping those biomes to its own types. It is for this reason alone that some world generation in modded biomes may be inaccurate.

Previous versions of PMP recognized each Minecraft biome and those in popular mods, such as as BoP. This approach quickly became unsustainable and was very difficult to maintain. The Forge Biome Dictionary is the best mechanism for mods like PMP to use for the purpose of recognizing different biomes.

PMP also divides certain biomes into multiple types. For example, Forests have both a 'normal' and a 'hills' biome type. This allows you to customize the generation of plants and trees on a finer scale than if PMP simply combined both into just 'Forest'.


Habitats

A Habitat is an area on the naturally-generated terrain that PMP identifies and maps to its own habitat types. During world generation PMP detects surface features and essentially divides every biome into individual habitats. Every biome can contain any number of each habitat type.

In the following screenshot, wool blocks are used to demonstrate most of the habitats in PMP:

The configuration settings in PMP allow you to customize which plants and/or trees will be allowed to spawn in each of these habitats, in each biome.




Default Settings

PMP has what are called 'default settings'. These settings are similar to 'factory settings' that you may find on an electronic device. If you choose not to customize the world generation settings, PMP will automatically use these default settings to populate your worlds.

Specific plants and trees are assigned to the habitats in each biome based on information readily available on the internet. The mod author has invested a great deal of time researching every plant and tree in PMP and assigned them as accurately as possible to the relevant habitats in each biome.

For example, you will find cattails plants only in habitats that are adjacent to rivers, and these plants are set up to generate only on the same plane as the water (i.e. not up a hill) because that is how they grow in the real world.

One of the best features in PMP is the ability to customize these settings and tailor world generation to your specific tastes, right down to an individual plant in a specific habitat in a specific biome.


Scanning the World

PMP actually scans each and every surface block during world generation! While this may sound like PMP is setting you up for some serious lag, it isn't unless you purposely max out the world generation settings, which typically are between 10 and 20 percent in the default settings.

There are multiple levels of 'random chance' in PMP that ask the question: "Can a plant or tree spawn here?". What this means is that PMP compares each of your settings to a randomly generated value to determine if a plant or tree will actually generate. This happens in the following order:
  1. Master world generation level
  2. Biome world generation level
  3. Habitat world generation level
  4. Plant world generation level

As an example, your settings may be:
  1. Master: 100%
  2. Biome: 10%
  3. Habitat: 10%
  4. Plant: 10%
With these settings, the chance that a plant will spawn is actually 0.1%. This is typical in many default settings.

In some cases a particular surface location is immediately discarded and will not be considered. For example, plants and trees will not spawn on top of stone blocks. In another example, if the location is on top of a sand block, only plants and trees that naturally grow on sand will be allowed to spawn at that location.

A great deal of effort and time have been invested in the code and default settings to efficiently produce realistic world generation while minimizing lag. The algorithms developed by the mod author are smart in that they perform minimal processing unless a location has actually been chosen as a spawn location.


Plant/Tree Selection

For each surface block that is chosen as a spawn location, PMP examines a weighted list of potential plants or trees and selects one at random. Using weights for each plant/tree provides the ability for PMP to choose certain plants/trees to generate more frequently than other plants/trees in the list.

For example, cattails plants generate around rivers more frequently than other wetlands plants. The default settings have been set up this way on purpose, once again to mimic real-world growth of each plant. This is not perfect in PMP's default settings, but it is very close!


Plant/Tree Spawning

Once a location and a specific plant or tree has been selected, PMP attempts to spawn it at the location. Plants and trees are handled differently in PMP, and different settings are used to control how each plant and tree will spawn.

For trees, PMP scans the area around the spawn location to determine if it is 'clear' enough to generate all the leaves on a tree. In the real-world, trees need space around them to grow and rarely grow immediately adjacent to each other. Once a tree is generated, PMP continues to scan new locations for consideration.

For land and aquatic plants, PMP will try to spawn a cluster (or group) of each plant, depending on the settings used for that cluster. The settings allow you to create dense or sparse clusters and control how the cluster will generate based on the terrain around the orginal spawn location. This level of detail is what makes PMP's world generation very accurate.

Other plant types, such as epiphytes and vines, generate differently than other plants. They are less common and depend entirely on how and where trees are generated.

During world generation, PMP always spawns trees first and then plants. This provides larger numbers of specific habitat types, such as in the shade under a tree and distributes generation more evenly to all of the habitats in each biome.


Randomness

PMP relies heavily on randomly-generated numbers during world generation specifically to produce imperfect results. In the real world, plants and trees very rarely grow in straight lines, or grow in perfectly-sized clusters, etc. By using random numbers PMP reproduces the growth patterns found in nature.

Random numbers are based on a seed which, by default, is the same seed used by Minecraft to generate a world. You have the ability to tell PMP to use a different seed, which means that when you generate a world multiple times with the same world seed, PMP will produce different results every time which guarantees that each world will be unique. When you change this setting, a different seed is chosen when each chunk of the world in generated.

It is important to note that random numbers generated by a computer are not perfectly random. They are actually called pseudo-random because over time, sequences of numbers may repeat themselves, patterns may be identified, etc. In short, PMP's randomness is only as good as the numbers generated by the computer.


The Code

PMP has a proprietary set of algorithms developed by the mod author over a period of years to perform world generation. The code has been refined and enhanced many, many times and each new iteration improves on previous code in some way and it is a constantly evolving thing.

PMP's code cannot work without Forge. The mod author gives credit to Lex and all contributors of Forge for providing a great platform to work with.

To summarize all of the technicalities of world generation, here is how works in a nutshell:
  1. Forge delivers world chunks to PMP, one at a time.
  2. PMP scans all surface blocks in each chunk, one at a time.
  3. During the scan, the biome type and habitat are chosen based on terrain, temperature and other factors.
  4. PMP randomly chooses a tree or plant for the mapped biome and habitat for the current location.
  5. The chosen tree or plant is spawned, using the spawn settings applicable for the tree or plant.
  6. The process repeats until no more chunks are delivered.
During this process, the generation settings are checked to determine if each location will result in the spawning of a tree or plant, or if it will be skipped and left alone. Using the default settings, the vast majority of available surface blocks are not considered and are skipped (otherwise your world would quite literally be full of plants!)

While this is very easy to summarize, there are many, many things going on to provide you with an advanced, accurate and configurable world generation system that you can completely customize to your tastes.