Page 1 of 1
Update world in intervals

Posted:
Mon May 18, 2015 14:43
by lightonflux
If you play on an online server you are certainly do some farming. The problem is that minetest at the moment only updates chunks where a player is. So if nobody is on the field, your crop does not grow.
There are some mods, like the update anchors, but those introduce other problems and update a certain area all the time.
I think MT core needs a feature that updates the world in intervals if the load of the server is low (so playing players are not disturbed because of lag or similar problems).
If a server has this feature activated, a player could plant something and it grows when nobody is in the map block/chunk.
Not sure how efficient that is, but maybe we could introduce a class (non-player-update) for mods to assign, so the server does not waste cycles on mods that only make sense when interacting with the player. Like hostile mobs or carts.
Re: Update world in intervals

Posted:
Mon May 18, 2015 15:51
by LionsDen
That would likely be difficult to do as it would require part of the minetest program itself to be rewritten. An easier thing might be to change the farming lua code to put the date and time of planting in a plant so when a player wanders into the area that contains the plant, it checks it with an ABM and then updates it to what it should be at that point in time. While still having some work to do, I think this would likely be easier than changing the minetest program.
Re: Update world in intervals

Posted:
Mon May 18, 2015 15:53
by Krock
You don't know how much time and memory it takes to load every chunk/mapblock and run all ABMs.
I'm happy with the current situation, use a similar function like the time-based furnace.
Re: Update world in intervals

Posted:
Mon May 18, 2015 16:25
by prestidigitator
LionsDen wrote:That would likely be difficult to do as it would require part of the minetest program itself to be rewritten. An easier thing might be to change the farming lua code to put the date and time of planting in a plant so when a player wanders into the area that contains the plant, it checks it with an ABM and then updates it to what it should be at that point in time. While still having some work to do, I think this would likely be easier than changing the minetest program.
I've been doing exactly that. See the discussion/explanation in the
Farming Redo mod thread. I'm running into somewhat horrendous issues with performance/profiling, unfortunately.
Re: Update world in intervals

Posted:
Tue May 19, 2015 11:31
by prestidigitator
Well, I think I've managed to resolve the questions/issues with performance. Gotta say, I like node timers rather than ABMs for plant growth. They allow you to spread things out a lot more, so individual plants grow from time to time rather than whole batches of them updating in lock-step. Anyway, hopefully TenPlus1 likes the changes for the Farming Redo mod.
I've discovered one thing that I might possibly create a pull request for in the main engine. There's absolutely no way to determine what a node timer's period was from the node timer callback itself (it's not passed as a parameter, and if you call timer:get_timeout() inside the callback itself it'll return 0, indicating the timer is already deactivated). This is unfortunate for mods that set the period differently on a node-by-node basis, rather than always using the same timeout for all nodes of a particular type. My solution would be to add a second parameter to the callback that holds the timeout period, and optional second and third return values for a new timeout and elapsed time value for the next execution (defaulting to the old timeout and 0 elapsed time). This would be backwards compatible for old mods, because you can both ignore extra parameters in your function prototype and expect extra return values from a function call (they become nil, which would mean use default values).
Re: Update world in intervals

Posted:
Wed May 20, 2015 09:10
by prestidigitator
prestidigitator wrote:I've discovered one thing that I might possibly create a pull request for in the main engine....
Oh wow. Nevermind. In reviewing the
code guidelines for the core for possibly submitting a 5-10 line change, I ran into a reminder of what a
charming,
competent, and
mature community of developers you have to get in bed with if you want to touch the game engine. One such endearing individual was so threatened by a single change I proposed that he explicitly immortalized me in the code guidelines (in a section that basically says don't bother to do any software design or produce quality code, because all they want is dirty hacked together programming), and he's apparently been mentioning me on and off for two years since, nonetheless!
I'm flattered by the attention, and honestly grateful to be reminded that the modding community is the only thing worth coming back for. I wonder if Minecraft has finally published their official API. I know a certain community of modders that deserve far better than they'll ever get here.
Re: Update world in intervals

Posted:
Wed May 20, 2015 09:13
by rubenwardy
It seems logical, except the "feel horrible about yourself"
I've had mostly a good experience submitting patches for the engine (although it takes a while, and you have to a lot of chasing up.)
EDIT: I've removed those comments, it was incredibly rude of hmmmm to add those. Please don't be dissuaded just because of him.
Re: Update world in intervals

Posted:
Wed May 20, 2015 09:29
by prestidigitator
rubenwardy wrote:I've removed those comments, it was incredibly rude of hmmmm to add those. Please don't be dissuaded just because of him.
Well thank you. It's nice to see not everyone falls in line with that kind of immature nonsense, Honestly, though, he's furnished
two years worth of poison that says there's no point in trying to deal with this particular set of developers, at least from my end. Glad you've had a better experience.
Re: Update world in intervals

Posted:
Thu May 21, 2015 16:31
by Sokomine
prestidigitator wrote:rubenwardy wrote:I've removed those comments, it was incredibly rude of hmmmm to add those. Please don't be dissuaded just because of him.
Well thank you. It's nice to see not everyone falls in line with that kind of immature nonsense, Honestly, though, he's furnished two years worth of poison that says there's no point in trying to deal with this particular set of developers, at least from my end. Glad you've had a better experience.
There are other devs out there as well. I'm sure you can find some with whom talking is a lot easier. Hmmmm is a very competent programmer and very intelligent human beeing, but he is also incapable of handling human interaction really well. Talk to him if you have a very complex technical problem and do need input on that. Use another dev as mediator if possible. That may help in fact both sides - hmmmm gets told the core of the problem, translated to terms the devs use amongst themshelves - while you get shielded from hmmm's lack of understanding that other humans have emotions as well and may feel hurt - and that that's bad. I'm pretty sure he didn't intend to hurt you deliberately, or even understood that his behaviour was not acceptable. I'm very glad for what hmmmm contributes - most of my own work (i.e. mg_villages) wouldn't be possible without what he created - but it's nontheless difficult to talk to him - for both sides. I'm afraid I bore him most of the time because he's more intelligent. Also, friendlieness seems to be seen as a waste of prescious time, while it would be possible to talk about more intresting technical problems :-)