factorio-server-manager icon indicating copy to clipboard operation
factorio-server-manager copied to clipboard

Enable the creation of named save while server is active.

Open Squelch opened this issue 1 year ago • 5 comments

Background

On the Saves page, the user is prevented from creating a save while the server is running. Factorio now allows the console command /c server-save This will save the game as the currently loaded filename in the same manner as Save and Stop Server on the Controls page. However, a non documented feature of this command is that it also allows a named save to be created ie /c server save 123 with .zip extension being appended automattically. Cannot-save-while-running

Suggestion

Instead of displaying the message that saves are not possible, branch the code from using system IO file creation while game is not running, to issuing an RCON command to save the savegame name entered in the field while the game is running. Save-while-running

Expected result:

Save-Complete

The same result can be achieved from the console page, or by issuing the command ingame of course, but this suggestion would appear more intuitive, and remove the suggestion that no save while running is not possible.

Squelch avatar Jul 15 '24 15:07 Squelch

That is a great suggestion. Also there is no need to run the LUA console. The command /server-save can be used directly.

knoxfighter avatar Jul 15 '24 15:07 knoxfighter

Does this also leave the game running? E.g. does this prevent the "saving" pause when (autosaving) saving normally?

Mattie112 avatar Jul 15 '24 17:07 Mattie112

Does this also leave the game running? E.g. does this prevent the "saving" pause when (autosaving) saving normally?

Only on Linux machines where forking and therefore asynchronous saving is possible. Sadly Windows does not allow this natively, but I think I recall that WSL2 can fork. Players will still see the save being created by the server however.

Some background. Asynchronous saving was, and still is in some places marked as experimental, but has been fixed. There were problems reported where it would cause crashes. The problem was eventually tracked down to being Steam specific where both forks of Factorio would send the same save to Steam. The first would be accepted and acknowledged, but the second would never complete. This left multiple forks hanging waiting for the acknowledgment that never arrived and an eventual crash. Standalone Factorio never suffered from this problem.

See the forum thread: https://forums.factorio.com/viewtopic.php?p=523229#p523229

Squelch avatar Jul 15 '24 18:07 Squelch

Also there is no need to run the LUA console. The command /server-save can be used directly.

Yep, that's a good point. Allow me to clarify -

I use a shorthand convention (in my head at least) to denote which command interpreter it might be called from. In this context, /c shows it can be run from within Factorio too.

Windows commandline > Windows Powershell PS> 'nix commandline $ Factorio commandline /c

Squelch avatar Nov 23 '24 13:11 Squelch

Don't forget the RCON command /save. This can also be used in the webinterface console.

knoxfighter avatar Nov 23 '24 13:11 knoxfighter