RPG: Delay creation of autosaves and scorepoints to end of turn#1101
Merged
mrimer merged 3 commits intoCaravelGames:masterfrom Apr 5, 2026
Merged
RPG: Delay creation of autosaves and scorepoints to end of turn#1101mrimer merged 3 commits intoCaravelGames:masterfrom
mrimer merged 3 commits intoCaravelGames:masterfrom
Conversation
mrimer
approved these changes
Apr 5, 2026
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.
Currently, the
CC_AutosaveandCC_ScoreCheckpointcommands generate saves (and local highscore entries) at the moment they get processed. It turns out this is not actually a good idea, for a few reasons.The main reason is that it conflicts with how save validation works. We only validate saves based on the final state of each turn. If a scorepoint is generated, then the player goes on to leave the room (via script command) or dies in some way later in the turn, the save will always fail to validate. Additionally, since the information shown on the scorepoint dialog is also based on the state at the end of the turn, it can lead to the score shown on the dialog and the score saved locally not matching. This can cause confusion.
It's also possible to get a scorepoint from an illegal move this way, as the save will be created before any rewinds due to attempting to stab a monster with DEF higher that the player's ATK. This will also fail to validate, but will create a local highscore record.
For autosaves, you can create a save where the player dies immediately on loading. This is a bit weird. There also appears to be replay issues if an autosave is created on the turn a player goes to another level, which we definitely want to avoid.
I've fixed these problems by delaying the creation of autosaves and scorepoint records to the end of turn processing. Additionally, no records will be created if the player left the room or died.
Thread: https://forum.caravelgames.com/viewtopic.php?TopicID=47322