ABM works unstable/incorrect

User avatar
bosapara
Member
 
Posts: 360
Joined: Fri Apr 07, 2017 08:49
GitHub: bosapara
In-game: Jozet

ABM works unstable/incorrect

by bosapara » Mon Sep 24, 2018 02:09

A lot of people already talked about this but no one dared to write

abm works unstable/incorrect, ive checked at servers with 30 players and 5 players, without lags, the same. It works wrong (at single it works)

Instead 5 sec of signal - we have 10, 15 or even 30 seconds (by random)

Any idea how to fix it?

Image
 

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

Re: ABM works unstable/incorrect

by firefox » Mon Sep 24, 2018 07:18

and what abm is that?
my game: viewtopic.php?f=49&t=15860 --- building inspiration: viewtopic.php?f=3&t=15550 --- =(^.^)= nya~
 

User avatar
bosapara
Member
 
Posts: 360
Joined: Fri Apr 07, 2017 08:49
GitHub: bosapara
In-game: Jozet
 

User avatar
Pyrollo
Member
 
Posts: 139
Joined: Mon Jan 08, 2018 15:14
Location: Paris
GitHub: pyrollo
In-game: Naj

Re: ABM works unstable/incorrect

by Pyrollo » Mon Sep 24, 2018 07:37

Yes but can you give the definition of your ABM ? Usually it works.
 

User avatar
bosapara
Member
 
Posts: 360
Joined: Fri Apr 07, 2017 08:49
GitHub: bosapara
In-game: Jozet

Re: ABM works unstable/incorrect

by bosapara » Mon Sep 24, 2018 09:28

Pyrollo wrote:Yes but can you give the definition of your ABM ? Usually it works.


Im here to report about problem, isn't about giving definition to you.
 

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

Re: ABM works unstable/incorrect

by firefox » Mon Sep 24, 2018 10:07

bosapara wrote:
Pyrollo wrote:Yes but can you give the definition of your ABM ? Usually it works.


Im here to report about problem, isn't about giving definition to you.

so you did. and what shall we do now?

abms work fine in singleplayer and multiplayer, no problems detected.
so it have something to do with the specific abm you are using.
so which abm is it exactly? we need the code.
my game: viewtopic.php?f=49&t=15860 --- building inspiration: viewtopic.php?f=3&t=15550 --- =(^.^)= nya~
 

User avatar
bosapara
Member
 
Posts: 360
Joined: Fri Apr 07, 2017 08:49
GitHub: bosapara
In-game: Jozet

Re: ABM works unstable/incorrect

by bosapara » Mon Sep 24, 2018 10:18

firefox wrote:
bosapara wrote:
Pyrollo wrote:Yes but can you give the definition of your ABM ? Usually it works.


Im here to report about problem, isn't about giving definition to you.

so you did. and what shall we do now?

abms work fine in singleplayer and multiplayer, no problems detected.
so it have something to do with the specific abm you are using.
so which abm is it exactly? we need the code.



Code doesnt metter. Works wrong even default lava + water.

Delay that happens by random 'crash' all idea of ABM.
 

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

Re: ABM works unstable/incorrect

by firefox » Mon Sep 24, 2018 11:48

my minetest runs at 30fps
flooding a mountain with lava and water dropped it to 22fps, which was to be expected.
yet the lavacooling worked correctly and there was no significant delay or changes in the flowing speed of liquids.

i cannot reproduce the problem. which version of minetest are you using?
also, did you activate any external mods?
my game: viewtopic.php?f=49&t=15860 --- building inspiration: viewtopic.php?f=3&t=15550 --- =(^.^)= nya~
 

User avatar
rubenwardy
Moderator
 
Posts: 5490
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: ABM works unstable/incorrect

by rubenwardy » Mon Sep 24, 2018 12:19

I need a test case so I can try and reproduce this (and also make sure there's no silly mistakes being made)
Lava and water flow isn't an ABM
 

User avatar
Pyrollo
Member
 
Posts: 139
Joined: Mon Jan 08, 2018 15:14
Location: Paris
GitHub: pyrollo
In-game: Naj

Re: ABM works unstable/incorrect

by Pyrollo » Mon Sep 24, 2018 12:54

bosapara wrote:
Pyrollo wrote:Yes but can you give the definition of your ABM ? Usually it works.


Im here to report about problem, isn't about giving definition to you.


I was here to try to help you. Forget it.
 

User avatar
texmex
Member
 
Posts: 999
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: ABM works unstable/incorrect

by texmex » Mon Sep 24, 2018 13:53

Lock the thread and redirect this to the Github issues, where bug reporting belongs.
 

User avatar
bosapara
Member
 
Posts: 360
Joined: Fri Apr 07, 2017 08:49
GitHub: bosapara
In-game: Jozet

Re: ABM works unstable/incorrect

by bosapara » Mon Sep 24, 2018 17:43

rubenwardy wrote:I need a test case so I can try and reproduce this (and also make sure there's no silly mistakes being made)
Lava and water flow isn't an ABM


Easy way to proof my report - visit 'jozet.duckdns.org:30000' and check lava+water or clockgen from basic_machines mod (it give 1 signal at 5 seconds and can activate something)


About stone and water. I mean stone generator with lava and water

\games\minetest_game\mods\default\functions.lua

Code: Select all
default.cool_lava = function(pos, node)
   if node.name == "default:lava_source" then
      minetest.set_node(pos, {name = "default:obsidian"})
   else -- Lava flowing
      minetest.set_node(pos, {name = "default:stone"})
   end
   minetest.sound_play("default_cool_lava",
      {pos = pos, max_hear_distance = 16, gain = 0.25})
end

if minetest.settings:get_bool("enable_lavacooling") ~= false then
   minetest.register_abm({
      label = "Lava cooling",
      nodenames = {"default:lava_source", "default:lava_flowing"},
      neighbors = {"group:cools_lava", "group:water"},
      interval = 1,
      chance = 2,
      catch_up = false,
      action = default.cool_lava,
   })
end
 

User avatar
Hume2
Member
 
Posts: 167
Joined: Tue Jun 19, 2018 08:24
Location: Czech Republic
GitHub: Hume2
In-game: Hume2

Re: ABM works unstable/incorrect

by Hume2 » Tue Sep 25, 2018 05:06

bosapara wrote:
rubenwardy wrote:
Code: Select all
default.cool_lava = function(pos, node)
   if node.name == "default:lava_source" then
      minetest.set_node(pos, {name = "default:obsidian"})
   else -- Lava flowing
      minetest.set_node(pos, {name = "default:stone"})
   end
   minetest.sound_play("default_cool_lava",
      {pos = pos, max_hear_distance = 16, gain = 0.25})
end

if minetest.settings:get_bool("enable_lavacooling") ~= false then
   minetest.register_abm({
      label = "Lava cooling",
      nodenames = {"default:lava_source", "default:lava_flowing"},
      neighbors = {"group:cools_lava", "group:water"},
      interval = 1,
      chance = 2,
      catch_up = false,
      action = default.cool_lava,
   })
end

It's because of the chance = 2. It means that it will be run each second only in 50% chance.
If you lack the reality, go on a trip or find a job.
 

User avatar
bosapara
Member
 
Posts: 360
Joined: Fri Apr 07, 2017 08:49
GitHub: bosapara
In-game: Jozet

Re: ABM works unstable/incorrect

by bosapara » Tue Sep 25, 2018 11:57

Hume2 wrote:
bosapara wrote:
rubenwardy wrote:
Code: Select all
default.cool_lava = function(pos, node)
   if node.name == "default:lava_source" then
      minetest.set_node(pos, {name = "default:obsidian"})
   else -- Lava flowing
      minetest.set_node(pos, {name = "default:stone"})
   end
   minetest.sound_play("default_cool_lava",
      {pos = pos, max_hear_distance = 16, gain = 0.25})
end

if minetest.settings:get_bool("enable_lavacooling") ~= false then
   minetest.register_abm({
      label = "Lava cooling",
      nodenames = {"default:lava_source", "default:lava_flowing"},
      neighbors = {"group:cools_lava", "group:water"},
      interval = 1,
      chance = 2,
      catch_up = false,
      action = default.cool_lava,
   })
end

It's because of the chance = 2. It means that it will be run each second only in 50% chance.


Its clear. In result we have isnt 1-2 sec, from 1 to 5, or even more
 

User avatar
texmex
Member
 
Posts: 999
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: ABM works unstable/incorrect

by texmex » Tue Sep 25, 2018 14:46

50% chance doesn’t mean result in 1-2 seconds. You may have a non-result streak of several seconds.
 

User avatar
bosapara
Member
 
Posts: 360
Joined: Fri Apr 07, 2017 08:49
GitHub: bosapara
In-game: Jozet

Re: ABM works unstable/incorrect

by bosapara » Tue Sep 25, 2018 15:38

texmex wrote:50% chance doesn’t mean result in 1-2 seconds. You may have a non-result streak of several seconds.


Alright, lets talk about clock gen. There are 1 exact signal at 5 seconds, nothing different means.

But it works incorrect too.
 

User avatar
texmex
Member
 
Posts: 999
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex
 

User avatar
bosapara
Member
 
Posts: 360
Joined: Fri Apr 07, 2017 08:49
GitHub: bosapara
In-game: Jozet

Re: ABM works unstable/incorrect

by bosapara » Tue Sep 25, 2018 16:37

texmex wrote:I’ve no idea what clock gen is, sorry.



Ok, doesnt metter. Just if we will use stone generator ABM with chance 1, it will work unstable.
The same happens with any ABM.
 

User avatar
texmex
Member
 
Posts: 999
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: ABM works unstable/incorrect

by texmex » Tue Sep 25, 2018 19:23

AFAIK, ABMs are always slightly delayed depending on the workload of the specific server step where they are executed. Depending on the number of other active ABMs running at the same time and other jobs, this delay fluctuates from not noticeable to very laggy. Besides that, to my knowledge ABMs are in general quite unoptimized in them features C++ implementation, which is why all timing depending features should avoid the altogether. Don’t use them if possible.
Last edited by texmex on Wed Sep 26, 2018 08:26, edited 1 time in total.
 

User avatar
Gael de Sailly
Member
 
Posts: 652
Joined: Sun Jan 26, 2014 17:01
Location: Lyon, France
GitHub: Gael-de-Sailly
IRC: Gael-de-Sailly
In-game: Gael-de-Sailly

Re: ABM works unstable/incorrect

by Gael de Sailly » Wed Sep 26, 2018 05:13

@bosapara: all that you describe in your first post is an expected behaviour, and is explained by the "chance" parameter. If chance = X and delay = Y, your ABM has 1/X chance to be executed every Y seconds, to add randomness.
If you want it to be executed at every time, use chance = 1, or remove the chance parameter (which does the same).
bosapara wrote:Ok, doesnt metter. Just if we will use stone generator ABM with chance 1, it will work unstable.
The same happens with any ABM.

Stop crying foul, man. Test it and then give feedback. You should also understand that ABMs were first made to handle randomly occurring events, consider node timers if you want a more precise timing.
Contributor of Minetest and OpenStreetMap, on Ubuntu 16.04. ~ ~ ~ Meet me on MinetestForFun, VanessaE's Basic, Capture the Flag and Inside the Box.
 

User avatar
bosapara
Member
 
Posts: 360
Joined: Fri Apr 07, 2017 08:49
GitHub: bosapara
In-game: Jozet

Re: ABM works unstable/incorrect

by bosapara » Wed Sep 26, 2018 08:56

Gael de Sailly wrote:Stop crying foul, man.


Wipe your eyes and try to read this topic again.
 

User avatar
texmex
Member
 
Posts: 999
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: ABM works unstable/incorrect

by texmex » Wed Sep 26, 2018 11:19

You don’t seem to understand what ABMs do. Read all the answers, again.
 

User avatar
bosapara
Member
 
Posts: 360
Joined: Fri Apr 07, 2017 08:49
GitHub: bosapara
In-game: Jozet

Re: ABM works unstable/incorrect

by bosapara » Wed Sep 26, 2018 21:00

texmex wrote:AFAIK, ABMs are always slightly delayed depending on the workload of the specific server step where they are executed. Depending on the number of other active ABMs running at the same time and other jobs, this delay fluctuates from not noticeable to very laggy. Besides that, to my knowledge ABMs are in general quite unoptimized in them features C++ implementation, which is why all timing depending features should avoid the altogether. Don’t use them if possible.


it's like the truth, + random delay, even without lags on the server
 

User avatar
paramat
Developer
 
Posts: 3209
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

Re: ABM works unstable/incorrect

by paramat » Thu Sep 27, 2018 01:06

"Code doesn't matter" :D

Clock generator has chance 1: https://github.com/ac-minetest/basic_machines/blob/59758a644c204bc2e671b6a9878cf67d7e540878/mover.lua#L1424
ABMs aren't meant to be reliable, use a node timer, globalstep timer or maybe 'minetest.after'
 

User avatar
bosapara
Member
 
Posts: 360
Joined: Fri Apr 07, 2017 08:49
GitHub: bosapara
In-game: Jozet

Re: ABM works unstable/incorrect

by bosapara » Thu Sep 27, 2018 04:58

paramat wrote:ABMs aren't meant to be reliable


Ouch:/ it explains all my bad expectations. Thanx for explaining.

paramat wrote:se a node timer, globalstep timer or maybe 'minetest.after'

Alright, I'll know
 


Return to Problems



Who is online

Users browsing this forum: SAMIAMNOT and 2 guests