Active effect time imprecision bug: Difference between revisions
Jump to navigation
Jump to search
name; deets; clarified that this can also make temporary effects become endless
imported>DavidJCobb (information) |
imported>DavidJCobb (name; deets; clarified that this can also make temporary effects become endless) |
||
| Line 1: | Line 1: | ||
Skyrim's handling of magic effect duration suffers from two | The '''active effect time imprecision bug''', more commonly known as the '''ability condition bug''', is an issue that causes long-lasting [[Magic Effect|magic effects]] to stop re-processing their conditions after a long enough time has passed. This most often affects ability [[Spell|spells]] that have been added to the player. Skyrim's handling of magic effect duration suffers from two issues, both related to the effects of floating-point imprecision on an active effect's elapsed time (measured in seconds). Once the elapsed time reaches a high enough value, it cannot be reliably increased, which breaks both the handling of effect durations and the handling of effect conditions. | ||
== Details == | |||
Skyrim re-processes an active effect's conditions at one-second intervals after the effect is applied. (This is not a global interval; it's based on the active effect's elapsed time, which allows each effect to update independently of the others and prevents the game from having to do tons of work on a single frame.) It does so when this calculation is true: | Skyrim re-processes an active effect's conditions at one-second intervals after the effect is applied. (This is not a global interval; it's based on the active effect's elapsed time, which allows each effect to update independently of the others and prevents the game from having to do tons of work on a single frame.) It does so when this calculation is true: | ||
| Line 5: | 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. 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. 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. | ||
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. | ||