Resuming large simulations is currently quite slow because LiSE needs to replay the entire history of every entity for as long as it existed.
A keyframe would be a snapshot of the world state written to the database whenever LiSE shuts down. Instead of loading the whole history, then, it can just load that keyframe.
Time travel, then, is a series of edits applied to the state in that keyframe. Looking up the current state of the world means checking for the last available edit, but if there isn't one, or the keyframe comes after that, use what's in the keyframe.
You might also want to travel back in time to before the keyframe. This should not require loading the entire history. Instead we should load some number of ticks prior to the keyframe, and look up the world state "backwards" -- taking the state prior to the earliest edit after the time in question, or using the keyframe if there's none such.
An arbitrary number of keyframes should be permitted. This way you can keep multiple branches and switch between them all whenever you like without ever having to load all history. Every branch should have a keyframe at its start, plus however many more.
I won't worry too much about deleting or unloading keyframes for the time being.
Resuming large simulations is currently quite slow because LiSE needs to replay the entire history of every entity for as long as it existed.
A keyframe would be a snapshot of the world state written to the database whenever LiSE shuts down. Instead of loading the whole history, then, it can just load that keyframe.
Time travel, then, is a series of edits applied to the state in that keyframe. Looking up the current state of the world means checking for the last available edit, but if there isn't one, or the keyframe comes after that, use what's in the keyframe.
You might also want to travel back in time to before the keyframe. This should not require loading the entire history. Instead we should load some number of ticks prior to the keyframe, and look up the world state "backwards" -- taking the state prior to the earliest edit after the time in question, or using the keyframe if there's none such.
An arbitrary number of keyframes should be permitted. This way you can keep multiple branches and switch between them all whenever you like without ever having to load all history. Every branch should have a keyframe at its start, plus however many more.
I won't worry too much about deleting or unloading keyframes for the time being.