Page 1 of 1

[0.17.25] Probabilistic catalysts are not treated as catalysts for productivity bonuses

Posted: Sun Apr 07, 2019 5:31 am
by DaleStan
TL;DR
Catalysts with probabilistic return, instead of guaranteed return, are not treated as catalysts for the purposes of productivity bonuses.
Reproduction
Load the attached save game, synchronizing mods and startup settings (angelspetrochem, angelsrefining, angelssmelting, boblibrary, bobmodules, and bobplates. Bob's modules has God modules enabled. I believe all other mod settings are default.)
Observe that:
- There are 200 Mono Silicon Seeds and 200 Quartz Crucibles in the chest to the left of the Casting Machine MK4, and 25k of Molten Silicon in the tank.
- The recipe in the Casting Machine takes 1 Mono Silicon Seed, 1 Quartz Crucible, and 40 Molten Silicon, and produces 6 Mono Silicon and 80% chance of 1 Quartz Crucible.
- The Casting Machine has +100% productivity (and other bonuses)
Turn on the switch.
Wait about 1 minute, while the Casting Machine processes its inputs.
Observe that:
- Expected: The left chest is empty.
- Expected: The tank has lost 200 * 40 = 8000 molten silicon (down to 17k)
- Expected: The upper-right chest contains 200 * 6 * 2 = 2400 Mono Silicon.
- Expected: The casting machine shows "Products finished: 400".
- Unexpected: The lower-right chest contains about 320 Quartz Crucibles. (309, 310, and 315 when I ran this test)

I expected to see the Quartz Crucible treated as a catalyst. Instead of about 200 * 2 * 0.8 = 320 crucibles in the chest, I expected to see about 200 * 0.8 = 160.

Re: [0.17.25] Probabilistic catalysts are not treated as catalysts for productivity bonuses

Posted: Sun Apr 07, 2019 8:17 am
by clampi
Hello DaleStan,

I would say that this is more a misunderstanding of your side than a defect on Factorio engine.

For Factorio engine, there is no such thing as catalyst. Modders requested the feature but is not implemented. One thing that might trigger your confusion further is that the reporting panel "considers" a catalyst some ingredient that is in input and in output. For those ingredients it computes the difference output amount -input amount and decides if is a consumption or a production and reports in the respective panel. This is only for "Production Panel".

Now, giving that the engine does not treat inputs in a special way with regards with "Catalyst", let me try to explain what's going on under the hood and why the result is the expected result.
For your example of recipe from angelssmelting, the "Quartz Crucibles" should not be considered a "Catalyst" but more of an ingredient that can be reused a number of times after which it worn off and is discarded. To code that in the engine, Angel used the 80% probability for a return, meaning more or less about 20 uses after which the item is discarded. Take note, is not exactly 20 uses, is a geometric series with 0.8 as multiplicative coefficient, so the 1st craft has 80%, second 64%, third 51% and so on.

What I explained above is the intent of the modder, with his chosen implementation in the engine, implementation of the intent in the engine so to speak. Note also that according to his intent, the recipe is not meant to be used with productivity modules of any kind, precisely because recipes with reusable ingredients break the intent when productivity is applied. A similar intent can be seen for the 3rd tier of glass recipe, as if you apply productivity, you get more tin out than you have put in, whereas it should be exactly the same, it is a reusable ingredient that should be neither lost nor gained over time.

As you disregarded the intent of the modder and used the "bobmodules" ability of applying productivity for recipes that should not have any, the result is what is expected with the given facts. So, you either apply the initial modder intent by reverting the option in bobmodules (Settings->Mod Settings->Startup->[Bobmodules] Productivity Limitation checked) or live with your choice. Nothing unexpected or buggy in my opinion.

Re: [0.17.25] Probabilistic catalysts are not treated as catalysts for productivity bonuses

Posted: Sun Apr 07, 2019 9:42 am
by mrudat
I was under the impression that the engine does actually support a specific case of catalysts; It was mentioned that productivity is now allowed for the kovarex process, because the engine now sees the recipe as ingredients, catalyst, results, and applies productivity only to the results.

It's entirely probable that a fractional or probabilistic result doesn't count as a catalyst, however.

Re: [0.17.25] Probabilistic catalysts are not treated as catalysts for productivity bonuses

Posted: Sun Apr 07, 2019 2:02 pm
by DaleStan
clampi wrote: Sun Apr 07, 2019 8:17 amAs you disregarded the intent of the modder and used the "bobmodules" ability of applying productivity for recipes that should not have any
No, I did not. Bob's modules does have that feature, but I did not enable it. Angel natively allows a productivity bonus for that recipe without using that extra checkbox in Bob's modules. I could have reproduced this with vanilla modules, but the difference between 160 and 192 is a lot less obvious than the difference between 160 and 320.
mrudat wrote: Sun Apr 07, 2019 9:42 amI was under the impression that the engine does actually support a specific case of catalysts; It was mentioned that productivity is now allowed for the kovarex process, because the engine now sees the recipe as ingredients, catalyst, results, and applies productivity only to the results.
This is exactly my understanding too. It works for kovarex enrichment, so it's reasonable to expect it to work in modded recipes too. But also reasonable that modded recipes with probabilistic outputs got missed.

Re: [0.17.25] Probabilistic catalysts are not treated as catalysts for productivity bonuses

Posted: Mon Apr 15, 2019 3:53 am
by alercah
It seems that explicitly specifying catalyst_amount in the recipe will make it work, but it's unclear if this should be considered a bug still or not. I've reported this on Angel's bug reports.

Re: [0.17.25] Probabilistic catalysts are not treated as catalysts for productivity bonuses

Posted: Mon May 06, 2019 3:46 pm
by kovarex
If it is probabilistic, it should probably be explicitly marked as catalyst, I prefer if the automated detection of catalysts is conservative.