[1.1.34] "Play for limited times" in editor, wraps around after 65536 ticks
Posted: Fri Jun 11, 2021 3:24 pm
I was trying to run a simulation in editor for 600000 ticks (10000 seconds). I want to calculate pretty precisely the average thoughput of various features of my build design, so I need to run it long, to get decent accuracy (i.e. to smooth out fluctuations, initial delays, etc).
However, it stopped after about 10000 ticks.
I narrowed it down, to be use of 16-bit unsigned integer somewhere probably.
Entering 65537 then clicking "Tick custom" will advance the game by 1 tick.
This also explains why 600000 ticks resulted in about 10000 ticks, because 600000 mod 65536
= 10176.
The issue happens with normal speed, and with other speeds (for example 64x).
Additionally, despite ticks_to_run being uint (so I expect 32 or 64 bit), in the API spec ( https://lua-api.factorio.com/latest/Lua ... cks_to_run ) , doing `/c game.ticks_to_run = 65537` results in an error.
I also noticed that entering 65535 then clicking "Tick custom" will in fact run forever and never pause.
Linux, steam version of factorio.
However, it stopped after about 10000 ticks.
I narrowed it down, to be use of 16-bit unsigned integer somewhere probably.
Entering 65537 then clicking "Tick custom" will advance the game by 1 tick.
This also explains why 600000 ticks resulted in about 10000 ticks, because 600000 mod 65536
= 10176.
The issue happens with normal speed, and with other speeds (for example 64x).
Additionally, despite ticks_to_run being uint (so I expect 32 or 64 bit), in the API spec ( https://lua-api.factorio.com/latest/Lua ... cks_to_run ) , doing `/c game.ticks_to_run = 65537` results in an error.
I also noticed that entering 65535 then clicking "Tick custom" will in fact run forever and never pause.
Linux, steam version of factorio.