UnifiedAutoSaveInterval
Configurable combat-aware Valheim autosave interval for hosted worlds and local characters.Unified Auto Save Interval
A tiny BepInEx plugin that changes Valheim's own built-in autosave interval and can postpone autosaves briefly while players are in combat.
Default normal interval: 600 seconds / 10 minutes.
Default maximum combat delay: 120 seconds / 2 minutes.
The mod does not implement a separate save system and does not create custom
save files. It only adjusts Valheim's existing Game.m_saveInterval.
Why
Valheim officially exposes -saveinterval for the dedicated server executable,
but not as an in-game setting for normal clients or worlds hosted through
Valheim's Start Server option.
Frequent autosaves reduce progress loss after crashes, but an autosave can also cause a noticeable hitch. The combat protection therefore allows the normal autosave to wait briefly when somebody is actively fighting.
Behaviour
In-game host / Start Server
The host process owns the world, so the normal interval applies to:
- the hosted world;
- the host's local character.
With ProtectAllPlayersWhenHosting = true, the host checks all connected
players. If a creature is targeting any of them when the autosave becomes due,
the save may be postponed.
Joining client
A joining client does not own the server world. The configured interval applies to that client's local character save.
Combat protection only watches that local player on a joining client.
Maximum delay
Combat never disables saving indefinitely.
Example with the defaults:
- normal autosave: 600 seconds;
- maximum combat delay: 120 seconds;
- hard maximum interval while combat remains active: 720 seconds.
If combat ends earlier, the normal 600-second threshold is restored. If the normal save is already overdue, Valheim's own autosave runs immediately after the short combat-clear window.
Combat detection
Combat is considered active when a creature's Valheim BaseAI currently
targets a protected player.
A short clear window keeps combat active for a few seconds after the last target disappears so retargeting does not rapidly toggle the save threshold.
The default clear window is 5 seconds.
Configuration
After first launch:
BepInEx/config/daishi11.valheim.unifiedautosaveinterval.cfg
Defaults:
[General]
SaveIntervalSeconds = 600
[Combat]
AvoidSavingDuringCombat = true
MaxCombatDelaySeconds = 120
CombatClearSeconds = 5
ProtectAllPlayersWhenHosting = true
Useful normal intervals:
600= 10 minutes480= 8 minutes300= 5 minutes60= 1 minute for short testing
Allowed normal interval: 60 to 3600 seconds.
Allowed maximum combat delay: 0 to 600 seconds.
The settings can also be changed through compatible BepInEx configuration UIs.
Compatibility
- No Harmony patches.
- No custom save format.
- No custom backup system.
- No Jotunn dependency.
- Uses Valheim's existing autosave timer and save routines.
Tested for the Valheim 1.0.x modpack using BepInExPack Valheim 5.4.2350.
Recommended setup
For normal play:
SaveIntervalSeconds = 600
AvoidSavingDuringCombat = true
MaxCombatDelaySeconds = 120
CombatClearSeconds = 5
ProtectAllPlayersWhenHosting = true
For a quick combat test:
SaveIntervalSeconds = 60
MaxCombatDelaySeconds = 30
Stay in combat across the one-minute save point. The log should report combat protection and the save should either run shortly after combat clears or at the 90-second hard maximum.
License
MIT.


