Dynamic Trees

Dynamic Trees

25M Downloads

[Suggestion] Season compatibility?

ErdbeerbaerLP opened this issue ยท 63 comments

commented

Can you make the mod season compatible so in autumn and winter leaves decay but come back in spring/summer
https://minecraft.curseforge.com/projects/serene-seasons

commented

If you visit the curseforge page you would see that this is already planned, for a complete response see the c&p text below.

Planned Features:

  • Tree trunks thicker than 1 block and up to 3 blocks thick. Should be possible using special "shell" blocks. I haven't worked out the details yet.
  • Seasons. In autumn the trees turn fall colors, in winter leaves fall off completely and regrow in spring. Maybe work with Minecraft seasons mod.
  • Falling leaf particles, especially in autumn. Use better foliage if you want this feature.
  • Trees that fall over when harvested(special effect).
commented

I just found out about the serene seasons mod last weekend. It's a feature I'd like to implement soon. It's on my to-do list.

commented

I've wanted to add this feature for a while now but there wasn't a decent seasons mod. The "seasons mod" died back in 1.7.10. Terrafirmacraft seems to be a lonely island. Tough as nails has seasons but nobody ever breathed a word about wanting the feature and I don't use it on my personal server so I didn't bother. I made stub code in DT for seasons that's sit derelict for over a year now. I'm excited to see a mod that actually specializes in a seasonal experience.

@Forstride I'm assuming that the seasons mod does all the leaf color changing for me? DT uses the standard vanilla functions for pulling the foliage color. I'm assuming you've done an override on them.
Also while I have your attention and so I don't have to go digging around.. what's the default duration of a season in serene seasons? I have to be sure the trees will have enough time to decay their leaves during the fall-winter transition.

commented

3 subseasons where each subseasons takes 5 days = 15

commented

Excellent. Thank you. 15 days should be more than adequate.

I have a few more questions:

  • Do jungle biomes experience a fall-winter cycle? Seems strange to make the Jungle Trees lose their leaves.
  • Are jungle tree leaves being tinted with fall colors outside of their natural biome?

Edit: Oooo.. There's a wiki. That should cut down on my stupid questions. :)

commented

If you have any other questions or anything, feel free to swing by our Discord server (https://discord.gg/0loJvLMgvZi0q596). I love DT, and am happy to answer any questions or provide support or whatever it takes to have Serene Seasons support added, cause the two mods would seriously go perfect together.

Also, I recently changed sub-seasons to last 7 days each by default instead of 5 (5 just seemed a bit too short during my survival playthrough). Forgot to update that on the wiki :P

commented

Thanks, I probably will have questions. I think that my task more or less amounts to:

  • Dividing each tree into deciduous(loses leaves in winter) and other trees.
  • Make the updateTick destroy the deciduous leaves block if it's late fall or any winter.
  • Ensure deciduous branch blocks don't rot if unsupported during late fall or any winter.
  • Allow deciduous branch block to grow new leaves blocks like normal it it's not late fall or any winter.
  • Listen to the chunk load event to replace deciduous blocks with air during late fall-winter.
  • Listen to the chunk load event to fill deciduous trees with leaves if it's not late fall-winter.

Obviously these operations will be biome specific. We wouldn't want oak trees loosing leaves in a jungle biome during winter. I don't really understand what to do about perpetually cold biomes. Should those biomes be incapable of supporting deciduous trees at all? Should dynamic trees respect the greenhouse blocks?
The chunk load watching might create a lag problem if I have to do a block search and replace on each chunk load. Gonna have to give that some thought.

commented

Rather than using specific seasons/biomes it would make more sense to tie the growth/death of different trees to biome temperature (which drops during Serene Seasons' winter anyway) to make them more responsive to different environmental conditions. Biome temperature is also a vanilla mechanic, so it has more flexibility and compatibility with other mods.

So, for example, a jungle tree planted in ice plains would not grow at all since the biome temperature is always too low, a jungle tree planted in a forest might grow during the summer but die in the winter, but a jungle tree planted in a jungle would be able to grow year-round since the biome temperature would always be high enough. The minimum temperature needed to grow could be different for each tree. Potentially there could be a maximum temperature as well, so a spruce planted in a desert may not be able to grow, or die during a hot summer. Though as far as I know, SS currently has only colder winters, not hotter summers.

commented

For what it's worth now, +1 to Tough As Nails compatibility. Sorry for not breathing a word sooner ;)

commented

This is not going to make it into this release cycle because of the potential complexity involved. I'm hoping to get it in the next one.

commented

For seasons, if/when they are implemented, would it be possible to make not all trees lose their leaves in the winter? It'd be kind of weird to have evergreens go barren for instance.

commented

Of course. I always intended to divide deciduous from conifers when it came to the ability to lose leaves.

commented

I don't think the leaves should fall Durning winter, but instead their volume be reduced, kinda like as if a oak tree turned into ebony from BOP. and the remaining leaves turning dark, to match the colour of the wood (or a special block could be used). As deciduous trees loose only the leaves, but not the tiny branches and twigs that support them.

That would also lay the foundation for flowering trees like oak, BOP's sakura or harvestcraft's fruit trees to flower Durning the appropriate season and then make fruits.

(Edit) Also, there should be a potion that negates factors that cause the trees to die or stop growing in inadequate biomes, to help with decoration and such. (The one that stops the tree from changing would also work, but would stop all other things like seasonal change and growth too)

(Edit2) regarding the snowy branches, inspirations has a feature that makes carpets on top of stairs conform to their shape, you could use the same/very similar code

commented

Sidenote
Currently when the season turns cold in between growing, any fruit tree will be depleted of life before they can reach maturity.
2019-01-08_07 54 00

The current work around is to bonemeal the tree to restore its Life argument.

commented

Mushrooms should spawn more often under trees in autumn.

commented

Mushrooms should spawn more often under trees in autumn.

While this would be nice, I'm not sure if there's a distinct "autumn" with the way Seasons works (it works with temperatures). If it's possible, why not, but I'm pretty sure this has nothing to do with Dynamic Trees :) Make it a suggestion on the Seasons page maybe !

commented

I'm not sure if there's a distinct "autumn" with the way Seasons works (it works with temperatures)

There is. Our seasons have their own clock essentially that ticks up from 0 until whatever the max value is, so you can get the actual season from our API.

commented

Make apple trees in spring have flowers and in summer and autumn apples maybe make own apple leaves and wood so it wont look like an oak tree oh and maybe snowy textures for the branches so it would look like they have snow on them.
alte-baeume-deutschland-116 v-img__16__9__xl-d31c35f8186ebeb80b0cd843a7c267a0e0c81647

You should make it as an addon, cause if someone plays without sereneseasons mod this wouldn`t make sense.

commented

Regarding seasonal leaf coloring, will birch trees be attempted? Vanilla currently hardcodes birch's color so it stands out like a sore thumb when other trees redden in autumn.

commented

I just now added a way to override the dynamic leaves colors with a color provider(IBlockColor). If a mod overrides the static members in ColorProviders then they will get the expected result.

commented

I'll do my best to match whatever Serene Seasons does, using their methods if possible.

commented

It is/was going to get looked into there too. It's been an issue for a while. I imagine worst-case, it could be remedied with an optional replacement for birch leaf blocks that uses foliage.png like others do. If it came to that, would you still be interested?

commented

I think of all the things that need to happen the birch color is one of the most trivial.

commented

Btw @naqaden @Forstride .. It's not true that Mojang hardcodes the birch color. All one needs to do is this:

    Minecraft.getMinecraft().blockcolors.registerBlockColorHandler(new IBlockColor()
    {
        public int colorMultiplier(IBlockState state, @Nullable IBlockAccess worldIn, @Nullable BlockPos pos, int tintIndex)
        {
            BlockPlanks.EnumType plankstype = (BlockPlanks.EnumType)state.getValue(BlockOldLeaf.VARIANT);
            if (plankstype == BlockPlanks.EnumType.SPRUCE) {
                return ColorizerFoliage.getFoliageColorPine();
            }
            else if (plankstype == BlockPlanks.EnumType.BIRCH) {
                return MyColorizerFoliage.getCustomBirchColorizer(state, worldIn, pos, tintIndex); //<-- REPLACE THIS WITH YOUR OWN BIRCH COLOR PROVIDER
            }
            else {
                return worldIn != null && pos != null ? BiomeColorHelper.getFoliageColorAtPos(worldIn, pos) : ColorizerFoliage.getFoliageColorBasic();
            }
        }
    }, Blocks.LEAVES);

This will just write over the ColorHandler with a new one.

I recommend making the autumnal color be yellowish to set it apart from the oaks.

commented

Nice! Thanks for looking into this.

commented

I'm not sure if this warrants its own issue, but while the above code for birch leaf coloring worked out well for Serene Seasons, it stops working in combination with Dynamic Trees.

commented

That problem is fixed in DT dev.

commented

When will be available the season compatibility, i really want it, i have serene seasons i would like that leaves fall off it is kinda unreal for leaves to stay during winter. When will be released the new dynamic trees?

commented

or that trees disort when snow is on them

commented

I want it too. But human desire is infinite and my time is not. Besides, this is still in the conceptual stage since some of the implementation issues are not yet resolved. We can't code something we don't have a model for! :)

commented

@Simex242 tree distorting looks a bit too hard and/or pointless (vs the effort required) however something like snow actually piling on the branches etc, I have no idea if it's in a reasonable range for DT models and compatibility but it does sound lovely.

I'm very interested in DT & SS compatibility (well, integration) as well ! I hope, just as you do, that we can see this happen one of these days. Take the time it'll take, there's no rush, just here to tell another soul's interested in this ! Congrats for everything that DT went through by the way ๐Ÿ‘

commented

I'm also curious if there are any updates on this, as it's been some time.

commented

Is it personal reasons that are holding up this particular feature? (work, etc.)

Or is it really just too complicated to implement?

I mean if it is then I'd be okay with accepting that

But the fact that there hasn't been a whole lot said on the progress of it in over a year or so worries me slightly

commented

The update to 1.14 (and then 1.15) is more important than new features, at the time.

commented

Heck

commented

The update to 1.14 (and then 1.15) is more important for SkyHawkB. Personally, I couldn't care less about newer Minecraft versions. Providing seasons compatibility is still one of my goals. But my workload being what it is means that it might be some time before you see it.

commented

That's understandable,

Thank you for the reply though! I honestly didn't think I'd get a response from the original mod creator.

commented

Any word on this? Would really really love to see this <3

commented

I know this issue is old but I can't get around the problem of making the leaves appear and disappear depending on the season. But what I CAN do is make the tree not grow(or grow more slowly) in off-seasons. Would this be an acceptable compromise?

commented

Seems better than nothing.

commented

Adding onto this, you should add a system where devs can specify if a tree has any kind of seasonal changes in the first place. By default, it could just revert to standard patterns, to avoid screwiness.

commented

@ferreusveritas have you tried looking into it with @Forstride 's help ?
Your compromise is indeed better than nothing, this make a partial interaction which is nice enough already.
But the thing with the leave would be mind-blowing, I still have hopes for this.

Of course, I understand this takes time and efforts, which you may prefer redirect into something else rather than this and that would be perfectly understandable. But maybe someone working in similar projects could help look into this ?
Anyway, thanks a lot for at least trying to see if you could do it, that means a lot already, especially after showing a feature that brings in a gameplay change to show both mods interacts with each others.

Also, considering the branches are models that change with time this old suggestion of mine may not be possible but, I suggested in the past for snow to pile on branches, I wonder if that would be possible ? With my knowledge right now, I'd think it is not possible but you're the only boss here who can say whether it is possible or not ! (edit: I mean a visual change, not a physical one)

commented

In TerraFirmaCraft+ by Dunc, he has a similar system where trees are built out of these "special" blocks and they actually can drop their leaves in the fall and grow back in the spring.

Perhaps you can try to get in contact with him and see if you can do something similar?

commented

Just finished adding the base compatibility. So far Serene Seasons is the only mod this works with. Other adapters would be fairly trivial to make.

What's done:
-Works with Serene Seasons(only adapter created so far)
-Trees grow much more slowly in non-tropical biomes in winter and autumn
-Trees drop fewer seeds when it's not autumn(both voluntary and harvested)
-Trees produce much less fruit in non-tropical autumn and winter
-Tropical has is own set of growthrate, seed drop, and fruit production factors
-Season Managers and calculators can be easily overridden in the API
-Tree Species can override any of the above behaviors(none do at the moment)
-Out-of-the-box compatible with Pam's Harvestcraft Add-on and any other modded dynamic fruit trees

Here are the graphs that show the seasonal behavior:
https://docs.google.com/spreadsheets/d/17RDJ3T5ZPWuHy1_XVmu3MB-J1JHbGG-QjAuuRkEn2vI/edit?usp=sharing

The 4 trapezoids in each graph are the 4 seasons. The thick black line is the output factor from 0.0 -> 1.0.

commented

-Tree Species can override any of the above behaviors(none do at the moment)
Does this mean that trees can grow bigger or?
I am making my custom world and my town, im building the dynamic trees by myself and when i try to build for example a big oak tree i can't do it becuase when i build it the branches just start to dissapear, but with redwood tree its not possible you can make it huge, so does this mean that this is fixed or am i wrong here.

commented

@Simex242 No. That has nothing to do with this.

commented

Thank you all for the wonderful suggestions laid out here. This issue has served it's purpose and I'm finally closing it.
This is not the end for the expanding upon the seasons capability in Dynamic Trees. In the future I may:
-Make leaves whose model goes invisible and passable during winter(this solution has problems but they may be fixable)
-Snow on branches in the wintertime(if we can make the leaves disappear)

I think that the current implementation has powerful capabilities that can be overridden at a global level all the way down to the individual tree species. More to come!

commented

Thanks for the efforts put into this !
I think that a "0" seed drop for Temperate outside the boundaries of Autumn is a bit harsh but otherwise I feel the changes are really great and thematic.

commented

The seed drop is a special case where I added a little bit of overhead in the code so it's not zero. It's only zero in "outside of Autumn" for voluntary drops(the trees drop the seeds without player interaction). For harvesting the leaves and chopping down trees there's a 15% season chance added year round on top of the factor. I also a added code to make fortune enchantments make trees drop a few more seeds.
I'll be adjusting things here and there as the new feature progresses.

commented

@ferreusveritas For the sake of giving more eyes to the issue, could you expound a little bit on why seasonal leaf decay/growth is so tricky? I feel like it would really provide a lot of value to the integration. Is it just too expensive to be constantly deleting and re-growing leaves?

commented

The problem is that unloaded chunks won't be gradually losing their leaves. When you visit a chunk in the summer that you last visited in the winter they won't have any leaves. There will be a hard leaves line where the chunks were loaded vs unloaded.
It's not practical to fix this on a chunk load event because of the lag caused by trying to patch up an out of date chunk. We're considering using tricks with selectively invisible leaves blocks that seasonally change models and block boundaries. This can cause problems with fruit hanging in the air because of the aforementioned chunk load problem. You can't rely on waiting for the fruit to tick to remove itself. You'd also have to make the fruit invisible in the same way. It's such a rabbit hole that we'd never have any kind of season support if I tried to solve everything prior to releasing a partial yet serviceable solution. We might be able to overcome the problem and we might not. Until then at least we have pretty good season support even if it's not perfectly ideal.

commented

I absolutely agree that pretty good support is miles better than no support.

It's not practical to fix this on a chunk load event because of the lag caused by trying to patch up an out of date chunk.

So, just so I understand correctly, the problem isn't calculating what the leaves should be (which I assume would be trivial with the Seasons API); the problem is just placing/removing dozens of leaf blocks each time an old chunk is loaded back in?

commented

Yes. But in order to replace those 'dozens' (which sounds trivial) one would have to scan hundreds or potentially thousands of blocks on a chunk load.

commented

Is caching feasible?

commented

No, not really

commented

How about pretending that the tree is dying? Like the smallest branches die so the leaves fall off and in spring new fresh branches grow?

commented

The problem is that unloaded chunks won't be gradually losing their leaves.

commented

The problem is that unloaded chunks won't be gradually losing their leaves.

Well yeah i know but in SereneSeasons they have also problems with chunk laoding, but they needed to accept that only in loaded chunks there was no snow until it snowed(same with melting), but they did`t remove the snow because of that, so we could accept that only in loaded chunks trees have no leaves (its still a big area after all). There are players that often stay near their home so they will fully experience it.

commented

Pardon the necro, but I'd just like to add a new suggestion to the mix:
Instead of trying to instantly update old chunks (naturally causing a lot of lag), what if you instead simply speed up aging of the trees to catch up to the current season? This would even work for those using commands to alter the seasons; players would see the trees progress at an accelerated rate, losing their leaves and regaining them over the span of a few seconds, with any drops being disabled in the meantime (effectively counting as a "simulated" state to any fruits and such).

If this suggestion has any merit, I may bring it up with the Serene Seasons developers as well, since it could help alleviate the age-old chunk loading issue with out of season areas.

commented

players would see the trees progress at an accelerated rate, losing their leaves and regaining them over the span of a few seconds

I'm not an authority on the subject by any means, but I think this would be infeasible because blocks don't get ticked nearly frequently enough for that many updates in such a short period of time.

And even if they did, you'd still suffer from the original problem of too many block updates at once when loading lots of old chunks.

commented

What if instead of manually speeding up the tick rate, you increase the amount of season progression per tick? This would fix the issue of excess tick rate.

commented

Allow me to expand on my suggestion a little:
By my understanding, Minecraft currently has a random tick cycle that applies to any blocks that are marked as needing it. This effectively means any growing blocks will be "pinged" by the game normally. The dynamic nature of trees could simply make use of that to allow faster updates when out of season.
Additionally, to aid in the process of updating during tick cycles, the dynamic trees could have a state for each season, which is checked and updated by the random tick on their block. Not everything in a chunk would appear to update instantly (hence the few seconds as it appears gradual), in theory reducing the load while making use of a vanilla mechanic.

What I'm not sure about is why the Serene Seasons mod itself hasn't attempted something like this... the snow blocks could likely be given a faster melting rate when out of season.