read the save, the seed and the worldgen assets

The engine's save classes are closed, so the protobuf field numbers
were read off the data and matched to the map sizes TerraGenConfig
gives. vsmv dump renders what the save stored, as the reference the
generator will be diffed against.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 17:56:14 +03:00
parent d72ae437ae
commit 90b5d50fa5
12 changed files with 2807 additions and 51 deletions

View File

@@ -240,25 +240,60 @@ produce diff images and numbers, and decide together.
- Create =Sex-field-notes.org=: a running log of language bugs and
friction found while building this.
** 1. Save reader + seed + assets
- =save=: decode =gamedata=:
- seed;
- MapSizeX/Y/Z;
- world config;
- block id → code table (=BlockIDs=);
- =storystructurelocations=.
- Decode =mapregion= blobs: =IntDataMap2D= fields, including
=RockStrata[]=.
- Decode =mapchunk= blobs: =WorldGenTerrainHeightMap=, =TopRockIdMap= if
present, and the ="riverDistance"= moddata.
- Take the layouts from vsapi's =[ProtoMember]= attributes, and check
whether the blobs are compressed.
- =cs-compat=: =DotNetStringHash= reproduces -90319180.
- =assets=: all six worldgen JSONs load.
- CLI: =vsmv dump --region X Z= and =vsmv dump --chunk X Z= write PNGs
of the stored data. This is our ground-truth viewer.
** 1. Save reader + seed + assets (done)
=vsmv info=, =vsmv seed=, =vsmv assets= and =vsmv dump= exist. The
dump renders the save's stored maps as mosaics over the explored area,
one per map. That turned out more useful than single-region dumps.
** 2. Region maps
What the save turned out to be:
- *Encoding.* Every blob is plain protobuf, with no compression. Rows
are keyed by =x | z << 27=, in region units for =mapregion= and in
chunk units for =mapchunk=.
- *=gamedata=:*
| Field | Contents |
|-------+----------|
| 1, 2, 3 | MapSizeX/Y/Z: 2048000 × 320 × 25600 |
| 7 | seed |
| 11 | mod data: key/value entries, including =BlockIDs= and =storystructurelocations= |
| 31 | world config, as a binary TreeAttribute (type byte, .NET string key, value) |
- *=mapregion=* (=ServerMapRegion=). Every map is an =IntDataMap2D=
with fields =1 data (packed), 2 size, 3 pad-tl, 4 pad-br=.
| Field | Map | Size (pad) |
|-------+-----+------------|
| 1 | landform | 40 (4) |
| 3 | climate | 20 (2) |
| 4 | geologic province | 14 (3) |
| 12 | rock strata, one per stratum, in =rockstrata.json= order | 36 (2) |
| 17 | upheaval | 22 (3) |
| 18 | ocean | 26 (5) |
The landform map is stored at =landformMapScale= 16 regardless of
=landformScale=, which only scales the noise inside
=MapLayerLandforms=.
Not used: forest, shrub, flower and beach (2, 5, 6, 15), ore maps
(8), mod data (9), ore distortion (13, 14), block patch maps (16),
animal spawn maps (21).
- *=mapchunk=* (=ServerMapChunk=). All ushort arrays are repeated, not
packed.
| Field | Contents |
|-------+----------|
| 1 | mod data; Rivers' ="riverDistance"= is a serialized =ushort[1024]= |
| 3 | rain height |
| 7 | =WorldGenTerrainHeightMap= |
| 13 | =TopRockIdMap= (block ids) |
- *Assets.* The six worldgen JSONs (and all 910 asset JSONs) parse
after a relaxing pass: comments, unquoted keys and trailing commas.
There are 48 landforms, 6 provinces and 16 strata.
- *Seed.* A numeric seed is assumed to be used as is. That is
unverified, since the parse is in the closed engine.
** 2. Region maps** 2. Region maps
- Port =noise= and =maplayers=, then =GenMaps=, in this order:
1. geologic province
2. landform