History rework - #162
Open
tiennou wants to merge 2 commits into
Open
Conversation
The idea is to side-step two issues: - mid-tick changes like ruins and resources have a temporary numeric `_id` assigned to them that leads to issues with some object overwriting others. - anything related to global intents, notably inter-room movement, appears different in replays than it does in real-time, since replays grab the position of the creep on an exit tile, while real-time has them on the destination instead.
This adds two phases to the main loop; - flushHistory takes care of uploading room chunks for rooms that aren't active by the time the chunk size cutoff comes. - saveDeactivatedRoomHistory handles saving the last tick data for rooms that don't stay active the following tick. Depends on a driver change.
tiennou
force-pushed
the
fix/history-post-tick-saving
branch
2 times, most recently
from
September 7, 2026 08:13
63a5333 to
7dc98b0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The first commit moves per-tick history saving at the start of the next tick instead of during the room processing; this fixes issues with global intents not appearing properly (inter room movement being the most visible), and also completely hides the temporary object id issues from bulk insertion, because now we only get actual database objects.
The second commit fixes an issue where only active rooms get to process, thus save their previous tick data, which makes a deactivating room miss its last active tick in the history. The other issue is related to rooms that stop ticking in the middle of a chunk and don't get to "upload" their chunk by the time the history chunk period ends (since, once again, it's linked to
processRoom). That second commit requires driver changes from screeps/driver#59.