Jump to content

Improved, Realistic Trees


IdrisQe

Recommended Posts

Given this game's focus on realism, and taking inspiration from a number of Minecraft mods, I wanted to bring up a mod I find essential in most of my playthroughs these days, which I think it'd be really cool to try to emulate to an extent, or at least take some notes from it, because currently trees look a bit, for lack of a better term, plain.

The mod is Dynamic Trees, and it overhauls how trees generate and grow, with a focus on more realistic shapes and sizes. Some features include:
-Trunks that get thinner higher up
-Branches that extend and, well, branch
-Leaves that constantly grow, regrow, and change
-Trees growing from a small sapling over time into a full-sized tree naturally
-Trunks that can be over 1 block thick, but under 2x2 in size
-Trunks that can be under 1 block thick
-Falling tree physics (to an extent)
-Larger trees generating aboveground roots
-Branches being far quicker to break than trunks
-Tree disease/lack of nutrients from soil causing stunted growth and tree-death
-Saplings planting themselves when leaves naturally decay
-Trees growing taller to fight with other trees for more sunlight under the canopy
-Emergant forests that live, grow, and wane on their own
-Unique generation for each tree type
-Surprisingly minimal performance hit, even in Minecraft, for all the tree updates happening constantly in wooded areas

It makes trees gorgeous and vastly improves their generation, look, feel, and functionality.
I feel like this style of tree, and a lot of the functionality, would feel right at home in Vintage Story's more detailed look and mechanics!
I can even imagine thinner branches being affected by the wind... It would look beautiful-


Of course I'd suggest crediting Ferreusveritas if you were going to take inspiration from the mod.

  • Like 11
Link to comment
Share on other sites

I do love this concept, and the following features would be easy enough to implement:
-Trunks that get thinner higher up
-Branches that extend and, well, branch
-Trunks that can be over 1 block thick, but under 2x2 in size
-Trunks that can be under 1 block thick
-Falling tree physics (to an extent)
-Larger trees generating aboveground roots
-Branches being far quicker to break than trunks
-Unique generation for each tree type

However, when it comes to these features:
-Leaves that constantly grow, regrow, and change
-Trees growing from a small sapling over time into a full-sized tree naturally
-Tree disease/lack of nutrients from soil causing stunted growth and tree-death
-Saplings planting themselves when leaves naturally decay
-Trees growing taller to fight with other trees for more sunlight under the canopy
-Emergant forests that live, grow, and wane on their own

The issue comes when trying to simulate these things in areas that are not currently loaded by the player/players. The game cannot have all chunks loaded to be able to simulate these things away from the player, so in order to achieve these things, the following would need to happen:

 

  • Each chunk has a value on it that indicates the last time it was unloaded.
  • When loaded, the game would need to do catch up simulation on objects
  • The catch-up would include simulating each chunk for the length of time that the chunk has been unloaded for
  • The catch-up would need to be performant enough that the game does not stutter. i.e. needs to be completed in a frame, so even at a modest 30fps, it would need to be done within 33ms
     

This system has been proposed before for other dynamic world systems, like snow, so it's not impossible, but the task is quite a big one.

Good suggestion, +1 :)

  • Like 5
Link to comment
Share on other sites

  • 5 weeks later...

Definitely having big trees with aboveground roots would just be incredibly Beautiful, and give a whole new feeling to walking through the forest.

Imagine the jungles.

Also trees branching out is a good Idea, especially since you can pass through most leaf blocks, making trees that much more fun to climb. (Especially if they had more branches!)

Edited by Mads Søby
  • Like 2
Link to comment
Share on other sites

Just want to point out that dynamic trees will not work for an entire forest without a performance hit. Also there's a reason you can't regrow the large trees. Their suppose to be rare and are a nod to the devastating effects of unsustainable logging. You can't always regrow what you cut down. However, trees having more stages would be nice if time consuming to add.

  • Like 2
Link to comment
Share on other sites

10 hours ago, Stroam said:

Just want to point out that dynamic trees will not work for an entire forest without a performance hit. Also there's a reason you can't regrow the large trees. Their suppose to be rare and are a nod to the devastating effects of unsustainable logging. You can't always regrow what you cut down. However, trees having more stages would be nice if time consuming to add.

Assuming trees generated by the world don't grow and there is no natural reforestation (i.e. trees planting saplings without player input), the performance hit would be limited to world generation only. Only player planted trees would cause a performance hit, but that should also be fairly manageable, as the trees would grow quite slowly, probably taking a few ingame years come close to the size of "naturally" generated trees.

The difficult question is how to efficiently handle a tree as a entity. Having one "tree entity" assigned to every tree seems to be the most straightforward option. Trees generated by the worldgen don't have a tree entity, because they don't need it, they don't grow. The tree entity itself would be stored inside the block that was originally the sapling. The entity would store the positions of all blocks belonging to it and would only update those the tick before a growth tick or the tick when part of the tree or part of the tree is unloaded.

Tree destruction should still be done by an algorithm on the axe and should not utilize the data structure on the tree entity, as that would require the data-structure to store the coordinates of the tree blocks in a tree data structure instead of a simple list and the tree entity belonging to the chopped tree would still need to be tracked down by an algorithm on the axe, as well as trees without a tree entity still having to utilize the old search algorithm on the axe, so the whole endeavor would not be worth it.

The one tree entity per tree approach however comes with some negatives, like having to check the tree positions every now and then, at least before the growth of the tree, as any of them could be destroyed/removed. Finding and updating the tree entity whenever a tree block is destroyed is also a possibility, however there may be ways to exploit this, such as possibly just moving blocks with pistons in the future or using save game editing tools. Then there are always the problems that could arise with trees lying in more than one chunk, being partially unloaded.

Another way to handle tree growth would be to have multiple moving tree entities on one tree. These "tree runner entities" would only simulate growth at their position (and maybe surrounding blocks for leave generation). On a growth tick they grow the branch and move to the next further from the root until they hit reach the end of the branch and then either extend/grow the branch or grow branching. A runner also deletes itself when it reaches the and of a branch or a branching, however at a branching it also spawns new runners for each of the child branches. A new runner entity would be periodically spawned at the root/origin of the tree. They would essentially allow running the tree growth algorithm over multiple ticks, preventing stutters at growth ticks that would maybe be possible with a "one tree entity" model, when it has to check the positions of all blocks. It also has the added benefit of having a lower memory impact, as the tree block positions don't need to be stored on the entities.

The downside of this approach being that there is some additional overhead, as there are a lot more block entities that need to be taken care of. Block entity visualization would also be needed to allow efficient debugging, but this also allows for much better debugging of the growth algorithm and modding of custom trees as they would visualize the growth algorithm itself. Problems with multi chunk trees and unloaded chunks can also be handled quite efficiently, as loaded runners can run as usual until they are either destroyed by reaching the end of their branch or hit the border of an unloaded chunk, when they would, instead of deleting themselves, just wait until the chunk becomes loaded, potentially stacking many runners at the chunk border to be released and quickly running in a single tick when the chunk gets loaded.

I personally prefer the second approach, for its more intuitive solution for issues with partially unloaded trees and being less prone to lag spikes.

  • Like 2
Link to comment
Share on other sites

  • 3 weeks later...
On 5/13/2020 at 8:31 PM, Stroam said:

Just want to point out that dynamic trees will not work for an entire forest without a performance hit. Also there's a reason you can't regrow the large trees. Their suppose to be rare and are a nod to the devastating effects of unsustainable logging. You can't always regrow what you cut down. However, trees having more stages would be nice if time consuming to add.

While that's true, Vintage Story seems MASSIVELY more optimized than Java Minecraft, and even with Java Minecraft, I don't get any noticable performance hit with Dynamic Trees, even when using the option to replace every single naturally generated tree in the world with a dynamic variant. The performance hit is surprisingly small, especially given how Minecraft's block updates work. I'd wager that VS has a much more streamlined system in place behind the scenes given the more complex block-based values that need to be changed/referenced frequently.

On 4/13/2020 at 2:00 AM, LordJameh said:

The issue comes when trying to simulate these things in areas that are not currently loaded by the player/players. The game cannot have all chunks loaded to be able to simulate these things away from the player, so in order to achieve these things, the following would need to happen:
 

  • Each chunk has a value on it that indicates the last time it was unloaded.
  • When loaded, the game would need to do catch up simulation on objects
  • The catch-up would include simulating each chunk for the length of time that the chunk has been unloaded for
  • The catch-up would need to be performant enough that the game does not stutter. i.e. needs to be completed in a frame, so even at a modest 30fps, it would need to be done within 33ms

To be fair, the Minecraft mod doesn't do this, and VS wouldn't necessarily need to either, especially since VS has a much higher default load-distance. If a lore-reason is needed for why things don't seem to grow when nobody's around... Well... Time shennanigans.

Also, the main performance issue with it in Minecraft is the semi-frequent block updates. Having all the updates happen at once would probably be more performance-friendly, it'd be less intensive than just generating a new chunk as it comes into view, since only some blocks would be changed to others.

That said, the main thing I'm hoping for is the visually superior trees, the more stage-like growth (not necessarily as granular), and maybe stuff like slowly regenerating branches and leaves, which wouldn't be much of a performance hit given it's, well, slow.

Edited by IdrisQe
  • Like 2
Link to comment
Share on other sites

  • 1 month later...

I really like the Dynamic Trees mod as well, it really adds to the look of a Minecraft world and since trees get chopped down in their entirety in VS it would fit well.

On 4/13/2020 at 1:49 PM, ApacheTech said:

As a builder, I'd like the ability to use leaf blocks within my builds. They add so much when landscaping, terraforming, and dressing builds. I'd like the ability to harvest leaf blocks from trees, or have some other way of collecting them.

An option to have smaller shrubs and plants that just require a bit of soil would be cool to cover this, I personally don't really like leaves floating in random places where they wouldn't be able to grow.

 

On 5/14/2020 at 5:31 AM, Stroam said:

 Also there's a reason you can't regrow the large trees. Their suppose to be rare and are a nod to the devastating effects of unsustainable logging. You can't always regrow what you cut down. However, trees having more stages would be nice if time consuming to add.

Large trees look nice so I'd love to be able to grow some near my builds. I don't like random restrictions on my sandbox.

If it needs balancing some additional care/input from player and/or time would be fine. (Temporal gear + tree = huge tree, temporal gear + huge tree -> large dead tree of aged wood?)

  • Like 2
Link to comment
Share on other sites

  • 3 months later...
  • 2 months later...
On 7/9/2020 at 11:14 AM, Feone Varen said:

Large trees look nice so I'd love to be able to grow some near my builds. I don't like random restrictions on my sandbox.

If it needs balancing some additional care/input from player and/or time would be fine. (Temporal gear + tree = huge tree, temporal gear + huge tree -> large dead tree of aged wood?)

This.

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.