Carving records hot spring candidates where the game does: deep, wide tunnel steps that pass the water check where geologic activity is over 128. A candidate becomes a hot spring unless the surface over twice its radius, after caves, is rough, below sea level + 1 or high in the mountains, or a story location keeps hot springs away; carved chunks are kept so their neighbours' heights come cheap. The Caves overlay paints them as discs, and Find nearest looks for one. Against the save, 173 of the 180 stored candidates match in centre and radius; five differ only in the radius's last float bits, from a rounding not yet found. Of the 102 hot springs placed, 84 hold the save's sludgy gravel, and 94.8% of that gravel lies in one. Which edge blocks are gravel or mat the game rolls each time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
13 KiB
vs-map-viewer
A map previewer for Vintage Story worlds. Give it a seed and world settings, and it generates the world the way the game would and shows it as a zoomable top-down map: terrain, rivers, oceans, climate, landforms, geologic provinces, and rock strata at any depth. It is mostly for finding rock: where chalk, bauxite or limestone lie, at the surface or 20 blocks down, and which one is nearest. It also shows what the prospecting pick would read for an ore, anywhere on the map, and where the caves run.
It covers Vintage Story 1.22.7 with the Rivers 5.0.3 mod. The generator is a port of the game's own, written in Sex. It is checked against a real save, and matches it:
| What | Matches |
|---|---|
| Region maps: landform, climate, province, ocean, upheaval, strata | every pixel of 118 regions |
| Story structure locations | all 6 |
| Rivers' distance to the nearest river | 100% of 6.5 million columns |
| Terrain height | 98.2% of 11.7 million columns |
| Rock at the surface | all but 14 of 11.7 million columns |
| Rock below the surface | 99.91% of 1.38 billion blocks; see below |
| Caves | 96.1% of 18.5 million carved blocks; see below |
| Ore maps, 31 minerals | every pixel of 118 regions |
| Prospecting pick readings | 38 of 42 in the game's category; see Limits |
All but 0.02% of the other heights come from two passes that run after
the strata are laid: caves that open the surface, and the raise of dry
seabeds. Neither changes which rock is where. Below the surface, all
but 0.0011% of the other rock comes from later passes too: lava in deep
caves turns the rock around it to basalt, and cave walls and
underground structures are built of granite. Where the caves differ,
it is nearly all what later passes put in them, or air the structures
and the block layers make; 0.28% is not explained.
Plan.org has the details.
Building
You need:
- the Sex compiler, expected at
~/dev/sex/sexc(or setSEXC); - a C compiler;
- SDL3 (
brew install sdl3); - SQLite3;
- zstd (
brew install zstd); - a checkout of cJSON in
./cJSON.
Nuklear and stb_image_write are vendored in third_party/.
make
This builds two programs into build/: vs-map-viewer, the viewer,
and vsmv, the command-line tool.
The game's assets are not part of the repository. Copy the assets
directory of a Vintage Story 1.22.7 install to ./assets, or point
--assets at it. The viewer
reads assets/survival/worldgen/*.json.
Running
build/vs-map-viewer [WORLD]
WORLD is where the seed and settings come from:
- a save,
something.vcdbs: the world as it was created, including its real size; - or a
serverconfig.json: the seed as typed and the world config.
Without WORLD it opens ./serverconfig.json. It starts at spawn, in the
middle of the map.
Options:
| Option | Does |
|---|---|
--assets DIR |
where the game's assets are; default ./assets |
--zoom Z |
blocks per screen point, 1/16 to 32; default 4 |
--base LAYER |
the base layer: ocean, rivers or height; default height |
--overlay NAME |
turn on an overlay: landform, climate, province, upheaval, strata, rock, mineral, caves; repeatable |
--opacity F |
overlay opacity, 0 to 1; default 0.5 |
--rock-depth N / --rock-y Y |
rocks at N blocks under the surface, or at height Y |
--rock-any |
the one highlighted rock at any depth |
--highlight ROCK |
highlight a rock, e.g. chalk; repeatable |
--find |
find the nearest highlighted rock on start |
--mineral CODE |
show a mineral's readings, e.g. nativecopper |
--min-reading NAME |
Find nearest's least reading for minerals, e.g. high or very-poor, or an ore map band, e.g. 86-100%; default decent |
--find-mineral |
find the nearest such reading on start |
--find-cave |
find the nearest cave entrance on start |
--find-hot-spring |
find the nearest hot spring on start |
--probe X Z |
probe the column at block X, Z on start |
--screenshot FILE.png |
wait until everything is drawn, save the window, quit |
--mouse X Y |
place the cursor, for screenshots |
The screenshot above came from:
build/vs-map-viewer --zoom 14 --overlay rock --opacity 0.6 \
--probe 1027600 13800 --mouse 1000 380 \
--screenshot doc/screenshot.png "ktt9s village story-new.vcdbs"
Using the viewer
The map fills the middle of the window, between two panels.
The map
- Drag with the left mouse button to pan.
- Scroll to zoom, around the cursor.
- Click (without dragging) to probe that column: its rock strata and the prospecting pick's reading there appear in the Probe section, and a numbered pin marks the place. Click a pin to probe it again.
- With Rock under cursor on, a label by the cursor names the rock under it, as the Rocks section is set (at the surface, at a depth, or at a height). At any depth, it gives the Y of the rock's topmost block and how far down that is, or says the column has none. With the Minerals overlay on, another line gives the mineral's reading; with the Caves overlay on, another gives the column's caves, top down.
The further out you zoom, the coarser the terrain is sampled: every block when zoomed in close, one in 32 when far out. Only what is on screen is computed; when nothing is left to compute, the viewer sleeps.
Left panel
-
World: where the world comes from, and its settings.
- Type a save or
serverconfig.jsonpath and press Load. - Leave Rivers config empty for the mod's defaults, or load a
ModConfig/rivers.json. - Change any setting (seed, sizes, landcover, scales, climate…) and press Apply to generate that world instead. The seed can be any text, as typed into the game.
- Go to spawn goes back to the centre of the map.
- Type a save or
-
Info: what is under the cursor:
- coordinates, absolute and from the map centre, and the region;
- landform and geologic province;
- climate: temperature at sea level, rain, geologic activity;
- ocean and upheaval values;
- distance to the nearest river;
- terrain height and the rock on top.
Below it, how many tiles are still being generated.
-
Probe: the last column probed: its surface height and its strata, top down, with the Y range and thickness of each. Below them, what the prospecting pick reads there: every mineral it finds, highest first, with its parts per thousand, then the miniscule amounts. Then its caves, top down: air or lava, with the Y range of each, and whether a cave opens at the surface there.
- Go to centres it.
- Clear pins removes the pins.
- Close hides it.
Right panel
-
Layers:
- Base: one of Ocean, Rivers or Terrain height. Drawn opaque.
- Overlays: any of Landform, Climate, Geologic province, Upheaval, Rock strata thickness (pick the stratum below it), Rock and Minerals. Drawn over the base at the Overlay opacity.
- Story locations marks spawn and the story structures.
- Rock under cursor turns the cursor label on and off.
-
Rocks: finding rock.
- Choose where to look: at the Surface, at a Depth below surface, or At Y, and set the depth or Y. Any depth looks for one rock anywhere from the surface down to the mantle; it can be chosen while exactly one rock is highlighted, and while it is on, clicking a rock in the legend highlights that one instead.
- The legend lists every rock with its share of the visible map, while the Rock overlay is on.
- Click rocks in the legend to highlight them. With any highlighted, the Rock overlay shows only those, and the base shows through elsewhere. Show all clears the highlight.
- Find nearest looks for the highlighted rocks around the centre of the view, up to about 12,000 blocks out, jumps to the nearest one and probes it. It samples every 16 blocks before it refines, so a patch smaller than that can be missed. Cancel stops it.
-
Minerals: finding ore, the way the prospecting pick's density mode does.
- Choose a mineral. The Minerals overlay colours the map by what the pick would read there: miniscule, then very poor up to ultra high. The legend gives each reading's share of the view.
- A reading combines the mineral's regional ore map with how much of the column is its host rock, at the depths its deposits are placed in. It says how likely the ore is near, not where the ore blocks are.
- Find nearest looks for the nearest column that reads at least Find at least, as Rocks' Find nearest does.
- Silver, gold and peridot are listed as (ore map). For them the overlay shows the mineral's ore map, how common it is there, in bands of sevenths, and Find nearest looks for a band.
-
Caves: the caves the game carves.
- The Caves overlay colours each column by how far below the surface its topmost cave starts, and marks entrances, where a cave opens at the surface. Hot springs show over it as discs. The legend gives each band's share of the view.
- Nearest entrance and Nearest hot spring look for the nearest cave entrance or hot spring around the centre of the view.
- A hot spring's place and size come from the seed; which blocks at its edge are gravel or bacterial mat the game rolls each time.
- Caves are carved a chunk at a time, every block of it, so the overlay is slow to fill when zoomed out.
vsmv
The command-line side, mostly for checking the generator against a save:
| Command | Does |
|---|---|
vsmv info SAVE.vcdbs |
the save's seed, size, world config and story locations |
vsmv seed TEXT... |
the numeric seed the game makes of TEXT |
vsmv assets DIR |
checks that the worldgen assets load |
vsmv dump SAVE.vcdbs OUT |
PNGs of the maps the save stored |
vsmv verify SAVE.vcdbs DIR OUT |
regenerates everything the save stored and compares it; diff images go to OUT |
verify takes about eight minutes, most of it on the terrain heights
of every stored chunk and on the caves. It also compares the ore maps,
the prospecting pick readings players took in the save, if there are
any, and every stored block below the surface: its rock, and whether
it is a cave.
Limits
- Only the realistic world climate is supported, not patchy.
- Rivers' settings are not stored in a save. Without a
rivers.json, the mod's defaults are assumed. - Other mods that change worldgen are not modelled.
- Caves leave out what later passes put in them: stalactites, gravel, and the structures some of them hold. Of the blocks the save has where caves are carved, 3.6% are such things.
- Prospecting readings come out a little higher than the game's: in the readings checked, the game's was up to 12.5% lower, which can move one across a category edge. The game's column already holds the ore of the deposits generated in its chunk, and those deposits are not generated here.
- The pick can't be reproduced for silver, gold and peridot. The game reads them from ore inside other deposits (quartz and olivine), which needs the deposits themselves. Minerals shows their ore maps instead.
Notes
Plan.orgis the design and how each part was checked.Sex-field-notes.orglists the problems the Sex compiler showed while this was built. They are filed as issues #40 to #63 on its tracker.
