NativeBackup
A simple backup valheim modNativeBackup beta 0.1.1
NativeBackup beta 0.1.1 is a Valheim backup plugin that adds fast in-game backup triggers on top of Valheim's native backup system.
Ground Truth (Current Build)
NativeBackup currently provides:
- Esc-menu Backup button integrated under Save.
- Console commands:
sb.backup,sb.backup world,sb.backup char,sb.list. - Automatic timed backups (optional) via config.
- Native backup creation through Valheim save APIs.
- Save-before-backup synchronization through current-version ZNet save flow.
- Single-flight execution with cooldown guard.
- Minimalist UX messaging with duration in completion/failure toasts.
- Flashing top-right backup indicator while backup is running.
Backup Pipeline
Every trigger path (button, command, timer) follows the same pipeline:
- Resolve requested target intent.
- Enter coordinator gate (no overlap, 5-second cooldown).
- Trigger native save sync via
ZNet.Save(false, true, false)on main thread. - Wait for
ZNet.SaveDoneTimeto advance. - Create native backup(s) for selected target(s).
- Emit concise completion/failure toast with elapsed time.
Important behavior details:
- Explicit target commands are strict.
sb.backup worldwill not silently fall back to character.sb.backup charwill not silently fall back to world.- Backup sync is current-version only and does not use legacy trigger discovery fallbacks.
- If save completion cannot be confirmed within timeout, backup is canceled to avoid stale snapshots.
User Experience
Design goals are minimal and informative:
- No center-screen backup spam.
- Flashing top-right backup badge while backup is running.
- Backup button is grayed out while backup is running or cooldown is active.
- Concise top-left toast on completion/failure/cancel with timing.
Examples:
Backup complete (1.8s): world 'MyWorld' and character 'test'.Backup failed (1.2s): requested target unavailable.Backup canceled (2.0s): could not confirm current save state.Backup on cooldown.Backup already running.
Target Rules
- Hosted local world:
sb.backup worldbacks up world.sb.backup charbacks up character.- Esc button and
sb.backupattempt both. - Non-host/client session:
sb.backup worldis blocked.- Character backup paths remain available when character save is resolvable.
Commands
sb.backup- backup current available targets.sb.backup world- world only (host required).sb.backup char- character only.sb.list- lists legacy archive index entries.
Cooldown behavior:
- Backup actions use a 5-second cooldown window.
- During cooldown, the Esc-menu
Backupbutton remains disabled (grayed out).
Configuration
Config file: com.aloncifer.nativebackup.cfg
BackupIntervalMinutes: timed backup interval.0disables scheduler.MaxBackupsPerSave: maximum number of native backups kept per save target.
Retention behavior:
- Native backups are pruned after each successful backup so only the newest
MaxBackupsPerSaveentries remain per save. - Setting the value to
0disables pruning.
Build and Install
- Build target: .NET Framework 4.6.2.
- Build command:
dotnet build NativeBackup.sln -c Release. - Output:
src/bin/Release/net462/NativeBackup.dll. - Install DLL to BepInEx plugins folder.
Notes
- The backup badge uses IMGUI; icon glyph rendering can vary by system font.
- Native restore/list rendering is still Valheim-owned UI behavior.
- This build targets current Valheim save APIs and intentionally removes legacy trigger compatibility paths.
