ABM works unstable/incorrect

Post Reply
User avatar
bosapara
Member
Posts: 637
Joined: Fri Apr 07, 2017 08:49

ABM works unstable/incorrect

by bosapara » Post

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: 1709
Joined: Wed Jan 14, 2015 07:34
In-game: Red_Fox
Location: Xanadu

Re: ABM works unstable/incorrect

by firefox » Post

and what abm is that?
✨🏳️‍🌈♣️✨

User avatar
bosapara
Member
Posts: 637
Joined: Fri Apr 07, 2017 08:49

Re: ABM works unstable/incorrect

by bosapara » Post

firefox wrote:and what abm is that?
Here you read about abm

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

Re: ABM works unstable/incorrect

by Pyrollo » Post

Yes but can you give the definition of your ABM ? Usually it works.
[ Display Modpack ] - [ Digiterms ] - [ Crater MG ] - [ LATE ]

User avatar
bosapara
Member
Posts: 637
Joined: Fri Apr 07, 2017 08:49

Re: ABM works unstable/incorrect

by bosapara » Post

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: 1709
Joined: Wed Jan 14, 2015 07:34
In-game: Red_Fox
Location: Xanadu

Re: ABM works unstable/incorrect

by firefox » Post

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.
✨🏳️‍🌈♣️✨

User avatar
bosapara
Member
Posts: 637
Joined: Fri Apr 07, 2017 08:49

Re: ABM works unstable/incorrect

by bosapara » Post

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: 1709
Joined: Wed Jan 14, 2015 07:34
In-game: Red_Fox
Location: Xanadu

Re: ABM works unstable/incorrect

by firefox » Post

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?
✨🏳️‍🌈♣️✨

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

Re: ABM works unstable/incorrect

by rubenwardy » Post

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
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

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

Re: ABM works unstable/incorrect

by Pyrollo » Post

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.
[ Display Modpack ] - [ Digiterms ] - [ Crater MG ] - [ LATE ]

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

Re: ABM works unstable/incorrect

by texmex » Post

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

User avatar
bosapara
Member
Posts: 637
Joined: Fri Apr 07, 2017 08:49

Re: ABM works unstable/incorrect

by bosapara » Post

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: 710
Joined: Tue Jun 19, 2018 08:24
GitHub: Hume2
In-game: Hume2
Location: Czech Republic

Re: ABM works unstable/incorrect

by Hume2 » Post

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: 637
Joined: Fri Apr 07, 2017 08:49

Re: ABM works unstable/incorrect

by bosapara » Post

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: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: ABM works unstable/incorrect

by texmex » Post

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: 637
Joined: Fri Apr 07, 2017 08:49

Re: ABM works unstable/incorrect

by bosapara » Post

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: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: ABM works unstable/incorrect

by texmex » Post

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

User avatar
bosapara
Member
Posts: 637
Joined: Fri Apr 07, 2017 08:49

Re: ABM works unstable/incorrect

by bosapara » Post

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: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: ABM works unstable/incorrect

by texmex » Post

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: 845
Joined: Sun Jan 26, 2014 17:01
GitHub: gaelysam
IRC: Gael-de-Sailly
In-game: Gael-de-Sailly gaelysam
Location: Voiron, France

Re: ABM works unstable/incorrect

by Gael de Sailly » Post

@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.
Just realize how bored we would be if the world was perfect.

User avatar
bosapara
Member
Posts: 637
Joined: Fri Apr 07, 2017 08:49

Re: ABM works unstable/incorrect

by bosapara » Post

Gael de Sailly wrote: Stop crying foul, man.
Wipe your eyes and try to read this topic again.

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

Re: ABM works unstable/incorrect

by texmex » Post

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

User avatar
bosapara
Member
Posts: 637
Joined: Fri Apr 07, 2017 08:49

Re: ABM works unstable/incorrect

by bosapara » Post

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: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: ABM works unstable/incorrect

by paramat » Post

"Code doesn't matter" :D

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

User avatar
bosapara
Member
Posts: 637
Joined: Fri Apr 07, 2017 08:49

Re: ABM works unstable/incorrect

by bosapara » Post

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

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests