mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
wiki update
@@ -29,9 +29,10 @@ This separation allows:
|
||||
Saves are stored in the appdata directory:
|
||||
|
||||
```
|
||||
<appdata>/Savegames/
|
||||
├── WorldName_w.tvd # World disk
|
||||
└── PlayerName_p.tvd # Player disk
|
||||
<appdata>/Worlds/
|
||||
└── world uuid # World disk
|
||||
<appdata>/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
|
||||
|
||||
Reference in New Issue
Block a user