Difference between revisions of "Active effect time imprecision bug"

→‎Details: clearer sentence order
imported>DavidJCobb
imported>DavidJCobb
(→‎Details: clearer sentence order)
Line 7: Line 7:
:floor(elapsed_time / interval) ≠ floor((elapsed_time + frame_time) / interval)
:floor(elapsed_time / interval) ≠ floor((elapsed_time + frame_time) / interval)


However, the active effect's elapsed time is stored as a single-precision floating-point number. This means that once it reaches a high enough value, the frame time (the seconds per frame) may be too small for the addition to actually work and change the elapsed time. This prevents conditions from ever being re-processed. The same problem can cause the game to fail to advance the elapsed time itself: if a temporary effect has an especially long duration, then the elapsed time may stop being reliably counted before that duration is reached, making the effect endless. The problem affects all active effects, even if they do not have a duration limit.
However, the active effect's elapsed time is stored as a single-precision floating-point number. This means that once it reaches a high enough value, the frame time (the seconds per frame) may be too small for the addition to actually work and change the elapsed time. This prevents conditions from ever being re-processed — an issue that affects all active effects, even if they do not have a duration limit. The same problem can cause the game to fail to advance the elapsed time itself: if a temporary effect has an especially long duration, then the elapsed time may stop being reliably counted before that duration is reached, making the effect endless.


There is a wrinkle: when you fast-travel, sleep, wait, or serve time in prison, the game will simulate the passage of real-time. If your timescale is 20, the default, then 900 seconds of real-world time represents five hours (18000 seconds) of in-game time. If you wait for five hours in-game, then the game performs that conversion in reverse and simulates 900 seconds of real-world time. This affects active effects' elapsed time, and the simulated blocks of time may be large enough to overcome floating-point imprecision when normal frame times would not.
There is a wrinkle: when you fast-travel, sleep, wait, or serve time in prison, the game will simulate the passage of real-time. If your timescale is 20, the default, then 900 seconds of real-world time represents five hours (18000 seconds) of in-game time. If you wait for five hours in-game, then the game performs that conversion in reverse and simulates 900 seconds of real-world time. This affects active effects' elapsed time, and the simulated blocks of time may be large enough to overcome floating-point imprecision when normal frame times would not.
Anonymous user