bugfix(saveload): Save the next evaluation frame of delayed scripts - #3130
Draft
bobtista wants to merge 3 commits into
Draft
bugfix(saveload): Save the next evaluation frame of delayed scripts#3130bobtista wants to merge 3 commits into
bobtista wants to merge 3 commits into
Conversation
Caball009
reviewed
Aug 13, 2026
…L_COMPATIBLE_XFER_SAVE
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.
Script::xferonly transfers the active flag, som_frameToEvaluateAtis never restored when a save is loaded.ScriptList::xferwalks the scripts that were rebuilt from the map rather than creating them from the save, so nothing else restores it either, and the field keeps whatevercheckConditionsForTeamNamesassigned during setup - a random stagger of 0 to 60 frames. Any real load frame is past that, soScriptEngine::executeScript's frame check always passes: every script with a delay evaluates on its first pass after loading and then re-times itself from the load frame, losing both the remainder of its interval and its original stagger. 893 scripts across 35 stock maps use a non-zero delay, including every Generals Challenge map and most campaign missions.Now the field is transferred in a version 2 xfer, so a delayed script resumes on the frame it was already waiting for. Version 1 saves still load and keep the old behaviour. The field also moves above the "Runtime fields - not saved or read" comment in the header, since it is now saved.
Measured on MD_CHI01 by saving at logic frame 3000 and loading the save back, logging the field on both sides of the xfer. The numbers are
m_frameToEvaluateAtitself, an absolute logic frame at 30 frames per second:Before the fix the load replaces the saved value with a freshly generated stagger, after the fix it round-trips exactly.
Todo: