Interpretation of graph of pollution consumption by trees

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Lighthouse
Inserter
Inserter
Posts: 37
Joined: Wed Nov 20, 2024 3:09 am
Contact:

Interpretation of graph of pollution consumption by trees

Post by Lighthouse »

I am testing pollution absorption by trees and get results that I cannot easily interpret:

Wiki states:
Every single tree absorbs a small amount of pollution in its chunk per second. If the total pollution in a chunk is above 60 units, once per second some of the trees in that chunk each have a chance to either lose one stage of leaves or have their leaves become one stage more gray. Regardless of whether the tree loses leaves or gets grayer, 10 pollution are absorbed by the tree.
https://wiki.factorio.com/Tree
12-28-2024, 11-30-09.png
12-28-2024, 11-30-09.png (21.92 KiB) Viewed 895 times
I found that "above 60 units" scales up - when the pollution is 1.000.000 all trees in the entire chunk loose their leaves within seconds.

The strange number results I get in the following test scenario:
100 trees, all in the same chunk. Previously 0 pollution, then set to 1000000 pollution.

This is the graph after 5 seconds:
12-28-2024, 11-29-33.png
12-28-2024, 11-29-33.png (64.96 KiB) Viewed 895 times
100 trees should not be able to reduce more than 1k pollution.
In one minute 100 trees should absorb (0.001/second * 60 seconds) * 100 = 6 pollution.

But I observe a peek absorption rate of 237k per minute. Integrated to 10k pollution.

What's the issue here?
Attachments
12-28-2024, 11-31-42.png
12-28-2024, 11-31-42.png (21.92 KiB) Viewed 895 times
mmmPI
Smart Inserter
Smart Inserter
Posts: 3974
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Interpretation of graph of pollution consumption by trees

Post by mmmPI »

From my understanding, 100 trees absorbed 10K pollution, or about 1000 per trees. This is surprisingly high to me, i haven't delved into the math precisely before and am going to assume the documentation is correct, to try and see if it make sense to me, but no guarantees !

The wiki states :
Every single tree absorbs a small amount of pollution in its chunk per second. If the total pollution in a chunk is above 60 units, once per second some of the trees in that chunk each have a chance to either lose one stage of leaves or have their leaves become one stage more gray.
Regardless of whether the tree loses leaves or gets grayer, 10 pollution are absorbed by the tree.
I think this is what happening. The total of pollution in the chunk being many order of magnitude more than 60, maybe the trees are attempting to "have a chance" at "losing leaves/graying" many times ? ( that would my interpretation of the quoted statement : )
I found that "above 60 units" scales up - when the pollution is 1.000.000 all trees in the entire chunk loose their leaves within seconds.
Each of these occurences leading to a removal of 10 pollution per tree selected and a dice roll, with unspecified probabilities, to damage the tree either removing leaves or turning it grayer.

Now it could be wrong from me to think that's what your statement meant, or that it is what is happening in the game the way i described.
Maybe the high pollution just changes the chances for trees to receive damage ( graying or losing leaves ). That would have been my first intuition but since it doesn't appear to fit with the picture, i'm discarding it for now.

The wiki also goes on to say :
A tree stops losing leaves/becoming more gray once the sum of its gray percentage and its leaves lost percentage is above 120%. 50% of trees stop their leaf progression one stage earlier. As the grayness and leaf stage are then locked for that tree forever, it is possible for trees to keep some leaves in heavily polluted chunks but in turn be very gray, or the other way around.
The less dense the leaves, the slower the tree absorbs pollution, however tree grayness does not affect pollution absorption.
I imagine this 120% is achieved in the 5 seconds because the absorption per "damaging trees" stops at this point. Then there are only a tiny fraction of the original trees that turned very gray but didn't lost all leaves that can continue absorbing pollution but it's too small to see on the graph apart from maybe that 2.5/m that is a 1 pollution absorbed by trees not getting damaged.

This seem to corroborate personnal ingame observations that when the pollution level is "low", (i didn't know it was 60 per chunk, i only know the shade of reds on map view ), trees aren't damaged, but can absorb pollution seemingly "forever".

I was under the impression that after beeing too damaged, to their worst state, all trees would stop absorbing pollution, or be reduced at a certain lower threshold, but not such random configuration that makes it difficult to predict, but also i guess more "alive" and natural.

( i'm curious : How did you set the pollution on the chunk to the value for the test ? )
Lighthouse
Inserter
Inserter
Posts: 37
Joined: Wed Nov 20, 2024 3:09 am
Contact:

Re: Interpretation of graph of pollution consumption by trees

Post by Lighthouse »

mmmPI wrote: Sat Dec 28, 2024 1:27 pm i'm curious : How did you set the pollution on the chunk to the value for the test ?

Code: Select all

/c game.player.surface.pollute(game.player.position, 1000000)
btw this is the permanent state of the 100 trees (picture taken after 20 minutes):
12-28-2024, 14-35-48.png
12-28-2024, 14-35-48.png (675.01 KiB) Viewed 850 times
The trees with leaves left seem to continue absorbing pollution at a very low rate:
12-28-2024, 14-37-34.png
12-28-2024, 14-37-34.png (42.96 KiB) Viewed 850 times
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3453
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Interpretation of graph of pollution consumption by trees

Post by boskid »

From a quick check, 100 trees, and 1000000 pollution: pollution update sees 1000000 pollution, computes 1000000-60 (amount of pollution above minPollution) = 999940, divides this by 50 (pollution_per_tree_damage) to get 19998.8, round this up to 19999. From this the pollution code decides it needs to damage trees, finds 100 trees and keeps applying pollution damage to trees up to 19999 times, selecting randomly one tree at every step which tree to damage taking from the list of trees that still can be damaged. After about 1036 iterations (in my experiment) all trees were completly damaged and pollution stopped being applied. Those trees were taken out of the pool of trees to be damaged because they either tried to increase trunk progression when at max trunk progression or tried to increase grey progression when at max grey progression. There may be tiny logic flaw here as the tree at max trunk progression could still increase the gray progression so it should be only taken out of the pool when both are at max but that has low impact as next time pollution is checked it will revisit those trees.
mmmPI
Smart Inserter
Smart Inserter
Posts: 3974
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Interpretation of graph of pollution consumption by trees

Post by mmmPI »

Lighthouse wrote: Sat Dec 28, 2024 1:37 pm btw this is the permanent state of the 100 trees (picture taken after 20 minutes):
In game I tried to make a nice garden and plant trees on the sideways of concrete roads to make them look like alleys. And that's how those in the center of my base ended up looking :? . Maybe even less leaves, it may depend on the particular type of tree some may have lower amount of leaves pixels when at the same stage of leaflessness. It became visible alongside the train tracks, where i planted trees manually in the middle when riding the train, that further away from the center of the base the trees were in a "permanent state" but looking much nicer. Not polluted. I associated it with the amount of red i saw in the map view from the pollution cloud, when you don't have much "red" , the trees can be kept leafy.

When replanting the damaged trees i noticed they were initially very effective at absorbing pollution, but as you noticed too quickly deteriorated.
Lighthouse wrote: Sat Dec 28, 2024 1:37 pm The trees with leaves left seem to continue absorbing pollution at a very low rate:
1.7 per minutes per 100 trees would amount to 0.000283333333333 per tree per second, compared to their original 0.001 that would be 2.8 % ?

which would be an average considering 100 trees in their permanently damaged state, featuring a distribution of various grayish and leafless trees.
Lighthouse wrote: Sat Dec 28, 2024 1:37 pm

Code: Select all

/c game.player.surface.pollute(game.player.position, 1000000)
Thanks ! I can use this to try and give a pollution value to the different red shades ! and also make sure i am polluting an area just under 60 for other tests.
boskid wrote: Sat Dec 28, 2024 2:01 pm From a quick check, 100 trees, and 1000000 pollution: pollution update sees 1000000 pollution, computes 1000000-60 (amount of pollution above minPollution) = 999940, divides this by 50 (pollution_per_tree_damage) to get 19998.8, round this up to 19999.
Thanks ! From reading your answer, i realized it's a bit more complicated than what i thought initially. ( as always :D ). The 50 (pollution_per_tree_damage) was not mentionned in the earlier, it's not on the wiki, and i can't find it in the default options in game. What is it ?

I think i understand that 1036 iterations * 10 pollution is roughly explaining why around 10K pollution is being absorbed when running the test, which would correspond to the picture of around 9.9K pollution absorbed in another test. I imagine this number can vary due to trees getting gray or losing leaf or nothing.
Lighthouse
Inserter
Inserter
Posts: 37
Joined: Wed Nov 20, 2024 3:09 am
Contact:

Re: Interpretation of graph of pollution consumption by trees

Post by Lighthouse »

Thanks boskid for the insights and your time! I really appreciate it. :)

In your code analysis there was no mentioning of anything related to "0,001 per second". Neither was there a mentioning of "10 per tree". Then again the sample was about "above 60 pollution units in chunk", so those aspects may not apply here.

Restating important points:
• For every 50 pollution units above the '60 unit threshold' one damageable tree is damaged.
• Damaging a tree means "progression in grey" or "progression in trunk"
• Trees can be damaged multiple times in one chunk computation until either 'trunk progression' or 'grey progression' are at max value.

This answers all my current questions about the speed of tree decay due to pollution.
But my understanding of the pollution consumption is 100% just yet.

In the original sample the "pollution absorbed by damaging trees" was a little less than 10k (~9800). Close but not equal to the documentation's "10 units per tree".

In my next test I reapplied several times 10k pollution to the same 100 trees until the "pollution absorbed by damaging trees" did not change anymore: The "pollution absorbed by damaging trees" now shows a total number larger than 10k (10.130). (The pollution absorbed by "trees" accumulates to 239.)

-> I don't understand the deviations from 1k, as stated by the documentation. Following the code analysis I tend to conclude "If a tree 'dies' ( = trunk or grey progression reach max value) 100 pollution units are removed".

With my tools (vanilla sandbox) its hard for me to test:
Would it be possible for a tree to absorb e.g. 9 units without being damaged (below "60 units in chunk" threshold) and then get pollution damage and remove another ~10 units, thus absorbing e.g. 19 units in total?
Can a tree absorb pollution below the "60 units in chunk" threshold for an indefinite amount of time, thus removing more than 10 units in total?

Although there are deviations in the details, I could now explain the numbers I see (still missing 0,1% though :) )
Last edited by Lighthouse on Sun Dec 29, 2024 11:40 am, edited 1 time in total.
mmmPI
Smart Inserter
Smart Inserter
Posts: 3974
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Interpretation of graph of pollution consumption by trees

Post by mmmPI »

Lighthouse wrote: Sun Dec 29, 2024 1:24 am In your code analysis there was no mentioning of anything related to "0,001 per second".
That's probably because in 5 second for 100 trees, that would amount to something insignificant, this is the absorption that doesn't damage trees at all.
Lighthouse wrote: Sun Dec 29, 2024 1:24 am Neither was there a mentioning of "10 per tree". Then again the sample was about "above 60 pollution units in chunk", so those aspects may not apply here.
There was indirectly !
Lighthouse wrote: Sun Dec 29, 2024 1:24 am -> I don't understand the deviations from 10k. Otherwise I would say "If a tree 'dies' ( = trunk or grey progression reach max value) 10 pollution units are removed".
"if a tree dies 10 pollution unit are removed" => this appear incorrect, or with 100 trees the maximum pollution absorbed would be around 1000 and not 10 000. If you try to reproduce the experiment with 50 trees or 200 trees that may become more obvious to you that the relation is 1036*10 or "around 1000" times "10".
Lighthouse wrote: Sun Dec 29, 2024 1:24 am Can a tree absorb pollution below the "60 units in chunk" threshold for an indefinite amount of time, thus removing more than 10 units in total?
This is quite easy to test with the command you posted and is what i already tested, the answer is yes
Lighthouse
Inserter
Inserter
Posts: 37
Joined: Wed Nov 20, 2024 3:09 am
Contact:

Re: Interpretation of graph of pollution consumption by trees

Post by Lighthouse »

mmmPI wrote: Sun Dec 29, 2024 4:45 am
Lighthouse wrote: Sun Dec 29, 2024 1:24 am -> I don't understand the deviations from 10k. Otherwise I would say "If a tree 'dies' ( = trunk or grey progression reach max value) 10 pollution units are removed".
"if a tree dies 10 pollution unit are removed" => this appear incorrect, or with 100 trees the maximum pollution absorbed would be around 1000 and not 10 000. If you try to reproduce the experiment with 50 trees or 200 trees that may become more obvious to you that the relation is 1036*10 or "around 1000" times "10".
I was off by a factor of 10, right. I changed my previous post to be less confusing for who reads this later.

---

I did additional tests:

One tree, one stone furnace -> constant pollution bellow 60-threshold, all within one chunk (inside the wall), and some logic circuit for additional time keeping
12-29-2024, 12-43-06.png
12-29-2024, 12-43-06.png (296.21 KiB) Viewed 669 times
In this screenshot we see that one tree was able to absorb 134 pollution after 40 hours.
12-29-2024, 12-44-55.png
12-29-2024, 12-44-55.png (47.14 KiB) Viewed 669 times
We also see a strange spike due to "tiles" which I cannot explain - I did not place and remove any tiles.

Then I applied 1,000,000 pollution and we see that the tree consumed 110 pollution:
12-29-2024, 12-48-20.png
12-29-2024, 12-48-20.png (47.5 KiB) Viewed 669 times
I actually reset this test several times and used different trees and I always got 110... which is unexpected. Would have expected between 99 and 101, according to the test results with 100 trees.

Also I wondered about the scale in the graphs - it was showing "0.1", but 0.06 per minute was expected. So here is a test with 10 trees with the same setup. The graph with 10 trees looks like this:
12-29-2024, 12-54-07.png
12-29-2024, 12-54-07.png (42.57 KiB) Viewed 669 times
I observe unexpected intervals between 0.5 and 0.6 - I expected a smooth line at 0.6. But the integration reads "0.6/m" so this is fine for me.

So to my understanding the wiki is off/misleading in these aspects:
A tree can consume more than 10 pollution units. If below 60-unit-threshold the total amount is unlimited. On death of tree about 100 additional units are consumed.
mmmPI
Smart Inserter
Smart Inserter
Posts: 3974
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Interpretation of graph of pollution consumption by trees

Post by mmmPI »

Lighthouse wrote: Sun Dec 29, 2024 12:00 pm So to my understanding the wiki is off/misleading in these aspects:
A tree can consume more than 10 pollution units. If below 60-unit-threshold the total amount is unlimited. On death of tree about 100 additional units are consumed.
To my understanding the wiki is clear on the first part , and is more precise than your simplification for the second.
Lighthouse
Inserter
Inserter
Posts: 37
Joined: Wed Nov 20, 2024 3:09 am
Contact:

Re: Interpretation of graph of pollution consumption by trees

Post by Lighthouse »

I try to get more info on the 'grey progression' and 'trunk progression', particularly how many stages there are for each. I found this page in the documentation:
https://lua-api.factorio.com/latest/typ ... ation.html
Tree has number of "dying" stages, which is deduced from frame count of shadow if shadow is defined, otherwise from frame count of trunk. Frame count of leaves has to be one less than deduced number stages, as last stage is always assumed to be leafless.
The wiki only states:
[...] trees [...] have a chance to either lose one stage of leaves or have their leaves become one stage more gray. [...] A tree stops losing leaves/becoming more gray once the sum of its gray percentage and its leaves lost percentage is above 120%.
The table in the wiki describes four stages for leaves:
12-30-2024, 13-01-36.png
12-30-2024, 13-01-36.png (18.92 KiB) Viewed 587 times
The tests show, that each tree stops loosing leaves/becoming more gray after about 9-11 applications of damage. But 9-11 applications of damage are not possible if greyness and leaves have 4 stages each.

I looked into raw.txt and the only info on 'frame count of trunk' (or shadow) i found is this part

Code: Select all

subgroup = "trees",
      type = "plant",
      variations = {
        {
          [...]
          shadow = {
            [...]
            frame_count = 2,
            [...] 
          },
          trunk = {
            [...]
            frame_count = 1,
            [...]
          }
        },
        [...]
but frame_count = 1 (or 2) does not tell me why about 10 applications of damage can occur.
mmmPI
Smart Inserter
Smart Inserter
Posts: 3974
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Interpretation of graph of pollution consumption by trees

Post by mmmPI »

I believe none of this is necessary to understand the average of "9-11" stages and the wiki information that you truncated explain it well.
Lighthouse
Inserter
Inserter
Posts: 37
Joined: Wed Nov 20, 2024 3:09 am
Contact:

Re: Interpretation of graph of pollution consumption by trees

Post by Lighthouse »

mmmPI wrote: Tue Dec 31, 2024 4:20 pm I believe none of this is necessary to understand the average of "9-11" stages and the wiki information that you truncated explain it well.
Actually the wiki is incomplete/misleading/wrong in some aspects about trees@pollution in several aspects and precise info helps to fix it.
mmmPI
Smart Inserter
Smart Inserter
Posts: 3974
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Interpretation of graph of pollution consumption by trees

Post by mmmPI »

Saying 100 pollution is absorbed when a tree die is wrong, you are not adding more precise information imo.
Lighthouse
Inserter
Inserter
Posts: 37
Joined: Wed Nov 20, 2024 3:09 am
Contact:

Re: Interpretation of graph of pollution consumption by trees

Post by Lighthouse »

Neither is your assumption correct of what I want to write. Nor is your statement correct that it would not be more precise. You can compare the wiki to the details in this thread yourself, but let me state one example:

current quote from the wiki:
Regardless of whether the tree loses leaves or gets grayer, 10 pollution are absorbed by the tree.
The tree itself only consumes 0,001 per second. The damaging of the tree itself is what consumes the pollution, not the tree. You can see that in game here:
01-01-2025, 14-21-44.png
01-01-2025, 14-21-44.png (8.32 KiB) Viewed 385 times
But that's just one aspect. Please compare the wiki and the details in this thread.
mmmPI
Smart Inserter
Smart Inserter
Posts: 3974
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Interpretation of graph of pollution consumption by trees

Post by mmmPI »

Lighthouse wrote: Wed Jan 01, 2025 1:22 pm Neither is your assumption correct of what I want to write. Nor is your statement correct that it would not be more precise. You can compare the wiki to the details in this thread yourself, but let me state one example:

current quote from the wiki:
Regardless of whether the tree loses leaves or gets grayer, 10 pollution are absorbed by the tree.
The tree itself only consumes 0,001 per second. The damaging of the tree itself is what consumes the pollution, not the tree. You can see that in game here:
01-01-2025, 14-21-44.png

But that's just one aspect. Please compare the wiki and the details in this thread.
You open a thread on gameplay help, and started posting wrong things while saying the wiki is wrong. Not sure what else to say.

The wiki correctly explain that there are 2 mechanisms , one passive absorption, one when tree gets damaged.

https://wiki.factorio.com/Tree
Every single tree absorbs a small amount of pollution in its chunk per second.
If the total pollution in a chunk is above 60 units, once per second some of the trees in that chunk each have a chance to either lose one stage of leaves or have their leaves become one stage more gray. Regardless of whether the tree loses leaves or gets grayer, 10 pollution are absorbed by the tree.
Lighthouse
Inserter
Inserter
Posts: 37
Joined: Wed Nov 20, 2024 3:09 am
Contact:

Re: Interpretation of graph of pollution consumption by trees

Post by Lighthouse »

I see you did not fully understand. But let's drop that dispute for now. I will discuss the details in the Wiki section of the forum with others.
mmmPI
Smart Inserter
Smart Inserter
Posts: 3974
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Interpretation of graph of pollution consumption by trees

Post by mmmPI »

I see no dispute here, i'm just providing factual information :

The 2 different mechanism by which pollution are absorbed are explained in the wiki and when you don't try to remove parts of the sentence it's quite clear.

The order of magnitude used in the wiki are confirmed by boskid, the information are "correct" it would seem there is no issue here.
Post Reply

Return to “Gameplay Help”