-
Notifications
You must be signed in to change notification settings - Fork 0
Generation
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.
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.
The actual tree generation code runs a loop for all the current meristems that are alive.
- The loop first checks if a meristem should terminate.
- If the meristem is still alive, the direction of the branch is shifted.
- The meristem moves in the newly determined direction.
- The meristem decreases in age if the branch has grown a certain amount.
- 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.