Skip to content

Generation

lilypuree edited this page Jul 23, 2020 · 1 revision

How tree generation works

The trees in forest tree don't have a predefined shape. Instead, they are procedurally generated block by block, making each tree unique and varied. (If worldgen is implemented this might have to change)

The process of creating a new tree is quite simple.

Meristems

In a growing tree, the parts that are actually extending in length are only the tips. existing branches can only get thicker, but not longer. The generation algorithm of forest tree works similarly. During generation several meristems are created, which then extend towards different directions, adding appropriate branch blocks as they move forwards until they die off or reach the minimum branch age limit.

There are two types of meristems : terminal and axillary. Usually the terminal meristem is used for creating the main trunk, and axillary meristems create the lower-order branches. Most of the parameters are divided into axillary/terminal, so that you can combine different trunk and branch shapes.

Growth loop

The actual tree generation code runs a loop for all the current meristems that are alive.

  1. The loop first checks if a meristem should terminate.
  2. If the meristem is still alive, the direction of the branch is shifted.
  3. The meristem moves in the newly determined direction.
  4. The meristem decreases in age if the branch has grown a certain amount.
  5. New axillary meristems are generated if it's a node.

If the existing/new meristems aren't dead or younger than the age limit, they are added to the pool and the loop continues until there's no meristems left.

Clone this wiki locally