How Worldsdesigner builds trees

Basically every minecraft world has trees. If you are one of the people that build large worlds you have probably faced the problem of needing trees in your world. Because the vanilla trees are very simple and boring (and everybody knows them), they are not very interesting. (Or realistic for that matter) But, there are some people that build really good trees by hand and let you download them to use in your world. (If you just want to download a treepack, here you go: Worldsdesigner treepacks download)

This is a very tedious process but produces trees that can look really good and fit the feel of the world perfectly or give you something to download and use really fast.

There is another way

If you do want to build trees by hand but still need lots of cool trees for your minecraft world, there is another option to get what you want.

Software can build the trees for you. Specifically, worldsdesigner can be used to generate hundreds of trees when creating your minecraft world. The generation can be customized at every step of the process to fit your ideas and needs.

This is a deepdive into the process that makes the tree generation work in the worldsdesigner editor. We will look at the different kinds of trees you might want to create and take a look at the actual algorithm used. (Maybe you have ideas on how to make it better?) This article will not look at landscape generation or anything else besides trees, so brace youself, we will be creating forests in the coming minutes.

How many do you want?

One of the core requirements during the development process of the tree generation feature was that it should allow you to create as many trees as you need for your world. There is no point in having a program that creates a singular design that is used in the entire world.

Players kinda want to look at two trees and not immediately think how they look identical with just some rotation applied.

This meant that the software had to use some kind of process that can be applied many times and describes how a tree is built in minecraft. There are already algortihms to do this sort of stuff, because this is not the only time somebody has thought of this.

The first approach that comes to mind are L-Systems that can be used to model plants in a recursive manner. The results look really cool and can be customized in lots of ways to produce entirely different images.

Examples of L-Systems from Wikipedia:

Examples of L-Systems from Wikipedia

L-systems are procedual in nature which means that you can run the program twice and get different results that look similar but not equal.

Just like two trees in a park might both be birch trees but still look somewhat different.

They work by repeatedly applying a set of rules to an intermediate result. Depending on the on the set of rules you can drastically change the look of the trees you create and how similar they look. This is perfect for the requirement that the software has to be able to generate hundreds or thousands of trees that are similar but not identical.

The actual algorithm

The algorithm used in the worldsdesigner editor is not directly an implementation of an L-System but very closely inspired by it. This is because minecraft deals in blocks and every branch of a tree is basically 1m^3 in size. L-Systems can be used to generate really detailed plantlike structures but they require a level of detail that is not possible in minecraft.

So we took the idea of L-systems and changed it to fit minecrafts constraints.

The results of these changes is basically a list of settings that are used to create a tree of vectors that can be turned into minecraft blocks.

Sounds complicated but lets start at the root of the algorithm.

For each tree you can see the building blocks in the editor next to it for better clarity on the next part.

Starting at the root

Each tree starts at the root, both algorithmically and literally.

Imagine an arrow starting at the bottom and going perfectly upwards. This is the trunk of the tree.

Now we can just change the direction of this arrow to have different ways the trunk of the tree has grown.

But, a single arrow is not a tree.

The next step is attaching another arrow to the top of our existing "tree". We can even do multiple to simulate branching.

Depending on how you want your tree to look you can add another layer of arrows that branch outwards and it might just start to look like a tree.

Modularity

Worldsdesigner achieves this modularity by making every single node in the editor one layer of these arrows. Want more layers of branching? Add another node with different values

We want different behaviour at each point in the tree so we can tweak the settings to increase the branches or the spread. This gives us the option to have just a few large branches at the root and many leaves further up the tree. (Or just a single tall tree with a few leaves)

Because this algorithm is so modular we are able to change the look of the trees rather quickly and specifically. We can even control which blocks it uses where. To be fair, its takes some experimenting to get the values right, but once you got them correct for the look you can just increase the number of variants and the computer does everything for you. If you had build the tree by hand you still need to apply the correct formula hundreds of times once you found it through testing in your world.

Worldsdesigner editor nodes for a birch treeBirchtree in Minecraft that was generated in Worldsdesigner

Using the Trees in a world

After the trees have been generated, they can be used the same way you would use the trees from a treepack. They can be scattered across the world by the generation systems. The trees do not need to be changed after generation which means the code is just treating them like all other structures. For specific instructions on how to use trees in your world with worldsdesigner, you can look at our posts on How to place trees in worldsdesigner and How to create minecraft forests with software