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

Bugs that are actually features.
Post Reply
User avatar
tiriscef
Long Handed Inserter
Long Handed Inserter
Posts: 98
Joined: Thu Mar 28, 2019 8:45 pm
Contact:

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

Post 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.
Attachments
pollution desaster.zip
(2.3 MiB) Downloaded 56 times
factorio-current.log
(6.54 KiB) Downloaded 56 times
Unbenannt.png
Unbenannt.png (44.83 KiB) Viewed 1319 times

Loewchen
Global Moderator
Global Moderator
Posts: 8308
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

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

Post 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.

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

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

Post 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.

User avatar
tiriscef
Long Handed Inserter
Long Handed Inserter
Posts: 98
Joined: Thu Mar 28, 2019 8:45 pm
Contact:

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

Post 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.

Bilka
Factorio Staff
Factorio Staff
Posts: 3129
Joined: Sat Aug 13, 2016 9:20 am
Contact:

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

Post 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.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Post Reply

Return to “Not a bug”