[2.1.7] Lab research speed 3+ results in innacurate science pack usage

Things that has been reported already before.
dupraz
Inserter
Inserter
Posts: 44
Joined: Fri Sep 01, 2023 6:45 pm
Contact:

[2.1.7] Lab research speed 3+ results in innacurate science pack usage

Post by dupraz »

How to reproduce.

Expected behavior:
- Place a new lab.
- Add 100 Automation science packs.
- Research Gun turret (costs 10).
- You are left with 90 Automation science packs.

factorio_1782215029.png
factorio_1782215029.png (60.24 KiB) Viewed 179 times

Actual behavior:
- Place a new lab.
- Add 100 Automation science packs.
- Have Lab research speed 3 (or later) unlocked.
- Research Gun turret (costs 10).
- You are left with 89 Automation science packs.

factorio_1782214895.png
factorio_1782214895.png (60.7 KiB) Viewed 179 times
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 4616
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [2.1.7] Lab research speed 3+ results in innacurate science pack usage

Post by boskid »

Duplicate 133495
dupraz
Inserter
Inserter
Posts: 44
Joined: Fri Sep 01, 2023 6:45 pm
Contact:

Re: [2.1.7] Lab research speed 3+ results in innacurate science pack usage

Post by dupraz »

boskid wrote: Tue Jun 23, 2026 11:48 am Duplicate 133495
I have read your explanation, but can you explain why this only happens after a specific threshold of research speed?
For example research speed 2 (x1.5) does not trigger this issue (reliably so, and appears not to rely on floating points at all), which might be a hint for a potential fix.
berggen
Inserter
Inserter
Posts: 38
Joined: Tue Sep 01, 2020 7:12 pm
Contact:

Re: [2.1.7] Lab research speed 3+ results in innacurate science pack usage

Post by berggen »

dupraz wrote: Tue Jun 23, 2026 11:57 am
boskid wrote: Tue Jun 23, 2026 11:48 am Duplicate 133495
I have read your explanation, but can you explain why this only happens after a specific threshold of research speed?
For example research speed 2 (x1.5) does not trigger this issue (reliably so, and appears not to rely on floating points at all), which might be a hint for a potential fix.
These are illustrative numbers only but let's say that you had a science that took 1 research point and labs researched at 0.1 research per tick. At base speed of 1x, it will take 10 ticks to research that 1 point.

Now you upgrade research speed to 1.2x. After 8 ticks you'll have researched .96 points of research. On the last tick, you consume 0.12 research points because that's the speed of research, so you complete your 1 research and .08 bottles of science slip away into the ether.

In practice, the amount of loss due to this single tick overspend is infinitesimal because labs are spending a lot fewer science bottles per tick, and you don't really need to worry about it. You haven't spent 11 science bottles instead of 10, you've spent 10.01 science bottles (leaving 89 unopened ones) instead of 10.
Post Reply

Return to “Duplicates”