[Mod] Farming Redo [1.23] [farming]

prestidigitator
Member
 
Posts: 632
Joined: Thu Feb 21, 2013 23:54

Re: [Mod] Farming Redo [1.14] [farming]

by prestidigitator » Mon May 18, 2015 21:34

(Oops. Nevermind. For some reason Don's post showed at first, but the post he was responding to didn't.)
 

prestidigitator
Member
 
Posts: 632
Joined: Thu Feb 21, 2013 23:54

Re: [Mod] Farming Redo [1.14] [farming]

by prestidigitator » Tue May 19, 2015 00:29

Okay, so I have a partial and slightly more satisfying answer. I did some very careful testing, and to do so I separated the logic of the update code from the final call to minetest.set_node(), and I did this for both the new timer method and the standard ABM. I decided to test both throughout the lifetime of my 16x16 test wheat field (even though theoretically the standard ABM should perform the same throughout), and test while being present throughout the entire lifetime or leaving for the first few stages of it. Here is what I found:

  • Both sets of logic perform about the same. The standard logic and the timer-based logic typically execute in the approximate range 8-12µs per call.
  • The standard ABM call to minetest.set_node() takes about 10µs in the beginning.
  • The timer-based call to minetest.set_node() takes about 20µs in the beginning. Switching to minetest.swap_node() which doesn't reset metadata or check for construct/destruct callbacks reduces this by about 5µs (didn't try this with the standard ABM).
  • Leaving for part of the lifecycle and coming back does not significantly affect either implementation. In fact, the timer-based logic tends to run at its maximum performance of about 7µs per call when you return (it does execute more frequently for a short period though, as the timers of all the nodes catch up; this can then be made up for later because there are that many fewer growth stages left to do). It also doesn't seem to adversely affect minetest.set_node(); the impact on that is somewhat independent of player presence or absence, and is instead affected by...
  • The performance of all code, but of minetest.set_node() in particular, drops over the lifetime of the plants. This is true for both the standard ABM and for the timer-based implementation. When most plants are fully grown (say, 1400+ growth stages out of 1792 for my 16x16 test wheat field), the standard ABM can easily take 40µs or more per call including both the logic and minetest.set_node(), and the timer-based implementation can easily take 50µs or more.

Why the minetest.set_node() call take different times from the ABM vs. the timer, why it slows down over time/number of calls or the reduction of the frequency of calls due to fewer plants still growing, and whether it's the active time of the map node or the number of node replacements or what, are still mysteries. But these results are promising for the viability of updates while absent, at least compared to simple ABM updates, even though they are not very flattering to the game logic of the Minetest engine.

I may go back and use the same testing methodology to characterize the metadata-based ABM, now that I understand at least roughly what is causing the slowdown, and that it is not necessarily related to the plant update logic.
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Farming Redo [1.14] [farming]

by Kilarin » Tue May 19, 2015 01:25

prestidigitator wrote:Why the minetest.set_node() call take different times from the ABM vs. the timer, why it slows down over time/number of calls or the reduction of the frequency of calls due to fewer plants still growing, and whether it's the active time of the map node or the number of node replacements or what, are still mysteries.

Does this need to be opened as a bug report for minetest?
 

prestidigitator
Member
 
Posts: 632
Joined: Thu Feb 21, 2013 23:54

Re: [Mod] Farming Redo [1.14] [farming]

by prestidigitator » Tue May 19, 2015 04:25

Kilarin wrote:Does this need to be opened as a bug report for minetest?

Don't know. I suppose it could be due to some kind of memory leak or something, which would qualify as a bug. But it could also be an inefficient datastructure or some property of the Lua interpreter. While it's possible performance could be enhanced if that's the case, it probably doesn't really count as a bug. Still, I suppose it wouldn't hurt to try, if someone wants to report it. It's possible a dev might feel like investigating the behavior....
 

prestidigitator
Member
 
Posts: 632
Joined: Thu Feb 21, 2013 23:54

Re: [Mod] Farming Redo [1.14] [farming]

by prestidigitator » Tue May 19, 2015 10:25

I've committed the timer-based implementation and done a pretty good amount of testing. I believe it might be ready to pull/integrate. TenPlus1, if you could take another look at it and possibly test again on your server, I'd appreciate it. Below is a description of the final test I ran to compare this to the existing code.

Test Procedure

  1. Setup: Clear the test map block, its immediate neighbors, and all blocks in a vertical column from those upward of plants. Create a 16x16 floor of wet dirt within the test block. Remove all "artificial" lighting so only the sun affects plants in the area. In init.lua, turn on (uncomment) "farming.DEBUG = {}".
  2. Test Start: Set the time of day to the current trial's "start time" using the "/time" command. Instantaneously clear and then set all nodes above the wet dirt floor to "farming:wheat_1" (I did this using the luacmd mod). Also clear statistics using farming.DEBUG.reset_times().
  3. Wait for the current trial's listed "present" percent of a plant's average lifespan.
  4. Using fast move, fly straight up until at least two map blocks higher than the plants (first time, confirm you are high enough by verifying that farming.DEBUG.report_times() doesn't change).
  5. Wait until twice a plant's average lifespan has passed since the start of the test. (Almost) all growth should theoretically be complete at this point (for the timer-based solution).
  6. Test End: Descend to the level of the plants, and repeatedly call farming.DEBUG.report_times() until it doesn't change over the period of at least 3 average growth stage lengths. This indicates the plants are done growing, the test is complete, and the reported times are correct for the trial.

I also set the average growth stage length to 20 seconds for this test (by setting the ABM interval to 10 for the ABM-based solution and STAGE_LENGTH_AVG to 20 for the timer-based solution). This fit the maximum lifespan of the plants into a single daylight period and made the length of each trial tolerable (around 4-6 minutes).

Data

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
------------------------------------------------------------------------------------------------
|                      ||           Standard ABM           ||            Timers                |
| Present | Start Time || Time (ms) | Runs | Time/run (µs) || Time (ms) | Runs | Time/run (µs) |
+---------+------------++-----------+------+---------------++-----------+------+---------------+
|  100%   |   10000    ||   43.9    | 1792 |     24.5      ||   64.5    | 1792 |     36.0      |
|   75%   |   10000    ||   45.0    | 1792 |     25.1      ||   40.1    | 1407 |     28.5      |
|   50%   |   10000    ||   44.7    | 1792 |     24.9      ||   30.8    | 1023 |     30.1      |
|   25%   |   10000    ||   46.3    | 1792 |     25.8      ||   17.9    |  570 |     31.4      |
|    0%   |   10000    ||   47.2    | 1792 |     26.3      ||    9.6    |  264 |     36.3      |
|  100%   |    4000    ||   53.1    | 2950 |     18.0      ||   64.0    | 2922 |     21.9      |
|   75%   |    4000    ||   54.4    | 3091 |     17.6      ||   28.4    | 1596 |     17.8      |
|   50%   |    4000    ||   47.9    | 2676 |     17.9      ||   12.9    |  977 |     13.2      |
|   25%   |    4000    ||   47.0    | 2293 |     20.5      ||    9.4    |  580 |     16.2      |
|    0%   |    4000    ||   43.1    | 1792 |     24.1      ||    8.6    |  256 |     33.6      |
------------------------------------------------------------------------------------------------


  • Present: The percent of average plant lifetime the player remains present until departing the area.
  • Start Time: The time-of-day set using the "/time" command at the start of the test.
  • Standard ABM: Data collected while running the standard, existing Farming Redo ABM-based updates (from commit e1df7aa).
  • Timers: Data collected while running the new, timer-based updates.
  • Time (ms): Total execution time of the (ABM or timer) update method call, added across all runs from test start to test end.
  • Runs: The number of times the (ABM or timer) update method was called, from test start to test end.
  • Time/run (µs): The time one (ABM or timer) update method took to execute, averaged over all runs from test start to test end.

Analysis/Conclusion

The timer-based solution is about 50% slower than the ABM-based solution while plants are growing (in sufficient light) and while the player is present. For 256 growing plants this comes to about 20 extra milliseconds of total server time spread across their entire lifespans (at least on the machine I used to test it). For all other test scenarios, the timer-based solution is either roughly equal to or faster when considering server execution time as a resource.

The timer-based solution also allows plants to grow while the player is away from the area. In fact, it's more efficient that way. This should encourage players to engage in other activities while the plants grow.

Finally, the timer-based solution spreads growth out in a continuous pattern. Instead of half of the plants in an area suddenly all advancing in unison, a plant or two will grow by a single stage every once in a while. This not only provides a more "organic" feel to watching the grass grow, but spreads the execution of the update method out so it frequently takes a small amount of time instead of infrequently taking lots of time. This should, in general, be good for server lag. There is one case when all timers will execute at once in a batch: when a map block is activated and timers have to catch up to the amount of time that has elapsed (ABMs seem to do a similar thing, ignoring their normal statistical chance of execution). If the elapsed time includes periods of sufficient light for plant growth, the implementation should make up for this extra time with fewer growth stages later.
 

ronnietucker
New member
 
Posts: 7
Joined: Mon May 18, 2015 20:37

Re: [Mod] Farming Redo [1.14] [farming]

by ronnietucker » Tue May 19, 2015 17:45

Don wrote:If its a map chunk that you want to regent do
/deleteblocks here.

This will regenerate the chunk and plants should grow.
Do not do it in areas that have thing built.


Thanks for the reply.

Roughly how far from built stuff should I be before doing the /deleteblocks ?

I've only really built in one area, but I'd like to keep that area if possible.
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: [Mod] Farming Redo [1.14] [farming]

by Don » Tue May 19, 2015 18:02

I am pretty sure a map chunk is 80 nodes each way. If you test it in an area far enough away from buildings then you should be able to see.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

ronnietucker
New member
 
Posts: 7
Joined: Mon May 18, 2015 20:37

Re: [Mod] Farming Redo [1.14] [farming]

by ronnietucker » Tue May 19, 2015 18:35

Don wrote:I am pretty sure a map chunk is 80 nodes each way. If you test it in an area far enough away from buildings then you should be able to see.


Turns out you can choose the area by doing something like:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
/deleteblocks (-83,15,-51) (-150,14,-113)


Thanks!
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Farming Redo [1.20] [farming]

by TenPlus1 » Wed May 20, 2015 09:26

A brand new farming routine has been added with the hard work from prestidigitator that allows crops to grow even when the player is far away from his/her farm...
Last edited by TenPlus1 on Wed Mar 09, 2016 13:22, edited 1 time in total.
 

prestidigitator
Member
 
Posts: 632
Joined: Thu Feb 21, 2013 23:54

Re: [Mod] Farming Redo [1.20] [farming]

by prestidigitator » Wed May 20, 2015 09:50

TenPlus1 wrote:A brand new farming routine has been added with the hard word from prestidigitator which allows crops to grow even when the player is far away from his/her farm...

Cool. It's a great mod. Thanks for giving me the opportunity to contribute.
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Farming Redo [1.20] [farming]

by TenPlus1 » Wed May 20, 2015 10:08

Hopefully I'll be adding it to Xanadu server later today for full testing with a playerbase...
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Farming Redo [1.20] [farming]

by Kilarin » Wed May 20, 2015 12:04

TenPlus1 wrote:A brand new farming routine has been added with the hard word from prestidigitator

Huzzah!!!!

And thank you BOTH very much!
 

User avatar
cHyper
Member
 
Posts: 587
Joined: Fri May 06, 2011 08:49
IRC: cHyper
In-game: cHyper

Re: [Mod] Farming Redo [1.20] [farming]

by cHyper » Sun Jul 12, 2015 22:52

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
00:50:48: ERROR[main]: ========== ERROR FROM LUA ===========
00:50:48: ERROR[main]: Failed to load and run script from
00:50:48: ERROR[main]: C:\Users\chyper\Documents\minetest\win64\bin\..\games\cHy
per\mods\farming\init.lua:
00:50:48: ERROR[main]: ...etest\win64\bin\..\games\cHyper\mods\farming/pumpkin.l
ua:78: attempt to perform arithmetic on field 'LIGHT_MAX' (a nil value)
00:50:48: ERROR[main]: stack traceback:
00:50:48: ERROR[main]:  ...etest\win64\bin\..\games\cHyper\mods\farming/pumpkin.
lua:78: in main chunk
00:50:48: ERROR[main]:  [C]: in function 'dofile'
00:50:48: ERROR[main]:  ...minetest\win64\bin\..\games\cHyper\mods\farming\init.
lua:61: in main chunk
00:50:48: ERROR[main]: ======= END OF ERROR FROM LUA ========
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Farming Redo [1.20] [farming]

by TenPlus1 » Mon Jul 13, 2015 19:29

cHyper: Farming Redo runs fine and has been tailored to run on Minetest 0.4.12 and above, so please double-check which version of Minetest you are running and also use the latest Farming Redo...
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Farming Redo [1.20b] [farming]

by TenPlus1 » Wed Aug 26, 2015 14:10

Farming Redo 1.20b now works with Minetest 0.4.13 changes...
 

User avatar
Silwncer
Member
 
Posts: 89
Joined: Tue Jun 23, 2015 14:45

Re: [Mod] Farming Redo [1.20b] [farming]

by Silwncer » Thu Aug 27, 2015 16:30

Do i need mod for that armor ?
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Farming Redo [1.21] [farming]

by TenPlus1 » Sat Aug 29, 2015 08:37

Version 1.21 out today with a new auto-refill feature for when you are planting crops... Thanks crabman77 :)
 

zzantozz
Member
 
Posts: 31
Joined: Sun Sep 06, 2015 23:54

Re: [Mod] Farming Redo [1.21] [farming]

by zzantozz » Mon Sep 07, 2015 00:04

I wanted to try this out, but it's crashing in the init script. I'm on Ubuntu with minetest 0.4.11. I started a new minetest (not minimal) world with the v6 generator, and when I enable it, it fails to start with the below message. I'm pretty new to minetest. Is it ok to load a mod that conflicts with the name of an existing one like this, especially a built-in one? Should I be building from a minimal world instead?

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
18:56:21: ACTION[main]: WARNING: Mod name conflict detected: "farming"
18:56:21: ACTION[main]: Will not load: /usr/share/games/minetest/games/minetest_game/mods/farming
18:56:21: ACTION[main]: Overridden by: /home/ryan/.minetest/mods/farming
18:56:21: ERROR[main]: ========== ERROR FROM LUA ===========
18:56:21: ERROR[main]: Failed to load and run script from
18:56:21: ERROR[main]: /home/ryan/.minetest/mods/farming/init.lua:
18:56:21: ERROR[main]: /home/ryan/.minetest/mods/farming/pumpkin.lua:78: attempt to perform arithmetic on field 'LIGHT_MAX' (a nil value)
18:56:21: ERROR[main]: stack traceback:
18:56:21: ERROR[main]:    /home/ryan/.minetest/mods/farming/pumpkin.lua:78: in main chunk
18:56:21: ERROR[main]:    [C]: in function 'dofile'
18:56:21: ERROR[main]:    /home/ryan/.minetest/mods/farming/init.lua:62: in main chunk
18:56:21: ERROR[main]: ======= END OF ERROR FROM LUA ========
18:56:21: ERROR[main]: Server: Failed to load and run /home/ryan/.minetest/mods/farming/init.lua
18:56:21: ERROR[main]: ModError: ModError: Failed to load and run /home/ryan/.minetest/mods/farming/init.lua
 

User avatar
benrob0329
Member
 
Posts: 1192
Joined: Thu Aug 06, 2015 22:39
GitHub: Benrob0329
In-game: benrob03

Re: [Mod] Farming Redo [1.21] [farming]

by benrob0329 » Mon Sep 07, 2015 00:15

I'm pretty sure you need to use a vertion of MT 0.4.12+ (.13 is better) which can be obtained via the Minetest Stable PPA (check the download page on minetest.net)
 

zzantozz
Member
 
Posts: 31
Joined: Sun Sep 06, 2015 23:54

Re: [Mod] Farming Redo [1.21] [farming]

by zzantozz » Mon Sep 07, 2015 00:17

benrob0329 wrote:I'm pretty sure you need to use a vertion of MT 0.4.12+ (.13 is better) which can be obtained via the Minetest Stable PPA (check the download page on minetest.net)

I shall give that a try. Thanks for the quick reply!
 

zzantozz
Member
 
Posts: 31
Joined: Sun Sep 06, 2015 23:54

Re: [Mod] Farming Redo [1.21] [farming]

by zzantozz » Mon Sep 07, 2015 00:26

I got 0.4.13 from the PPA, and it works fine. Thanks again. It might be good to mention the version requirement in the top post. Many of the mods seem to do that.
 

User avatar
Echoes91
Member
 
Posts: 67
Joined: Thu Feb 19, 2015 13:21
In-game: Echoes

Re: [Mod] Farming Redo [1.21] [farming]

by Echoes91 » Wed Sep 23, 2015 10:57

May I ask why this mod still uses the old textures for wheat and seeds?
I think that the default ones have quite improved.
"It wasn't easy to break so many functions by editing a single line"
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Farming Redo [1.21] [farming]

by TenPlus1 » Wed Sep 23, 2015 13:32

Thanks for letting me know echoes91, will update the mod textures with those of the default game...
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Farming Redo [1.22] [farming]

by TenPlus1 » Mon Oct 26, 2015 11:28

Updated to version 1.22, added Grapes and Trellis to grow them on (craft trellis with 9 sticks). Wild grape bushels are found at higher climates.
 

User avatar
cessna151
Member
 
Posts: 34
Joined: Thu Sep 24, 2015 20:36
In-game: cessna151

Re: [Mod] Farming Redo [1.22] [farming]

by cessna151 » Sun Nov 15, 2015 20:53

Does anyone have a recipe/cook list for this mod?
---Eagles may soar high, but weasels don't get sucked into jet engines!---
 

User avatar
ufa
Member
 
Posts: 49
Joined: Mon Feb 27, 2012 14:19

Re: [Mod] Farming Redo [1.22] [farming]

by ufa » Fri Jan 08, 2016 13:30

I saw that this mod have the same directory name as the original mod (farming). Is it supposed to superseed it? Or should I rename and keep 2 farming directories?
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: [Mod] Farming Redo [1.22] [farming]

by Don » Fri Jan 08, 2016 14:14

ufa wrote:I saw that this mod have the same directory name as the original mod (farming). Is it supposed to superseed it? Or should I rename and keep 2 farming directories?

Keep the name "farming". It will work fine with the default farming mod.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Farming Redo [1.22] [farming]

by TenPlus1 » Fri Jan 08, 2016 18:25

Keep the directory as 'farming' as it replaces the default farming with farming redo.
 

redblade7
Member
 
Posts: 101
Joined: Sun Feb 15, 2015 07:14
IRC: redblade7 redblade bleakfire
In-game: redblade7

Re: [Mod] Farming Redo [1.22] [farming]

by redblade7 » Sun Feb 07, 2016 03:51

I can't get cotton seeds to go past Stage 1, it's been half an Earth day and I've planted them in a lot of places, hoeing the ground first (they become extremely hard to see as the regular green dirt takes over and the cotton plant does not grow).
-redblade7
Admin of:

* THE CREATIVE GARDENS (Creative Mode server)
* THE VALLEYS (Sandbox Server)
* THE DIGITAL FARMS (Pizza-like server with protection and emphasis on farming)
 

User avatar
firefox
Member
 
Posts: 1185
Joined: Wed Jan 14, 2015 07:34
In-game: Red_Fox

Re: [Mod] Farming Redo [1.22] [farming]

by firefox » Sun Feb 07, 2016 09:05

redblade7 wrote:I can't get cotton seeds to go past Stage 1, it's been half an Earth day and I've planted them in a lot of places, hoeing the ground first (they become extremely hard to see as the regular green dirt takes over and the cotton plant does not grow).

do you also have a water source near them?
all plants do not only need soil, but also water.

without water they won't grow and eventually the soil will dry, revert to normal dirt and grow grass.
 

PreviousNext

Return to Mod Releases

Who is online

Users browsing this forum: No registered users and 8 guests

cron