Opened 7 years ago

Last modified 5 years ago

#4417 assigned enhancement

[PATCH] Autosave the singleplayer game

Reported by: Vladislav Belov Owned by: Vladislav Belov
Priority: Should Have Milestone: Work In Progress
Component: UI – In-game Keywords: patch rfc
Cc: Patch:

Description

It would be good to have autosaves for single-player games, in case when player exited without saves or crashed.

It should be easy to turn on/off and setup a period.

Attachments (2)

4417_autosave.patch (3.8 KB ) - added by Vladislav Belov 7 years ago.
Adds autosaves
4417_autosave.2.patch (3.7 KB ) - added by Vladislav Belov 7 years ago.
Adds autosaves, uses number instead of dropdown

Download all attachments as: .zip

Change History (10)

comment:1 by Vladislav Belov, 7 years ago

Keywords: patch rfc added
Milestone: BacklogWork In Progress
Owner: set to Vladislav Belov
Status: newassigned
Summary: Autosave the singleplayer game[PATCH] Autosave the singleplayer game

by Vladislav Belov, 7 years ago

Attachment: 4417_autosave.patch added

Adds autosaves

comment:2 by Vladislav Belov, 7 years ago

There are few notes in patch above:

  1. "1 minute" / "5 minute" / ... are wider than the current dropbox width, so the width was increased.
  1. Not clear way to get (hard-coded) the number of minutes by the option value, but it's shorter than to have conditions in the option.js.
Last edited 7 years ago by Vladislav Belov (previous) (diff)

comment:3 by elexis, 7 years ago

Doing a savegame every N minutes is also what rewinding replays do (#3261). The most crucial part is the size of the output (see ticket). I was rather thinking about a max MB / game setting, than a time offset, so that the user can control the disk space. If we do have these savestates in the replay directory, we likely don't want to save duplicates. The attached patch in that ticket saves them to the replay directory, but the load and replay menu dialog could instead also match the matchID of save and replay files to identify which files belong together.

in reply to:  3 comment:4 by Vladislav Belov, 7 years ago

Replying to elexis:

Doing a savegame every N minutes is also what rewinding replays do (#3261). The most crucial part is the size of the output (see ticket). I was rather thinking about a max MB / game setting, than a time offset, so that the user can control the disk space.

The disk space is not problem for the patch above, because it writes in the only one file for every time every map.

If we do have these savestates in the replay directory, we likely don't want to save duplicates. The attached patch in that ticket saves them to the replay directory, but the load and replay menu dialog could instead also match the matchID of save and replay files to identify which files belong together.

The patch in the your ticket needs to use setTimeout, instead of implement your self.

I could suggest to save the current state to autosave, and the previous one move to replays.

Last edited 7 years ago by Vladislav Belov (previous) (diff)

comment:5 by mimo, 7 years ago

I agree with vladislav, size is not an issue here as autosaved games are constantly replaced, contrary to replays where they will be kept forever. It is rather the replay saves which should reuse the autosaved games if the overload of saving a game is big and both periods match.

Concerning the patch, we should keep a minimum of 2 (maybe 3 is better) saved games, possibly labelled by the elapsed time, and erase (or move to replays) the older one when a new one is created. I don't like the dropdown in the config options, which forces you to repeat the possible values when computing g_AutosavePeriod. Why not directly entering a number (as we do for the batch size).

by Vladislav Belov, 7 years ago

Attachment: 4417_autosave.2.patch added

Adds autosaves, uses number instead of dropdown

comment:6 by mimo, 7 years ago

Thanks for the new patch. Looks better imo with the type number.

You didn't comment on my remark about having at least two autosaved games (if you suffer a devastating attack just 1 mn after an autosave, you may want to recover the previous one to have some time to prepare your defense?). I think naming the autosaved game autosave_elapsedTime and if more than 2 files have name starting with autosave_, remove the older ones would work.

In my previous comments, i forgot lines 320-322: what's their purpose? if it's because the player could type anything in the option panel, it would be better to do checks there (and i think there was a ticket about such a feature). Currently, as the min in the option panel is 1, the test line 321 should always be satisfied?

in reply to:  6 comment:7 by Vladislav Belov, 7 years ago

Replying to mimo:

You didn't comment on my remark about having at least two autosaved games (if you suffer a devastating attack just 1 mn after an autosave, you may want to recover the previous one to have some time to prepare your defense?).

I didn't think about few autosaves until this moment.

I think naming the autosaved game autosave_elapsedTime and if more than 2 files have name starting with autosave_, remove the older ones would work.

I think we should name (save_id) it like autosave_1, autosave_2, autosave_3 (in case we have 3 last autosaves). But the description of an autosave will contain the elapsed time.

In my previous comments, i forgot lines 320-322: what's their purpose? if it's because the player could type anything in the option panel, it would be better to do checks there (and i think there was a ticket about such a feature). Currently, as the min in the option panel is 1, the test line 321 should always be satisfied?

Yes, just check for input values. Ok, I will move it.

comment:8 by Imarok, 5 years ago

Component: UI & SimulationIn-game UI

Move tickets to In-game UI as UI & Simulation got some sub components.

Note: See TracTickets for help on using tickets.