Dynamic Trees

Dynamic Trees

25M Downloads

[suggestion] config option to halt tree growth after it is mature (to help on server load)

winsrp opened this issue ยท 6 comments

commented

well as the title says it would be nice to have a config option to stop the server from ticking tree changes an leafs and branches after it gets to the mature state (but it would still drop seeds), this way a forest can grown without much issues with server performance.

technically potion of persistance once tree is mature.

Thanks.

commented

I'd say I'd rather use more memory than CPU time for stuff like this.
I like the idea of having the RootyDirtBlock control the growth of the tree more or less entirely... As it adds just a single ticking block per tree, though... Does the tree fall when the block it is rooted on is broken, or is it just frozen in time in that case?

Sounds like this mod adds a lot of ticking blocks. Luckily doesn't seem to be a problem for my little LAN world ๐Ÿ‘
And, as with many other "visual enhancing mods" as I would classify this, it is requiring. Problem is that we hit the server and not the client, I suppose.
Shaders and Better Foliage hits the client quite hard, for a similar effect.

commented

In the latest work on this I have eliminated updateTick() for branches. This should help immensely. Also I've redone the Cell Automata for Leaves so it's more optimized and should cause less lag. I've posted an alpha release on CurseForge if anyone wants to test it. I know this isn't what you're asking for but it's a step in that direction.

commented

Jomik,

Yes. The entire tree will fall(harvest) if the root block is broken. I've recently moved most of the signals and ticking to the root block. The branches no longer tick. This will enable features like species that can use the same wood and leaves but grow differently, have different fruit/seeds and whatnot.

Leaves still tick because they need to account for light and hydration on a regular basis. This will be the case for a while.

All good ideas in this discussion. Maybe in time we'll get to implement them effectively.

commented

There have been some improvements to the speed and I think this issue is no longer needed.
The deeper suggestions for improvement while valuable are not going to be implemented due to new problems it would create. I'm closing this issue.

commented

It's something I've thought about. I'm willing to discuss it.

What about light smothering? If the Dynamic Leaves blocks are no longer updated then it can't tell if it's in the dark. How can we flag the Dynamic Leaves blocks as mature when there's no metadata bits left(2 bits for species identification, 2 bits for hydration level)? We can't really reallocate the metadata because players saved worlds would have ruined trees. For each metadata bit we allocate we double the blocks that need to be registered. It could get inconvenient when other modders start using this API to add dynamic trees. One way around it is that we could add more blocks that are "mature" versions of the Dynamic Leaves blocks. Not sure if I'm diggin' that solution though.

Can't really replace with Vanilla leaves because they don't fall crush, don't limit mobility, don't drop seeds, and don't light smother. Though the vanilla leaves could be modified to do that but it's getting into icky nasty code with huge compatibility issues.

Another possibility is to get rid of random ticking in dynamic leaves altogether and store a voxelmap of all the leaves for a tree in a hashmap with the coordinates of the RootyDirtBlock as the key. When the RootyDirtBlock gets an random tick update it can update a percentage of it's leaves. Mature RootyDirt could update less often. Problem: Memory usage, Extra data stored in chunks in a non-standard way.

Yet another possibility.. Same mechanism as above only make the RootyDirtBlock contain a TileEntity with the voxelmap and let it decide when to update the leaves. Problem: Memory Usage. In 1.7.10 the TileEntity is ticked every game tick. At least in 1.8+ TileEntity ticking is optional. If the tileentity stores the voxmap data in it's NBT then the data can be tucked away neatly.

None of the solutions really solve the problem that crushed, destroyed, or smothered leaves need to grow back or die in a consistent manner. This must happen regardless of the tree's maturity level.

I'm willing to hear any ideas because I'd love this to actually be the way it works if it's feasible.

commented

you seem to have though of many ways to do it, but I think you are also overthinking it a little bit, thanks God i'm a programmer as well and I could understand what you were talking about XD.

The point in case is that you want to keep the features of your mod, and try to find a way to improve either memory usage or cpu usage and that is cool, to be honest I would love all my trees to look like the ones you do but I use quite some mods, bop, natura, etc etc... so it looks kind of odd, some are cool some are well normal.

I also use the fast leafs decay or something like that, so ticking of leafs is rather fast (not flickering but it is very often), also there are trees that show up in caves, nether, etc, not very realistic I know, but they add to the feeling of the game mostly, this is not really a simulation, in the end it is just a game so keeping it fun is part of the challenge on every mod, and as you said, some people over extend their mods with features and they end up getting bored of it, so I like you honestly and straight forwardness around that.

So suggestion wise I would say, that without thinking it too much, you could do the following to keep as much as your mod and save some performance:

  1. Break the tree checking in 5 sections, instead of checking every single leaf, so take highest leaf as top side, left most leaf, right most leaf, and so on, as you checking points, to check for updates and light and everything else, all the leafs in that quadrant will behave as this checking point leaf would say. for example, no light on the north control leaf, modify all in the north section based on this so either smothering or grow, no light on the top part, tree starts to die.

  2. Add an option to stop ticking at a tree (regardless of condition), for example after 30 mins, stop ticking a tree, and leave it as it is, this way if you have a not so good server you could stop checking all those things but still keep the cool trees around your server, and if broken drop a bunch of seeds, so you also get the seeds out of it, so if the tree managed to spread in that time cool, and if not, well another tree might take its place trying to grow.