Script to speed up Steam Cloud sync by excluding autosaves

Enhance your gameplay with these tools. This category is also the right place for tools useful for modders.
Mod databases, calculators, cheatsheets, multiplayer, scripts, libs and other useful stuff that is not strictly in-game mods.
Post Reply
evg-zhabotinsky
Inserter
Inserter
Posts: 22
Joined: Wed Dec 09, 2020 3:53 pm
Contact:

Script to speed up Steam Cloud sync by excluding autosaves

Post by evg-zhabotinsky »

Note: I am running Linux so all this is for Linux. But I believe on Windows Steam Cloud behaves the same and the script can be rewritten for cmd/powershell.

Ever had to wait for what felt like eternity for Steam to finish syncing your saves, after closing game or, even worse, before starting it?
The reason is Steam Cloud is somewhat slow, especially for large files, and saves of big factories are huge!
Adding insult to injury, it also syncs your autosaves to cloud! That's four times the wait if your are playing one save with default 3 autosaves.
If you configured more autosaves, the "eternity" above gets quite real on a slow-uplink connection.
And if you really want to sync your (non-auto-)saves that becomes a problem.

One may argue that autosaves don't belong in the cloud and post a suggestion to exclude them from sync completely, but:
a) Not everyone might believe so, so it has to be optional, and IMO that option might not fit well in settings GUI, so a rarely used config file option.
b) Even if devs take the time to implement it properly, it would take time. I want faster sync "Now!"

So I wrote a simple script that moves autosaves to a separate directory "autosaves" placed next to "saves", thus hiding them from Steam Cloud and speeding up sync.

This also hides autosaves from the game, so the script has to move them back when the game is running.
In general, Steam assumes that all the changes to saves done while game is running are done by the game, and reverts those done while it isn't running.
When the script is run by Steam, it is treated as if it was the game itself.
It moves autosaves to 'saves' directory, runs the actual game, and after it closes moves autosaves back to 'autosaves' dir before terminating.
So the game always sees the autosaves, while Steam Cloud never does.

The script is on Github: evg-zhabotinsky/RandomStuff/master/Factorio/autosave-segregator.sh To use it:
- Download it to your '~/.factorio' directory (next to 'saves' dir) as 'autosave-segregator.sh'.
- Make it executable: 'chmod +x ~/.factorio/autosave-segregator.sh'
- Put '~/.factorio/autosave-segregator.sh %command%' in Factorio launch options in Steam.

P.S.
You can change autosave count in '~/.factorio/config/config.ini' (when game is closed).
Uncomment the line "autosave-slots=3" and set whatever number you like.
P.P.S.
If you set autosave interval low enough, and your factory is large enough, autosaves can get really annoying!
Set "non-blocking-saving=true" in the same config and saving won't halt your game ever again!
This option is considered experimental/dangerous, though, and on Windows does nothing and probably never will.

Post Reply

Return to “Tools”