Crops only grow if they're in loaded chunks. Why? That makes no sense to me. Just because time doesn't pass in unloaded chunks doesn't mean you can't simulate the passage of time by applying lots of changes instantaneously.
I suggest giving each chunk a timestamp that records when it was last unloaded. Then when the chunk is loaded again compare the chunk's timestamp to the current game time (measured from when the world was created), then apply the appropriate changes.
For example, let's say your wheat farm in a chunk becomes unloaded. A timestamp records the time. You go somewhere else in the world for three hours. When you return and reload the chunk the game notes that three hours have passed, then applies three hours of growth to the farm instantaneously.
This same type of principle could apply to animal growth, smelting, pretty much anything that operates on a straightforward time delay.
This could cause some serious lag... unless... each chunk update was separated by a safe amount of tics, to prevent a flood of information. Likewise, this updating method should have a cap to it, like, at most 2 minutes or so of update time, or like 500 or so updates. This would prevent loading chunks that have not previously been loaded in weeks, which would in itself crash the server/client or severely lag it.
This could cause some serious lag... unless... each chunk update was separated by a safe amount of tics, to prevent a flood of information. Likewise, this updating method should have a cap to it, like, at most 2 minutes or so of update time, or like 500 or so updates. This would prevent loading chunks that have not previously been loaded in weeks, which would in itself crash the server/client or severely lag it.
Why would it need to update one tick at a time? Just have it calculate that so much time means so much growth.
I agree with Twister1134. I like the idea, but it would create a ton of lag on servers and can possibly crash the server just from farms. If there was a way to stop that lag, I totally agree with this.
Why would it need to update one tick at a time? Just have it calculate that so much time means so much growth.
The more chunk updates you have at once, the slower it gets. Trust me on this. If you increased the amount of chunks updated per frame, it would start to lag the more it loaded at once. Even at small numbers, like 5 updates at once (highest OptiFine setting for multi chunk loading per frame), it could become a problem. So having even a single frame that updates about 5000 times could crash the client/server.
You actually have to know how chunk updates work. it is kinda hard to explain, so google it.
I really don't understand why people think this would cause massive lag. It stores information same as block and mob locations already are, then it just calculates how big to grow crops or how many items to smelt depending of time passed. It's not like he's suggesting all chunks you've ever been to stay loaded forever.
True, but you must understand that crop growth is randomly determined by chunk updates, not by a set amount of time. One crop could grow almost instantly, while another could take days.
These instantaneous updates could work on a percentage system instead of using lots of individual block updates. For example, after X passage of time each wheat block would have a 40% percent chance of being loaded one stage further in growth, a 20% chance of being two stages further in growth, a chance of not having grown at all, etc. So that's just one update per block of wheat, not dozens or hundreds.
It might cause momentary lag for a giant wheat farm with thousands and thousands of plants. But it's a one time brief moment of lag, not like a redstone lag machine that keeps operating. And that lag means that your giant wheat farm can actually function instead of do nothing.
Also, chunks load when they're still relatively distant from the player. So you don't need to apply updates to all of them at once. You could do them in some kind of sequence that's still fast enough to apply a change to everything before the player gets close.
Totally agree with you, find it annoying when im mining for an hour and i come back and my crops havnt grown.
But this should not cuase any lag. All it does it takes a timestap and when the chunk is about to be loaded it checks the timestamp and updates the wheat plants. The updating wheat plants would not cuase any lag becuase the chunk is also replacing all the blocks from bedrock all the way up normally, a few wheat wouldnt make a difference.
Sorry if im wrong what im talking about.
I support this idea. I don't see how it could cause unacceptable lag if implemented correctly.
By "correctly" I mean when a chunk is reloaded, it doesn't use chunk updates to catch up with growth and furnaces but instead uses a single update.
As the OP said, record the game time in a chunk when it's unloaded, then when it's reloaded check how much game time has passed and do a quick update (NOT chunk updates) to make progressive items like growth and furnaces "catch up with" the rest of the game.
The quick update doesn't have to work exactly like the chunk updates. So long as the update allows growth and furnaces to at least simulate catching up with the rest of the game, that's all we need.
I suggest giving each chunk a timestamp that records when it was last unloaded. Then when the chunk is loaded again compare the chunk's timestamp to the current game time (measured from when the world was created), then apply the appropriate changes.
For example, let's say your wheat farm in a chunk becomes unloaded. A timestamp records the time. You go somewhere else in the world for three hours. When you return and reload the chunk the game notes that three hours have passed, then applies three hours of growth to the farm instantaneously.
This same type of principle could apply to animal growth, smelting, pretty much anything that operates on a straightforward time delay.
-
View User Profile
-
View Posts
-
Send Message
Retired Staff-
View User Profile
-
View Posts
-
Send Message
Retired StaffWhy would it need to update one tick at a time? Just have it calculate that so much time means so much growth.
The more chunk updates you have at once, the slower it gets. Trust me on this. If you increased the amount of chunks updated per frame, it would start to lag the more it loaded at once. Even at small numbers, like 5 updates at once (highest OptiFine setting for multi chunk loading per frame), it could become a problem. So having even a single frame that updates about 5000 times could crash the client/server.
You actually have to know how chunk updates work. it is kinda hard to explain, so google it.
-
View User Profile
-
View Posts
-
Send Message
Retired StaffIt might cause momentary lag for a giant wheat farm with thousands and thousands of plants. But it's a one time brief moment of lag, not like a redstone lag machine that keeps operating. And that lag means that your giant wheat farm can actually function instead of do nothing.
But this should not cuase any lag. All it does it takes a timestap and when the chunk is about to be loaded it checks the timestamp and updates the wheat plants. The updating wheat plants would not cuase any lag becuase the chunk is also replacing all the blocks from bedrock all the way up normally, a few wheat wouldnt make a difference.
Sorry if im wrong what im talking about.
By "correctly" I mean when a chunk is reloaded, it doesn't use chunk updates to catch up with growth and furnaces but instead uses a single update.
As the OP said, record the game time in a chunk when it's unloaded, then when it's reloaded check how much game time has passed and do a quick update (NOT chunk updates) to make progressive items like growth and furnaces "catch up with" the rest of the game.
The quick update doesn't have to work exactly like the chunk updates. So long as the update allows growth and furnaces to at least simulate catching up with the rest of the game, that's all we need.