New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto-save support #386
Comments
Hi Bertram; have you done any preliminary work on this task? If not, I'd be up for this. It'd be a time-saver for when crashes happen (and could be useful for diagnosing crashes). |
Fine by me, but please propose the use-cases before implementing them. I, myself, haven't looked at it closely enough to say whether the summary is enough to make something fine to play with. :) |
Proposed design: Whenever a user leaves a map, an auto-save is generated before the next map is loaded. This should be done as early as possible so that if a crash occurs in the process of loading the next map (which is easy to do atm if there's a typo in the lua map script), the user retains his/her progress. Loading the auto-save should initialize the map that was being loaded. In other words, though the auto-save is being taken prior to the new map being loaded, loading the auto-save should result in the new map being initialized (along with any triggers on entering the new map). An options entry should be introduced for enabling/disabling auto-saves (enabled by default). A nice-to-have would be a third option: Minimal auto-saves (ie, not bothering to auto-save on map transitions within a city, only on first entering the city). We can start naive with auto-saves on each map transition, and expand on this later. One concern is time spent in file I/O. It's quick on my machine (desktop, SSD, fast CPU), but may noticeably increase map transition times on other platforms (especially some of the more limited/embedded platforms people have gotten this to run on). If we run into this, a good solution would be either a new options entry or a compilation variable for streamlining auto-saves, spinning off an auto-save on a separate thread so map transition times aren't noticeably impacted. I haven't reviewed how save games work yet. If a save game isn't a complete snapshot of the game state (if, for example, player status effects are shaved off), there's some risk of abuse by users. Will need to explore this. What are your thoughts? |
Thanks for the analysis :)
Yeah, one auto-save slot can be used, even as a start on this. Btw, saving on a regular save-point should either delete the auto-save, or the engine should propose the most recent file per default. I mean not propose the auto-save if its corresponding slot is newer.
Well no. The auto-save should be created just after the map has loaded, for several reasons:
IMHO, let's not overcomplicate this. Let's go with regular auto-save support whatever the map, and let us rather tell the engine an auto-save shouldn't be created on certain map transitions instead, for story purpose.
This is a more general topic IMHO. Saving a game takes really few time and can be "hidden" just before the fade-in after the new map loading process. Moving certain thing on different threads shouldn't be taken lightly, and resources loading is not the first thing I'd move out. (I'd first move audio in a separate thread to be honest ;])
There is already a "risk" of abuse from players as the save format is in plain text, formatted for lua. Best regards, |
- Don't autosave on each map mode "Reset" (for instance triggered when pausing.) - Reset the map saved location after loading to act like a regular save point, and prevent breaking certain transitions. Certain maps may still not respect the autosave position, but I've seen no broken examples so far, the default map position is the cases I tested. Part of #386
- Delete autosave when saving. - Don't create an autosave when loading a save as it doesn't make sense. Part of #386
Unset save location after map loading to permit autosave to work, even when no auto save is done at startup. Part of #386
The game is lacking auto-save support:
Each time the character is changing from a map to another, an auto-save game should be created.
Then, when loading a game, the player should asked whether her prefers loading the auto-save or the regular one.
The auto-save loading should be proposed only if the regular savegame is older than the auto-save file.
The text was updated successfully, but these errors were encountered: