From 4f4ae755df725255b3be8f5f6739ac52fc45ec42 Mon Sep 17 00:00:00 2001 From: minjaesong Date: Fri, 28 Nov 2025 19:07:15 +0900 Subject: [PATCH] wiki update --- Save-and-Load.md | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/Save-and-Load.md b/Save-and-Load.md index 31302f2..f7f6d78 100644 --- a/Save-and-Load.md +++ b/Save-and-Load.md @@ -29,9 +29,10 @@ This separation allows: Saves are stored in the appdata directory: ``` -/Savegames/ -├── WorldName_w.tvd # World disk -└── PlayerName_p.tvd # Player disk +/Worlds/ +└── world uuid # World disk +/Players/ +└── player uuid # Player disk ``` ## VirtualDisk Format @@ -143,11 +144,9 @@ Offset 0x3000: Entry ID 42 (updated - USED on read) ← Appended by quicksave This makes quicksaves faster (no rebuild) but results in larger file sizes over time. Periodic full saves compact the disk by removing duplicate and deleted entries. -## Snapshot System - ### Snapshot Numbers -Saves are versioned using snapshot numbers in the format: `YYwWWX` +When the save is created on dev version, the shanpshot number is recorded here. ```kotlin // Format: 0b A_yyyyyyy wwwwww_aa @@ -157,14 +156,12 @@ Saves are versioned using snapshot numbers in the format: `YYwWWX` // f = revision 6 (a=1, b=2, ..., f=6) ``` -This allows tracking save compatibility and detecting version mismatches. - ### Version Compatibility When loading a save, the engine checks: 1. **Snapshot number** — Warn if from newer version -2. **GENVER** — Game version that created the save +2. **GENVER** — Game version that created the save (stored in the main JSON descriptor file) 3. **Module versions** — Check module compatibility ## Serialisation @@ -223,7 +220,7 @@ DiskSkimmer provides efficient read/write access to virtual disks without loadin ### Creating a Skimmer ```kotlin -val skimmer = DiskSkimmer(File("save.tvd")) +val skimmer = DiskSkimmer(File("savegame")) ``` ### Reading Entries @@ -266,7 +263,8 @@ This is what distinguishes a **full save** from a **quicksave**. ```kotlin COMP_NONE = 0 // No compression -COMP_GZIP = 1 // Gzip compression +COMP_GZIP = 1 // Gzip compression (only maintained for older version compatibility) +COMP_UNUSED = 2 // Used to be LZMA (now removed) COMP_ZSTD = 3 // Zstandard (recommended) COMP_SNAPPY = 4 // Snappy (fast, lower ratio) ``` @@ -317,7 +315,7 @@ val world = INGAME.world val player = INGAME.actorNowPlaying as IngamePlayer // 2. Open existing disk (don't rebuild) -val worldDisk = DiskSkimmer(File("${worldName}_w.tvd")) +val worldDisk = DiskSkimmer(File("${App.worldsDir}/${world.UUID}")) // 3. Serialise changed data to JSON val worldJson = Common.jsoner.toJson(world) @@ -346,8 +344,8 @@ worldDisk.sync() // Write clean disk ```kotlin // 1. Open disks -val worldDisk = DiskSkimmer(File("${worldName}_w.tvd")) -val playerDisk = DiskSkimmer(File("${playerName}_p.tvd")) +val worldDisk = DiskSkimmer(File("${App.worldsDir}/${worldUUID}")) +val playerDisk = DiskSkimmer(File("${App.playersDir}/${playerUUID}")) // 2. Read and decompress (automatically uses latest entry if duplicates exist) val worldData = worldDisk.requestFile(0x00) // Gets entry at highest offset