NativeBackup
A simple backup valheim mod
模組介紹 作者原文
NativeBackup 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.SaveDoneTime to 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 world will not silently fall back to character.
- sb.backup char will 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 world backs up world.
- sb.backup char backs up character.
- Esc button and sb.backup attempt both.
- Non-host/client session:
- sb.backup world is 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 Backup button remains disabled (grayed out).
Configuration
Config file: com.aloncifer.nativebackup.cfg
- BackupIntervalMinutes: timed backup interval. 0 disables 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 MaxBackupsPerSave entries remain per save.
- Setting the value to 0 disables 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.
安裝與使用 安裝:BepInEx 外掛
- 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
- 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
- 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
- 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。
帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。 多人連線時,主機與所有用戶端需要安裝一致的模組。
前置依賴
下面這些內容需要先安裝,否則該模組不會生效:
denikson-BepInExPack_Valheim