Altering ABMS?

Post Reply
User avatar
Mantar
Member
Posts: 590
Joined: Thu Oct 05, 2017 18:46
Contact:

Altering ABMS?

by Mantar » Post

Quick question: is there a way to adjust the interval or chance for an ABM to fire off, after it's been defined? I noticed that Exile's rain has the same chance to soak a spot of ground whether it's a light sunshower or a massive superstorm, and the simplest and least wasteful way to handle the difference would be if I could update the ABM's interval and/or chance when the weather changes.
Otherwise I've got to crank up the ABM across the board and just check the weather state every time it goes off.
Lead dev of Exile, git repo: https://codeberg.org/Mantar/Exile

User avatar
MisterE
Member
Posts: 693
Joined: Sun Feb 16, 2020 21:06
GitHub: MisterE123
IRC: MisterE
In-game: MisterE

Re: Altering ABMS?

by MisterE » Post

if you could determine the index of the registered abm in minetest.registered_abms then you could edit it directly probably... rubenwardy could give better answer

User avatar
Mantar
Member
Posts: 590
Joined: Thu Oct 05, 2017 18:46
Contact:

Re: Altering ABMS?

by Mantar » Post

Sounds doable to me. As long as it lets me edit it, then that would work.
Lead dev of Exile, git repo: https://codeberg.org/Mantar/Exile

User avatar
Festus1965
Member
Posts: 4181
Joined: Sun Jan 03, 2016 11:58
GitHub: Festus1965
In-game: Festus1965 Thomas Thailand Explorer
Location: Thailand ChiangMai
Contact:

Re: Altering ABMS?

by Festus1965 » Post

Mantar wrote:
Wed Sep 29, 2021 20:06
Quick question: is there a way to adjust the interval or chance for an ABM to fire off, after it's been defined?
After code changes, sure yes

I changed first all kind of interval or chance in ALL my used mods, where chance was >1

Example : interval 1, chance 3 = wasting of CPU as in average chance 3 will make it run avg every 3 interval,
so setting it to interval 3, chance 1 ... is the same chance in avg, but ABM with CPU need only run it every 3 sec, and then not for fun, it will do it

so if you change now the chance and interval to get their value as like from .conf, then you also can change it one the run just from admin by: /set monster_interval 2, or /set moretrees_grow_chance 1, but need to define them, and read them ...

as I did with all the textures_alpha also

and then it is also possible to change them through another mod even also
but
some of them need to be 1, as otherwise mod isn't running under this actual code : technic EU fE
Human has no future (climate change)
If urgend, you find me in Roblox (as CNXThomas)

User avatar
Mantar
Member
Posts: 590
Joined: Thu Oct 05, 2017 18:46
Contact:

Re: Altering ABMS?

by Mantar » Post

MisterE: Hey, it works, if I do "foo = minetest.get_registered_abms()" then foo is a pointer, not a copy, so changes made to foo are also visible in subsequent reads of minetest.get_registered_abms(). Good to know.

Festus: Thanks, but that's not really what I was asking. Also, if you set everything to "chance = 1," then "catchup = true" will do nothing afterward, as the catch-up behavior works by reducing "chance" to make up for lost time while unloaded. If chance is already down at 1:1, there's nowhere for it to go.

And another thing: I think that's a case of premature optimization, as just checking a random chance (whether or not to run) every tick is not going to be a very significant source of lag by itself. What matters is the code that follows and how often that runs total. You should profile the code and see, I would bet you that there's very little measurable difference between "interval 1, chance 3" and "interval 3, chance 1."
Lead dev of Exile, git repo: https://codeberg.org/Mantar/Exile

User avatar
Festus1965
Member
Posts: 4181
Joined: Sun Jan 03, 2016 11:58
GitHub: Festus1965
In-game: Festus1965 Thomas Thailand Explorer
Location: Thailand ChiangMai
Contact:

Re: Altering ABMS?

by Festus1965 » Post

Mantar wrote:
Thu Sep 30, 2021 05:18
I would bet you that there's very little measurable difference between "interval 1, chance 3" and "interval 3, chance 1."
That BIG change is very easy :
the queue of ABMs waiting for its interval is far shorter,
and only ABMs that will sure have a 'work' now are in it.

After I learned that, I never have had the problem, that an ABM was NOT even checked for a chance (as of ABM time runned out),
as the queue got much shorter as of 'not useless just check if change get true.
So the standard short ABM running time of 200ms was easier to keep. even I changed also this.

IF you was looking in the servers.lists good, my server had even with ~250 mods the lowest lag, even with technic, mesecons, and more ...
so read clear ... but my success is fact.

Oh, but this knowledge is even useless now ...or in a view months.


Yes,
you are right that the code IS running after is more important, but also here I was working on - with success.
But not anymore ... even you write perfect nice, fast cashless code, the next version of mt makes it maybe (chance 5 haha) useless.

Good luck.
Human has no future (climate change)
If urgend, you find me in Roblox (as CNXThomas)

User avatar
Mantar
Member
Posts: 590
Joined: Thu Oct 05, 2017 18:46
Contact:

Re: Altering ABMS?

by Mantar » Post

I don't doubt your success, I know what can come from a determined pursuit of speed. It sounds like your server is a lean meachine.

What I doubt is whether that specific change (interval 3/chance 1 vs interval 1/chance 3) was actually a significant part of it. Have you got profiler numbers, or did you at least benchmark two identical servers, with the only difference being the interval/chance swap?
I've run into far too many cargo-cult optimization "tricks" that people swore would help, which profiling showed didn't make more than the tiniest difference.
Lead dev of Exile, git repo: https://codeberg.org/Mantar/Exile

User avatar
Festus1965
Member
Posts: 4181
Joined: Sun Jan 03, 2016 11:58
GitHub: Festus1965
In-game: Festus1965 Thomas Thailand Explorer
Location: Thailand ChiangMai
Contact:

Re: Altering ABMS?

by Festus1965 » Post

Mantar wrote:
Thu Sep 30, 2021 16:36
bala
all proofed with profiler and also lag reports from gamer, also ...
just you needed to search read (and understand) the Asia Thailand Thread BEFORE YOU posted this above ... I posted a lot proof ...
but I didn't recover that lost parts from the forum failure

but, as also the mod programmer ignored my hints (like : I want to have a nice floating item in my tubes)
you can do it also (ignore it, without checking it out = foolish) ... I don't mind

YOU can proof me wrong, and that is the right way, before you doubt my results this way
take your system and run it with all the mods I have on the same kind of hardware ...

there is NO ANY other server, was that low lag then my one ... with this mods and even run with 70 gamer in,
just look Pandorabox, the nearest server depending on hard mods
and that one is limited to 20 now, after was 30 before ...
and he is even a better programmer in lua for sure ...

a do what you want ...
in minetest you need even not a server for more than 20 gamer anymore, as there are no gamer anymore for bigger needs

it WILL dry out as also i showed clear ...
Human has no future (climate change)
If urgend, you find me in Roblox (as CNXThomas)

User avatar
Mantar
Member
Posts: 590
Joined: Thu Oct 05, 2017 18:46
Contact:

Re: Altering ABMS?

by Mantar » Post

Festus1965 wrote:
Fri Oct 01, 2021 00:19
YOU can proof me wrong, and that is the right way, before you doubt my results this way
That's not the right way -- the burden of proof is on the person making the claim, which in this case would be you. If we all did things the other way around the Russian scammers could shut the whole world down as everyone had to stop what they were doing in order to prove them wrong about "this one weird trick that will increase the size of your penis!"

But it sounds like you've done the legwork already and posted results somewhere in the asia thailand thread, so that's cool. I will have to dig up your results and check them out. I will definitely consider your suggestions! Thanks.
Lead dev of Exile, git repo: https://codeberg.org/Mantar/Exile

User avatar
Festus1965
Member
Posts: 4181
Joined: Sun Jan 03, 2016 11:58
GitHub: Festus1965
In-game: Festus1965 Thomas Thailand Explorer
Location: Thailand ChiangMai
Contact:

Re: Altering ABMS?

by Festus1965 » Post

Mantar wrote:
Fri Oct 01, 2021 16:31
That's not the right way --
That's the way it is,
as I made my way to lower lag then all other servers with several trials
also a Covid-19 vaccine made it's way to success through steps of trials on 1000 people, step 2 20.000 people, and step 3 with near 200.000 people, and they offered their studies in science papers,
so my way, settings and results are in the Asia Thailand thread.

And it IS also reality that problems as we've seen with AstraZeneca had to be collected and proofed from NOT themself to make sure, not hiding something.

But as also there and here, all improvements (as mostly protected against Covid Death or heavy illness), a proof of some deaths as of the Vaccine was NOT negating the success in protecting the vaccinated people in dying from Covid-19 itself.

As long a theories can't be proofed wrong, it is the one 'true', just see Einstein ... as his theories are still in doubts, but couldn't proofed wrong also.

So again: as of ABMs
* first step is to avoid them anyway
* second step is to keep them less (as of standard 200 ms time for them)
* third step is to reduce their acting amount (sum of waiting queue low, but lower change of a real result in act - 1/3 to 3/1)
* forth to give more time for the queue if still more than 200 ms (abm_time_budget)
* fifth separate them from run same interval: most is 1,2,5,10,20,30,60 ... change 5 to 4/6, 10 to 9 and 11 and so on, to avoid every 10 sec FULL ABM, and then 9 ABM near nothing to do
* six to reduce their impact on running by optimizing the code


and here also, the optimization, as even the acceptance to complaints (profiler show pipeworks, moretrees, .., as main consumer) is at the mod programmer side !

I as admin can only (basic) decide as of want, need them, and give them the optimal RAM, CPU possibilities as of
* not take them (1. avoid, or choose 2.)
* take them, but give more place (steps 3 and 4)
as MOST admins can't go deeper.

So as one example I proofed it IS possible to reduce the impact from pipeworks with globalstep2 ?
but mod programmer insisted to want to keep items flow nice
against my opinion I don't look the items floating nice, the result of working and sorting is important, even if they might 'jump, for lower CPU / lag impact.

at technic on the other way, you as admin have to de-build the switching stations of lost, pause gamer, also also this I wrote down in results as of impact before and after de-build about 50 switching stations from gamer left builds.
and also Pandorabox went a similar way, reducing their impact as of punish with off times ...

and another one: ABM
I changed the code of src .. manual from 1000 / 5 = 200 ms for ABM queue to higher values, at the end 650 ms, as from 1000 ms, 200ms for ABM and then 800ms nothing ? ... what ??
(step 4)
and now in 5.4.1 we can set it via .conf : abm_time_budget = 0.65
this is another proof that my ideas even got into dev team ... silent but clear to see.
Human has no future (climate change)
If urgend, you find me in Roblox (as CNXThomas)

User avatar
Mantar
Member
Posts: 590
Joined: Thu Oct 05, 2017 18:46
Contact:

Re: Altering ABMS?

by Mantar » Post

Okay, I don't know if we've got a language barrier here or what all that covid stuff has to do with anything (except maybe it's just that infectious, lol) but it's a foundational tenet of science that the burden of proof is on the person making a claim.

If Albert Einstein says that "Energy is the same thing as matter, dude!" the scientific community will ask "and what's your basis for saying that?" If he sucks on a bong and says "I don't know, it makes sense to me. I'm really high right now. Besides, you can't prove it isn't!" then everyone would ignore him and move on.
But no, Einstein could point to experimental evidence and mathematical proofs which he and others had published in scientific journals, to back up his claim, (Just as you backed up your claim) because that's the job of the person making any particular claim, to either provide the evidence or at least point to where it can be found.

Now if somebody wanted to say Einstein's math was wrong or the experiments he's referring to were done improperly, THEN the burden would shift onto them to prove their claim that there was something wrong. That could have been me, if I had responded to you saying that your benchmarks were done incorrectly or something, but I have no reason to suspect that (and you'd be right to just say "nope" to such a claim, in the absence of evidence for it) and so here we are, where I have already happily accepted your claim, because you at least pointed to the general vicinity where the evidence could be found, and I really can't ask for more than that.
Oh and thanks for helping the devs improve the game!
Lead dev of Exile, git repo: https://codeberg.org/Mantar/Exile

User avatar
PolySaken
Member
Posts: 817
Joined: Thu Nov 09, 2017 05:18
GitHub: PolySaken-I-Am
In-game: PolySaken
Location: Wānaka, Aotearoa
Contact:

Re: Altering ABMS?

by PolySaken » Post

Idk if it still works but getting the length of the ABM table immediately after registering one is how I have got the index in the past, as it just used table.insert
Guidebook Lib, for in-game docs | Poly Decor, some cool blocks | Vision Lib, an all-purpose library.

User avatar
Mantar
Member
Posts: 590
Joined: Thu Oct 05, 2017 18:46
Contact:

Re: Altering ABMS?

by Mantar » Post

Nice, that'll make things simpler.
Lead dev of Exile, git repo: https://codeberg.org/Mantar/Exile

Post Reply

Who is online

Users browsing this forum: winston and 17 guests