Page 1 of 1

Understanding ABM chance

PostPosted: Sun Apr 01, 2012 19:24
by neko259
I don't remember if I asked this already. I try to get ABM working but it' very weird. No matter what chance I set (even 200-300), it always works on every node when I start the game.

PostPosted: Sun Apr 01, 2012 20:38
by sfan5
Thats a Bug

PostPosted: Sun Apr 01, 2012 20:44
by neko259
Does celeron know that?

PostPosted: Sun Apr 01, 2012 22:48
by bgsmithjr
that's a bug? It seems right to me.To have an interval you have to have a starting point.

PostPosted: Sun Apr 01, 2012 23:32
by Temperest
bgsmithjr wrote:that's a bug? It seems right to me.To have an interval you have to have a starting point.


Actually the issue is that ABMs are being run far too often when the server starts.

PostPosted: Mon Apr 02, 2012 04:55
by neko259
bgsmithjr wrote:that's a bug? It seems right to me.To have an interval you have to have a starting point.

I complain about chances, not intervals. They are just ignored and I have to add manual randomness to the functions, which is not nice.

PostPosted: Mon Apr 02, 2012 05:07
by kahrl
Temperest wrote:
bgsmithjr wrote:that's a bug? It seems right to me.To have an interval you have to have a starting point.


Actually the issue is that ABMs are being run far too often when the server starts.


The reason is that minetest simulates the "lost" time when loading an existing world. Maybe it should be possible to switch this behaviour off with a flag in the ABM definition.

PostPosted: Mon Apr 02, 2012 12:42
by celeron55
It is intended behaviour that when a MapBlock becomes part of the active area, the time of it not being active while the server has been running is calculated and an estimate is made to roughly trigger as many of the ABMs as would have been triggered during the time. This is preferred behaviour for things like grass growth.

It could be a bug if all of the ABMs are triggered immediately when you shut down the server and start it again. However, this isn't clear based on what you said.

PostPosted: Mon Apr 02, 2012 17:00
by bgsmithjr
You are not taking into consideration how many blocks there are in the game and it cycles through every one.
if there are 600,000 blocks and you put the chance to be 5
1/5 = .2 * 100 = 20 % chance
Roughly 120,000 blocks will have the action happen
Then you just so happen to be surrounded by more than you thought so it looks like more not too mention whether or not it generates them evenly or in clusters.
20% of the blocks will have the action happen. No bug.

PostPosted: Mon Apr 02, 2012 17:40
by Jordach
bgsmithjr wrote:You are not taking into consideration how many blocks there are in the game and it cycles through every one.
if there are 600,000 blocks and you put the chance to be 5
1/5 = .2 * 100 = 20 % chance
Roughly 120,000 blocks will have the action happen
Then you just so happen to be surrounded by more than you thought so it looks like more not too mention whether or not it generates them evenly or in clusters.
20% of the blocks will have the action happen. No bug.

You just blew my mind.

PostPosted: Mon Apr 02, 2012 17:53
by neko259
bgsmithjr wrote:You are not taking into consideration how many blocks there are in the game and it cycles through every one.
if there are 600,000 blocks and you put the chance to be 5
1/5 = .2 * 100 = 20 % chance
Roughly 120,000 blocks will have the action happen
Then you just so happen to be surrounded by more than you thought so it looks like more not too mention whether or not it generates them evenly or in clusters.
20% of the blocks will have the action happen. No bug.

I have 2-3 trees with leaves. Chance is 300. At the server start all of the trees grow infinitely up (to the ABM range), and 100% of leaves turn into blossom. What am I doing wrong?

PostPosted: Mon Apr 02, 2012 19:24
by bgsmithjr
lol

PostPosted: Mon Apr 02, 2012 19:28
by bgsmithjr
neko259 wrote:
bgsmithjr wrote:You are not taking into consideration how many blocks there are in the game and it cycles through every one.
if there are 600,000 blocks and you put the chance to be 5
1/5 = .2 * 100 = 20 % chance
Roughly 120,000 blocks will have the action happen
Then you just so happen to be surrounded by more than you thought so it looks like more not too mention whether or not it generates them evenly or in clusters.
20% of the blocks will have the action happen. No bug.

I have 2-3 trees with leaves. Chance is 300. At the server start all of the trees grow infinitely up (to the ABM range), and 100% of leaves turn into blossom. What am I doing wrong?


Sorry for showing off, poster, but what I was supposed to say was that..
Maybe you forgot that hidden blocks also have the code applied.
like for ever dirt you add a grass block, then you would have more blocks than you intended because you only wanted the ones on top.

PostPosted: Mon Apr 02, 2012 19:29
by neko259
Hidden trees? Where?

PostPosted: Mon Apr 02, 2012 19:30
by Jordach
That's such a point. Explains why mesecons can "error".

PostPosted: Mon Apr 02, 2012 19:32
by bgsmithjr
What?
Is your problem solved, with the post about the game catching up when shut off?

PostPosted: Mon Apr 02, 2012 19:45
by Jordach
Should be that.

I have a easy example:

Say I have this 16 by 16 chunk.

Then say a flower grows.

Then I leave the chunk for TWO MINETEST HOURS.

I load that very chunk again, from what it seems, the chunk now has more flowers.

Minetest does this to ensure abms work (just like a pseudo random nuber generator,) like time has flown there when it has not.

PostPosted: Thu Apr 05, 2012 16:58
by neko259
I still wait for the final answer: when will I be able to get rid of manual chance checks? Now if I remove them, on the server start I get huge lags and ABM working for EVERY block and ruining all it's work.

PostPosted: Fri Apr 06, 2012 08:22
by Gatharoth
neko259 wrote:I still wait for the final answer: when will I be able to get rid of manual chance checks? Now if I remove them, on the server start I get huge lags and ABM working for EVERY block and ruining all it's work.


You should post a snippet of your code so people can actually look at it and tell you. Because with the information you provide, all anyone can tell you is how they work.

Which everyone keeps repeating over again to you.

PostPosted: Sat Apr 07, 2012 17:01
by neko259
Gatharoth wrote:
neko259 wrote:I still wait for the final answer: when will I be able to get rid of manual chance checks? Now if I remove them, on the server start I get huge lags and ABM working for EVERY block and ruining all it's work.


You should post a snippet of your code so people can actually look at it and tell you. Because with the information you provide, all anyone can tell you is how they work.

Which everyone keeps repeating over again to you.

https://bitbucket.org/neko259/nature

Look into any of the code with growing.

PostPosted: Sun Apr 08, 2012 10:19
by mauvebic
growing_trees is pretty similar to nature but they dont act the same, maybe that might help?

PostPosted: Mon Apr 09, 2012 20:28
by neko259
Fixed in the latest git version.