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

autosave/netsave.sav is not numbered (unlike regular autosave/autosave#.sav) #9188

James103 opened this issue May 4, 2021 · 2 comments


Copy link

@James103 James103 commented May 4, 2021

Version of OpenTTD


Expected result

When autosave/netsave.sav would be overwritten, the savegame instead gets written to autosave/netsave2.sav, then autosave/netsave3.sav, and so on and so forth. At a certain point, the numbering wraps around back to 1 in order to prevent the autosave/netsave#.sav from taking up too much storage space.

Actual result

When autosave/netsave.sav would be overwritten, the savegame actually overwrites the previous savegame located at the same filename. This can become a problem in the following (non-exhaustive list of) circumstances:

  • The server restarts and the client fails to reconnect to the server. The server restart causes the client to generate a netsave.sav, then the client failing to reconnect causes another disconnect which generates another netsave.sav which overwrites the first and useful version.
  • You have a slow connection and get constantly disconnected from a server you play on. These disconnections each generate a netsave.sav. For various reasons, you want to be able to go back to any of the few most recent netsave.sav versions instead of just the single most recent version.
  • You are trying out different servers to see what they look like, but some of them instantly disconnect you once you join. You still like to see what these games looked like without having to manually go back to rejoin each server and save the game.

Steps to reproduce

  1. Follow the same steps to reproduce as in #8887.
  2. Check the autosave directory for any numbered netsave#.sav files.
  3. Notice that there's only a single netsave.sav despite that #8887 resulted in 2 netsave.sav saves being created.
Copy link

@LordAro LordAro commented May 8, 2021

I'm not convinced this is an issue. Netsaves aren't the same as autosaves - they only happen when something has gone wrong. As such, there should only ever be one of them which is either moved elsewhere if the user actually wants to keep it (though most likely just discarded/ignored)

Copy link

@TrueBrain TrueBrain commented May 10, 2021

We talked about this a bit on IRC, but basically it comes down to "what is netsave". Given a few other tickets @James103 has made, it is clear to me that his interpretation is different from ours. To be clear, neither is wrong. Just .. different.

netsave.sav is created by a function called ClientNetworkEmergencySave. And in my (and I guess @LordAro's) head it is exactly that: a savegame in case of an emergency to allow us to debug situations we otherwise couldn't.

How @James103 is seeing it, if I can be so free to put words in your mouth, it is a savegame to recover a network game you have played recently (as in, not the last game, but one before, or just time-wise not long ago).

I can understand the use-cases for the latter, it just is a change of its functionality. So, I am not opposed to changing what it does .. but if we do that, I would also like that the code is cleaned up a bit from the old meaning into the new. So no more Emergency save, but just ClientNetworkDisconnectSave or something. Together with that, we can give them the same love as autosave and make sure they don't instantly overwrite each other.

My 2 cents on this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants