Page 1 of 1

[0.18.47] Mining drills with negative pollution effects produce more pollution instead of less

Posted: Wed Aug 12, 2020 11:52 pm
by tiriscef
Hello,
a user reported a bug on my mod which seems to be caused by the base game.

In the given example the miner has a base pollution of 10/min and two modules with +50% and -75% pollution. The tooltip and the pollution production statistics show that the miner actually produces 11.25/min (+12.5%) instead of the expected 7.5/min (-25%).
The attached map save has a mining drill setup with the mentioned modules.

Re: [0.18.47] Mining drills with negative pollution effects produce more pollution instead of less

Posted: Thu Aug 13, 2020 12:37 am
by Loewchen
I did not look at the mod, but I think you are confounding the pollution modifier and energy usage modifier into one thing or are at least misunderstanding how vanilla speed modules already increase pollution.

Re: [0.18.47] Mining drills with negative pollution effects produce more pollution instead of less

Posted: Thu Aug 13, 2020 5:43 am
by kovarex
Well, without knowing the details, simple math seems to work properly: 100% (base value) + 50% - 75% is actually 75% (7.5 per second). The tooltip shows -25% after the value, which is also correct, as the value in brackets is change against normal value.

Re: [0.18.47] Mining drills with negative pollution effects produce more pollution instead of less

Posted: Thu Aug 13, 2020 8:44 am
by tiriscef
The problem is not the 'modifier' value in the brackets, but the 'actual' value before that.
Unless I'm seriously misunderstanding how the pollution is calculated, the pollution modifiers of all effect sources are added.
pollution = base value * (100% + sum(pollution modifiers))

10/min (base value) * (100% + 50% - 75%) = 7.5/min
The miner should produce 7.5 pollution per minute, but actually produces 11.25/min.

I experimented a bit around and it seems like the game actually multiplies the pollution with the power consumption modifier on top of that.
pollution = base value * (100% + sum(pollution modifiers)) * (100% - sum(power modifiers))

I can't tell if that is intentional or not, but it's unintuitive.
And if it's intentional, then the tooltip should somehow reflect that.

Re: [0.18.47] Mining drills with negative pollution effects produce more pollution instead of less

Posted: Thu Aug 13, 2020 9:03 am
by Bilka
tiriscef wrote: Thu Aug 13, 2020 8:44 am I experimented a bit around and it seems like the game actually multiplies the pollution with the power consumption modifier on top of that.
pollution = base value * (100% + sum(pollution modifiers)) * (100% - sum(power modifiers))

I can't tell if that is intentional or not, but it's unintuitive.
It is intentional, you can find some explanations of this mechanic on https://wiki.factorio.com/Module and https://wiki.factorio.com/Pollution#Modules.