Page 1 of 1

[0.16.51] Assemblers remain fast even after removing faster-assemblers mod.

Posted: Thu Nov 29, 2018 6:07 pm
by eradicator
Reproduction:
  1. start an unmodded game
  2. build stuff
  3. save game
  4. install Over 9000!
  5. load game
  6. save game
  7. disable Over 9000!
  8. load game
  9. -> bug
Or load the demo savegame without any mods, open an assembler gui and see that it produces instantly.
If the assembler is destroyed and rebuilt by bots it behaves normally afterwards.


_bugtest_assemblers_too_fast_post9000.zip
(1.08 MiB) Downloaded 98 times

Re: [0.16.51] Assemblers remain fast even after removing faster-assemblers mod.

Posted: Fri Nov 30, 2018 12:15 am
by TruePikachu
I'm assuming the version you released the other day? I poked into the Lua, doesn't look to be anything that would make this clearly NaB there (e.g. setting the force's crafting speed modifier). All the relevant code does is set `crafting_speed` on `assembling-machine`s and `furnace`s to 9001:

Code: Select all

for _,this in pairs(data.raw['assembling-machine']) do
  this .crafting_speed = 9001
  end

for _,this in pairs(data.raw['furnace']) do
  this .crafting_speed = 9001
  end

Re: [0.16.51] Assemblers remain fast even after removing faster-assemblers mod.

Posted: Sat Dec 01, 2018 9:43 am
by eradicator
TruePikachu wrote:
Fri Nov 30, 2018 12:15 am
I'm assuming the version you released the other day?
The version is irrelevant. The bug happens when the mod is disabled. And there exist no force bonusses that could affect assemblers even if i wanted to.

Re: [0.16.51] Assemblers remain fast even after removing faster-assemblers mod.

Posted: Sat Dec 01, 2018 3:54 pm
by Jap2.0
Do assemblers save their crafting speed? If so, is this a bug? If so, should they save their crafting speed?

Re: [0.16.51] Assemblers remain fast even after removing faster-assemblers mod.

Posted: Sat Dec 01, 2018 6:29 pm
by cbhj1
Sounds like the entity state is saved, then only updated on changes from there. Bet it would update if you poked it with a module or changed the recipe.

edit: had a moment to test it, the crafting speed updates on load, but the issue sticks until the recipe is changed, that would indicate some cached precalculated craft time that stays with the entity outside the mod.

Re: [0.16.51] Assemblers remain fast even after removing faster-assemblers mod.

Posted: Sun Dec 02, 2018 7:20 pm
by Rseding91
Most likely the process is saved in the machine and when the mod is removed the total progress needed changes resulting in it having several crafts worth of progress already saved.

Re: [0.16.51] Assemblers remain fast even after removing faster-assemblers mod.

Posted: Sun Dec 02, 2018 9:24 pm
by eradicator
Rseding91 wrote:
Sun Dec 02, 2018 7:20 pm
Most likely the process is saved in the machine and when the mod is removed the total progress needed changes resulting in it having several crafts worth of progress already saved.
I originally discovered the bug while testing circuit build layouts, which included running the layout for at least equivalent to one real time hour (using game.speed) after removing the mod, though i can't say how long the mod was active before that because i only had it activated accidentially.

TL;DR: "several" was quite large if that is how it happend.

Re: [0.16.51] Assemblers remain fast even after removing faster-assemblers mod.

Posted: Sun Dec 02, 2018 11:44 pm
by TruePikachu
I loaded the save, paused it at tick 40817, and attached WinDbg to investigate the entity state. Unit number 149 (rightmost circuit assembler) had `extraEnergyForProduct` = 8816.795833; I believe that "energy" in this context refers to the equivalant amount of handcrafting time, so that particular assembler still had over two hours of handcrafting-green-circuits work stored inside. I'd need a dev to confirm my conjecture on the field's meaning, but this seems like it's NaB, or at least a minor issue.

Re: [0.16.51] Assemblers remain fast even after removing faster-assemblers mod.

Posted: Sat Dec 22, 2018 6:17 am
by Rseding91
There's an underlying problem: when a crafting machine is so fast that it produces > 100% progress per tick it will accumulate "left-over" progress forever.

I can "fix" it 1 of 2 ways:

1. I cap the progress to 100% per tick.
2. I make crafting machines support producing multiple crafts per tick.

Re: [0.16.51] Assemblers remain fast even after removing faster-assemblers mod.

Posted: Sun Jan 06, 2019 1:10 am
by Rseding91
I think for now I'm just going to do nothing and move this to minor issues.

Re: [0.16.51] Assemblers remain fast even after removing faster-assemblers mod.

Posted: Sat May 04, 2019 1:28 pm
by eradicator
Rseding91 wrote:
Sat Dec 22, 2018 6:17 am
2. I make crafting machines support producing multiple crafts per tick.
Just for the record, i would prefer this over capping.