How do I emulate plants having grown if an area is unloaded?

Post Reply
0siribix
Member
Posts: 123
Joined: Tue Nov 17, 2020 20:54
GitHub: 0siribix
In-game: 0siribix

How do I emulate plants having grown if an area is unloaded?

by 0siribix » Post

I want to have a farm grow even if the server unloads an area. I understand this isn't directly possible as ABMs won't work that way. But if I can track how long an area has been unloaded then I could speed up the ABM proportial to that. Alternatively, maybe a script that doesn't get unloaded can keep track of what changes would have been made and apply those changes once the area is loaded again?

The issue I have is public worlds with Ethereal have crystal farms everywhere and people staying logged in so that the crystal will spread. I know there are blocks to keep an area always loaded but I don't think this is practical if you have many users on the server.

User avatar
TenPlus1
Member
Posts: 3715
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: How do I emulate plants having grown if an area is unloaded?

by TenPlus1 » Post

Use Farming Redo, the crops will grow even when a player is away or offline :)

0siribix
Member
Posts: 123
Joined: Tue Nov 17, 2020 20:54
GitHub: 0siribix
In-game: 0siribix

Re: How do I emulate plants having grown if an area is unloaded?

by 0siribix » Post

TenPlus1 wrote:
Wed May 05, 2021 06:02
Use Farming Redo, the crops will grow even when a player is away or offline :)
So that only works for growing plants, right? Can we apply the same logic for grass spreading?

ShadMOrdre
Member
Posts: 1118
Joined: Mon Dec 29, 2014 08:07
Location: USA

Re: How do I emulate plants having grown if an area is unloaded?

by ShadMOrdre » Post

If you are using MTG, the default mod defines grass spread via an ABM.

Not sure how farming_redo handles plant growth, but node timers is the preferred method for any "growth".

Grass spread could just as easily be handled by a node timer, but MTG does not do this. Node timers are much newer than the original grass spread code in default.

You could write a mod that redefines grass to use node timers.

Shad

User avatar
TenPlus1
Member
Posts: 3715
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: How do I emulate plants having grown if an area is unloaded?

by TenPlus1 » Post

Spreading grass requires a map block to be loaded so it can check surrounding nodes, we do it in farming redo for crops by using time calculations.

0siribix
Member
Posts: 123
Joined: Tue Nov 17, 2020 20:54
GitHub: 0siribix
In-game: 0siribix

Re: How do I emulate plants having grown if an area is unloaded?

by 0siribix » Post

I bet we could apply the same logic to grass spreading. Might have to create a queue system though

0siribix
Member
Posts: 123
Joined: Tue Nov 17, 2020 20:54
GitHub: 0siribix
In-game: 0siribix

Re: How do I emulate plants having grown if an area is unloaded?

by 0siribix » Post

ShadMOrdre wrote:
Wed May 05, 2021 15:29
If you are using MTG, the default mod defines grass spread via an ABM.

Not sure how farming_redo handles plant growth, but node timers is the preferred method for any "growth".

Grass spread could just as easily be handled by a node timer, but MTG does not do this. Node timers are much newer than the original grass spread code in default.

You could write a mod that redefines grass to use node timers.

Shad
I totally missed this earlier. I'm looking into doing this now. TYVM

x2048
Developer
Posts: 68
Joined: Mon Feb 15, 2021 22:41
GitHub: x2048

Re: How do I emulate plants having grown if an area is unloaded?

by x2048 » Post

It this helps, ABMs compensate for the lost time by default. Read more here.

0siribix
Member
Posts: 123
Joined: Tue Nov 17, 2020 20:54
GitHub: 0siribix
In-game: 0siribix

Re: How do I emulate plants having grown if an area is unloaded?

by 0siribix » Post

x2048 wrote:
Sat May 08, 2021 23:27
It this helps, ABMs compensate for the lost time by default. Read more here.
That changes everything. All I have to do is turn on catch_up for the Grass Spread ABM. I wonder how much this will impact performance? I would expect it to only affect areas that are re-loaded. Meaning it shouldn't "catch up" if the area has never been loaded before.

I'm so glad you brought this up, TY

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests