Skip to content
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

Editor autosave #1554

Merged
merged 3 commits into from
Nov 6, 2020
Merged

Editor autosave #1554

merged 3 commits into from
Nov 6, 2020

Conversation

Semphriss
Copy link
Member

Closes #1551

The new autosave feature will automaticaly save the current level to a backup file (not the level file, but a different one) each time the level is tested or at most 5 minutes after the level was last saved/auto-saved (amount of time customizable through the editor pause menu).

If the editor crashes, the recovery file will survive and will be detected by the editor on next launch. Level editors will have the option to open the recovery file or not.

  • If they choose to open the recovery file, they must save the file manually to apply the recovery data to the main save file. Not saving before quitting the editor will discard the recovery data permanently.
  • If they choose to not open the recovery file, the regular file will be opened instead and progress will be where it was at the last manual save (Ctrl+S, or through the menu). Although from this point onwards, the recovery file is already assumed to be gone, it will not actually be deleted/overwritten unless the user takes one of the actions listed below.

The recovery file is deleted when:

  1. The user saves the level manually.
    The recovery file is deleted until a new autosave request is initiated by the game. The reason is that manually saving makes the regular file more recent than the recovery file; the auto-save would then be useless, as it is older than the actual save.

  2. The user quits the editor.
    Quitting the editor is considered a normal operation. The user is assumed to be aware of the state of the save file upon quitting the editor (they will be told if their level has unsaved changes and asked to confirm their choice). The recovery file is then needless (no need to offer a user to recover unsaved changes if they explicitly chose to discard them).


if (PHYSFS_exists((file_name_full + "~").c_str())) {
auto dialog = std::make_unique<Dialog>(/* passive = */ false, /* auto_clear_dialogs = */ false);
dialog->set_text(_("An auto-save file has been found. Would you like to open the auto-save file?\n"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about the string here. I'd suggest something more user-friendly, such as "Would you like to restore your the level you were last working on?" or something? Or other suggestions?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm open to changing the line if needed, but I'd like to keep the part that says the message is shown because a recovery file was found. There might be bugs I haven't noticed that would leave the recovery file there (say, the file deletion fails for some reason), and seeing the warning without knowing why it pops in the first place could cause some confusion.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few suggestions:

  • "It looks like the editor crashed last time you opened this level. Would you like to continue where you left off?"
  • "An auto-save recovery file was found. Would you like to restore the recovery file and resume where you were before the editor crashed?"
  • "It looks like you have some unsaved progress on that level. This can happen if the editor crashes. Would you like to resume where you left off?"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest making one that is as short but effective as possible. Players do not like to read one large string that can be easily summarized and have the same effect.

@tobbi tobbi merged commit 44adc43 into master Nov 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants