generate the region maps as the game does
Every map in all 118 stored regions matches the save to the pixel, so the port is checked against ground truth rather than eyeballed. Getting there meant reproducing .NET quirks the output depends on: LCGRandom reseeding from its previous seed, Dictionary slot order in NaturalShape, and C#'s left-to-right evaluation of RNG draws. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
61
Plan.org
61
Plan.org
@@ -293,18 +293,55 @@ What the save turned out to be:
|
||||
- *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
|
||||
3. ocean
|
||||
4. upheaval
|
||||
5. climate
|
||||
6. strata thickness
|
||||
- Then the story-structure placement and forcing. Check the placement
|
||||
against =storystructurelocations=.
|
||||
- =vsmv verify-regions= diffs all 118 stored regions and reports the
|
||||
percentage of exact pixel matches per map type. The target is 100%.
|
||||
** 2. Region maps (done)
|
||||
=vsmv verify SAVE ASSETS OUT= generates every region the save stored
|
||||
and diffs each map, padding included. It also writes a diff image per
|
||||
map. All of them match exactly:
|
||||
|
||||
| Map | Pixels matched |
|
||||
|-----+----------------|
|
||||
| province | 23,128 / 23,128 |
|
||||
| landform | 188,800 / 188,800 |
|
||||
| ocean | 79,768 / 79,768 |
|
||||
| upheaval | 57,112 / 57,112 |
|
||||
| climate | 47,200 / 47,200 |
|
||||
| strata (16 per region) | 2,446,848 / 2,446,848 |
|
||||
|
||||
All six story locations land where the save has them. Generating the
|
||||
118 regions takes about 0.26 s.
|
||||
|
||||
Ported, in =src/=:
|
||||
- =lcg= (the game's RNG);
|
||||
- =noise= (SimplexNoiseOctave 2D/3D, NormalizedSimplexNoise,
|
||||
SimplexNoise);
|
||||
- =shape= (NaturalShape);
|
||||
- =worldgen= (the layers, GenMaps' forcing and story placement).
|
||||
|
||||
Quirks that had to be reproduced, beyond those listed under
|
||||
[[*Determinism rules for the port]]:
|
||||
- *=LCGRandom.SetWorldSeed=* sets =currentSeed= from the /previous/
|
||||
mapGenSeed. Story placement re-seeds one RNG per structure, so each
|
||||
structure's first draw depends on the previous structure's seed.
|
||||
- *Unpositioned RNG.* An RNG that is never positioned always starts at
|
||||
=currentSeed = 1442695040888963407=. NoiseClimateRealistic draws its
|
||||
ZOffset from it.
|
||||
- *NaturalShape* picks cells with =Dictionary.ElementAt(n)=. Enumeration
|
||||
follows .NET's slot order, where removed slots are reused
|
||||
last-in-first-out, and =shape.sex= keeps those slots.
|
||||
- *GenMaps.ForceClimate* is passed the landform map's padding (4)
|
||||
instead of the climate map's (2), and it matters.
|
||||
- *MapLayerLandforms* samples climate at =finalX / 32= in integer
|
||||
division, so its climate lerp is always at a cell corner.
|
||||
- *Float vs double.* C# =float= expressions are kept in =float=. That
|
||||
includes =1 / scale=-style frequencies, but not =0.5 / scale=, which
|
||||
is double.
|
||||
- *Evaluation order.* =a() + b() + c()= is evaluated left to right in
|
||||
C# and in unspecified order in C. Draws are sequenced through
|
||||
variables (NatFloat's Gauss sum).
|
||||
|
||||
Not ported yet: the =patchy= world climate (=worldClimate= other than
|
||||
=realistic=), and the forest, shrub, flower and beach maps, which
|
||||
nothing here uses.
|
||||
|
||||
** 3. Minimal viewer
|
||||
- Nuklear panels, a pannable and zoomable tile map, and a
|
||||
|
||||
Reference in New Issue
Block a user