Skip to content

Proof Bars

m4bwav edited this page Nov 16, 2026 · 7 revisions

mapwright states its accuracy as numbers and tests them. There are three kinds: the bars check runs on a generated map, the bars each export runs on the file it just wrote, and the bars the test suite holds.

The bars check runs on a world or region

python scripts/mpw.py check DIR exits 1 if any bar fails. Run it before handing a map over.

Bar Passes when
1 every river runs downhill to the sea, or through a lake to it
2 no river splits outside a marked delta
3 each lake has at most one outlet
4 the same recipe gives byte-identical files
5 a child's coast is within 1 parent cell spacing of the parent's coast
6 parent rivers are in the child within 1 parent spacing
7 temperature falls toward the pole and the lee of mountains is drier (not judged with too few samples)
8 every settlement is on land and not in a lake
9 all settlements of one landmass are joined by roads
10 no road runs through sea or lake, and roads step cell to cell (there are no ferries)
11 names are unique and every named feature has one
12 the same seed gives byte-identical names.json and features.geojson
13 a child keeps the parent's settlements and roads within 1 parent plus 1 child spacing
14 every port touches open sea: sea flooded in from the map border, so a town on a lake or an enclosed sea pocket is never a port (since 0.13.0); and ports are at most a quarter of settlements, rounded up (since 0.14.0)
15 no two labels overlap
16 no label is cut by the map edge
17 the labels read back by OCR

Period lint (since 0.15.0)

check --period YEAR adds bars that fail every convention on the map first used after YEAR, from the first-use tables in the references (bar scale 1275, Mercator 1569, contours 1791, elevation by tint 1804, Robinson 1963 and the rest). --period-kind map|chart|mappa picks the land map, sea chart or mappa mundi rules, and --uses names conventions the recipe does not record (for example mercator,land-contours,dot-map,greenwich). A style may carry a period year. Some conventions only warn (a separate PASS bar listing WARN lines). From a real run on a seed 7 world:

bar 18 FAIL: period 1600 (map): nothing younger than the year (elevation by tone or tint (1804))
bar 19 PASS: period 1600: warnings (WARN Greenwich as prime meridian (1884))

The second line came from --uses mercator,greenwich; Mercator (1569) is older than 1600, so it passes.

Since 0.16.0 the ink-and-parchment style carries period=1600, so check --style ink-and-parchment runs the period lint without --period; the modern styles carry no year. From a real run on v0.17.0 (seed 7 world):

python scripts/mpw.py check w.map --style ink-and-parchment
bar 18 PASS: period 1600 (map): nothing younger than the year (2 conventions checked)

A Mollweide or Robinson recipe checked in that style now fails this bar.

Bars 5, 6 and 13 apply to child maps only. Bar 17 needs tesseract; without it the bar prints SKIP with the reason, which is not a pass. --no-labels skips 15 to 17 (14 to 16 before 0.13.0, when there was no port bar) and --no-regen skips the regeneration bars.

From a real run:

python scripts/mpw.py check isles-south.map
bar 1 PASS: every river runs downhill to the sea or through a lake to it (42 river cells, 0 failures)
bar 2 PASS: no river splits outside a marked delta (0 splits, 0 rivers that stop on land, 0 marked deltas)
bar 3 PASS: each lake has at most one outlet (3 lakes, max outlets 1)
bar 4 PASS: same recipe gives byte-identical files (all 8 files identical)
bar 5 PASS: child coast within 1 parent spacing of the parent coast (875 child coast segments, max 0.679, mean 0.177 parent spacings)
bar 6 PASS: parent rivers present in the child within 1 parent spacing (4 parent river points, max 0.128 parent spacings)
bar 7 PASS: climate: temperature falls poleward; lee of mountains drier (sea-level temp by 10-deg band 25.9/22.7; windward 0 vs leeward 32 cm/yr (too few samples, shadow not judged))
bar 8 PASS: every settlement on land and not in a lake (21 settlements, 0 in water)
bar 9 PASS: all settlements of one landmass connected by roads (3 landmasses with settlements, 0 split)
bar 10 PASS: roads never run through sea or lake cells (no ferries) and step cell to cell (27 roads, 758 road cells, 0 in water, 0 jumps)
bar 11 PASS: names unique and present for every named feature (37 names, 0 duplicates, 0 features unnamed, 0 feature names missing from names.json)
bar 12 PASS: same seed gives byte-identical names.json and features.geojson (identical)
bar 13 PASS: child keeps parent settlements and roads within 1 parent + 1 child spacing (8 parent settlements in window, 0 missing or renamed, max shift 1.42 km; 141 parent road points, max 1.43 km; tolerance 9.91 km)
bar 14 PASS: every port touches open sea (a lakeshore town is never a port), at most 25% of settlements (6 ports (cap 6), 0 off open sea)
bar 15 PASS: labels: none overlap (23 labels, 0 overlapping pairs)
bar 16 PASS: labels: none cut by the edge (0 cut)
bar 17 SKIP: labels: read back by OCR (skipped: tesseract not found (install it to run this bar))

Bars for the other kinds

check picks the bars by the recipe's kind; each run prints them numbered from 1. The full transcripts are on the generate pages.

Kind Bars
city every street reachable from the market; every block fronts a reached street; lots simple and inside their block; every built lot has street frontage; gates on the wall, streets cross it only at gates; byte-identical regeneration; the three label bars
dungeon, square battle map every floor square reachable from the entrance; every room reached, none overlap; goal at the farthest floor square and the path at least the map width (since 0.9.0); no isolated wall squares; doors join two floors; walls closed; grid on whole pixels; five Universal VTT round-trip bars; byte-identical regeneration; the label bars. Cyclic dungeons add cycle rank, key before lock, the lock as a gate and a return path. blocks dungeons (since 0.13.0) add no unmatched exit inside the map (none off the edge, edge squares match the flags) and the block count at or above the bar
sector route graph connected (bridges listed, not failed); routes within the jump range or marked long; one world per hex inside the grid; the T5 file reads back; byte-identical; label bars
system every orbit outside the star; neighbours at least 10 mutual Hill radii apart; moons inside the Hill sphere and outside the planet; the habitable zone scales with the square root of luminosity and every body is in its zone; byte-identical; label bars on map.svg and again on orbits.svg
planet 2:1 texture, no seam, no pinch at the poles; byte-identical; label bars
deck every room reached from the airlock; every floor square reached; doors join two floors; airlock with an inner door and an outer door to space; lifts line up; byte-identical; label bars
any folder with *.aistyle.json one bar per styled picture: the coast kept (--no-aistyle skips them)

Dungeons made before 0.9.0 have no goal and skip the goal bars (Versions and upgrading).

Bars on exported files

Every export reads its file back before reporting it: Universal VTT (whole pixels per grid, walls inside the image, doors on walls, image size, colours alpha first, portals closed, one portal per door on decks), Tiled (layers, size, gids, floor count, objects inside), heightmaps (a size the engine takes, read back within one step), the Roblox colormap, the mesh (counts, valid faces, watertight), print (MediaBox and TrimBox within 0.5 pt), the planet (2:1, seam, poles) and T5 (rows read back). See Export.

The bars the tests hold

python -m unittest discover -s tests ran 235 tests on v0.11.0 on 2026-11-16: all passed, 2 skipped.

  • Format round trips (GeoJSON, GPX, KML) within 1e-7 degrees.
  • Projection forward then inverse within 1e-9 degrees on a 10-degree grid.
  • Equal-area projections (Mollweide, Lambert azimuthal, Equal Earth) keep area ratios within 1e-6.
  • Distances match published values to 1 mm: Geoscience Australia's Flinders Peak to Buninyong (GRS80, 54972.271 m) and GeographicLib's Wellington to Salamanca (WGS84, 19959679.267 m).
  • Robinson matches PROJ's own test rows within 0.1 mm.

A bar is never loosened without a new measurement written in the repository's TESTS.md.

Clone this wiki locally