Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Improved autosave feature #30

Merged
merged 4 commits into from
Apr 6, 2019
Merged

Improved autosave feature #30

merged 4 commits into from
Apr 6, 2019

Conversation

Pecius
Copy link
Contributor

@Pecius Pecius commented Apr 6, 2019

Autosave now mimics its singleplayer counterpart.

Changes:

  • Autosave interval is set in ingame days instead of minutes in real time.
  • The countdown is influenced by ingame speed setting which means it also stops when the game is paused.

Notes:

  • New default value of 0.5 days is around the old default 8 minutes at normal speed setting.
  • Autosave countdown is reset when user invokes a manual save (via /autosave chat command).

Pecius added 2 commits April 6, 2019 12:13
Autosave now mimics its singleplayer counterpart
@@ -82,6 +84,8 @@ public MultiplayerServer(ServerSettings settings)

if (settings.lanAddress != null)
lanManager = new NetManager(new MpNetListener(this, false));

autosaveCountdown = settings.autosaveInterval * 2500 * 24;
Copy link
Contributor

Choose a reason for hiding this comment

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

This indentation doesn't look right, but it might be github's fault.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, that must've slipped in when I changed from tabs to spaces. It's fixed now.

@MilanDierick
Copy link
Contributor

Can we make this change toggable? When I plan out parts of my base without time advancing, no saving is happening, so when a desync happens (game can desync while Not running, happens rarely) or when the game crashes, all my progress from the past 10 minutes or how long it takes for a Day to pass on 1x speed, is going to be löst.

@Pecius
Copy link
Contributor Author

Pecius commented Apr 6, 2019

Can we make this change toggable? When I plan out parts of my base without time advancing, no saving is happening, so when a desync happens (game can desync while Not running, happens rarely) or when the game crashes, all my progress from the past 10 minutes or how long it takes for a Day to pass on 1x speed, is going to be löst.

I don't see a point in disabling the whole feature.
As this version makes sure the save is done every x specified ticks (± current speed value).
Compared to older version where you have a chance to lose (or to simulate back) more ticks depending on the current speed (3 times more at Fast and 6 times at SuperFast).
Also keep in mind that everything you do while your game is paused doesn't add up to simulation time.
But perhaps we could add a switch in options that would let it tick at normal speed while your game is paused.

@MilanDierick
Copy link
Contributor

People (like myself) sometimes like to tinker with and design stuff for more than 30 minutes, all while the game is paused. For some reason, the game desyncs, or just crashes, or something else goes wrong, and I need to reload. When I go and look at the most recent autosave, I see that it's 30 minutes ago, because it only saves your game when you are actually advancing time. That would make me really salty...

@jacobEAdamson
Copy link
Contributor

jacobEAdamson commented Apr 6, 2019

@Pecius Can we have an option for both in the hosting page? You first specify if it autosaves every X minutes or every X days (Autosave Interval Unit maybe?) and then specify the interval.

I also tend to spend long phases during base development and see potential for desyncs to lose information.

Prevent a possible underflow when autosave feature is disabled
@Pecius
Copy link
Contributor Author

Pecius commented Apr 6, 2019

I added a switch in mod options that you can enable and disable while you're playing.

@Pecius Can we have an option for both in the hosting page? You first specify if it autosaves every X minutes or every X days (Autosave Interval Unit maybe?) and then specify the interval.

Adding an option for both new and old system is an unnecessary over-complication that will be confusing for users.

@MilanDierick
Copy link
Contributor

I added a switch in mod options that you can enable and disable while you're playing.

What do you mean by that? Disable or enable the auto save feature altogether?

@Pecius
Copy link
Contributor Author

Pecius commented Apr 6, 2019

Sorry, I meant that I added a switch that lets you decide if you want to stop the autosave counter when your game is paused.

@MilanDierick
Copy link
Contributor

Sorry, I meant that I added a switch that lets you decide if you want to stop the autosave counter when your game is paused.

Ah, got it, that should work. When the game is paused, does it tick at 1x speed when you enable the option?

@Pecius
Copy link
Contributor Author

Pecius commented Apr 6, 2019

Yes it does tick at 1x speed with that option (disabled) when the game is paused.

@jacobEAdamson jacobEAdamson merged commit 9c5db01 into development Apr 6, 2019
@MilanDierick MilanDierick added the enhancement New feature or request label Apr 9, 2019
@MilanDierick MilanDierick added this to the Patch 0.5.0 milestone Apr 9, 2019
@MilanDierick MilanDierick deleted the feature/autosave branch April 17, 2019 12:18
SweptWasTaken pushed a commit that referenced this pull request Aug 5, 2019
* Improve autosave feature

Autosave now mimics its singleplayer counterpart

* Add missing French translation

Fix indentations

* Fix indentation

* Add a switch that toggles autosave ticking while time is paused

Prevent a possible underflow when autosave feature is disabled
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants