feat(editor): judge terrain with the game's own rule, and propose before committing #285
No reviewers
Labels
No labels
alpha:wave-0
alpha:wave-1
alpha:wave-2
alpha:wave-3
area:assets
area:combat
area:ecology
area:infra
area:render
area:scripting
area:ui
area:world
enhancement
epic
migration
post-alpha
roadmap
tech-debt
type:bug
type:chore
type:design
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
marco/IsoMmo!285
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/map-editor-redesign"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #282.
Summary
The height tools were producing terrain the game could not use, and the editor could not show it. This
rebuilds them around one idea: nothing reaches the map until it has been judged, and it is judged with
the game's own rule (
StepRule, the same gateTileMapRules.CanStepapplies) rather than witharithmetic of the editor's own — an editor that scores terrain its own way ends up promising ground the
server refuses.
Preview. Every height tool now proposes. The proposal is drawn over the canvas tinted by the
validator's verdicts, with magenta for a seam, and the readout carries the numbers the decision needs
before it is made: cells changed, max step, walls, seams, undo cost. Enter commits it as one undoable
step; Escape and the map is byte-for-byte as it was. The 3D view carries the proposal too — a road is
a shape, and the top-down canvas cannot show a shape.
Overlays score the terrain in the mover's terms: slope (sustainable route / single ledge / wall),
walkability, and reachability by flood. Two rules deliberately never blurred into one "walkable" number:
a route must hold
SustainableRisePerStep, a single ledge may clearMaxWalkStepZonce. A mountain builtof legal single steps is a wall you can stroll up, which is why they are counted apart.
Ridges and calderas are rebuilt to blend into the ground they land on, so a shape has no seam by
construction; the caldera is one continuous radial section with an explicit
CliffWall, because a smoothcone turned out to be walkable — spiral up it and you are on the rim. Measured, not deduced.
Roads are the largest piece, and the owner drove it to three revisions:
RoadBaker; the tools these replacestamped different geometry from the same path.
lunga… come una vera strada di montagna" — so routing prices each step's rise by its square (pricing
it linearly is a constant between fixed endpoints and changes nothing) and prices earthwork at 25 a Z
instead of 2. On the authored massif, 116 Z over 260 cells: 272 cells instead of 262, steepest steps 6
instead of 55, and no earthwork at all.
measured, 107 direction changes in 272 cells, 75 of its 108 straight runs one single cell long. The line
is simplified to the corners that carry information and those corners rounded off, held inside a corridor
as wide as the simplification tolerance so it can never wander onto ground the router never looked at.
How much to smooth is the ground's call, not a constant:
RoadPlannerbakes each rung and keeps thesmoothest line that costs the road nothing. Turning 369° → 206°, sharpest bend 5.7° → 2.9°, and the
shoulder falls from 140 cells to 26.
The baker also stopped blaming a road for terrain it was laid across. Its postcondition measured the
absolute step at the edge of its earthwork, so a flat road on flat ground was refused because of a 131 Z
escarpment the author had drawn seventy cells away. It now measures the delta: a cut face is reported
(that is what a bench cut into a hillside is), a carriageway left standing on nothing refuses the bake.
content/worlds/caldera-fixtureis a 512×512 crop of the authored world frozen as a regression fixture —the terrain that showed what the tools were doing wrong, kept so a redrawn landform is compared against
something real instead of against a memory of it. Its numbers are pinned by tests, so editing it fails the
build.
Screenshots / recording
Captured by driving the editor through its own automation channel (
docs/map-editor.md— a DEBUG-onlyloopback on 127.0.0.1:5200 that drives the REAL editing paths), on a copy of the authored world so
nothing of the owner's was touched:
The routed road before and after the rounding, side by side at the same framing and camera, and a
close-up at 7 px/cell of the road threading the saddle between two impassable masses.
Instradata contro linea dritta — stesso massiccio, stessi due estremi. Verde = pendenza sostenibile,
giallo = gradino, rosso = muro.
Prima e dopo l'arrotondamento, stesso tratto ingrandito 3x:
A 7 px/cella, mentre infila la sella fra due masse invalicabili:
Verified numerically on the same road: worst step 2 Z, 984/984 paved cells reachable from the foot,
summit reached, 0 seams.
How it was tested
IsoMmo.MapEditor.Core.Tests, all pure: the validator againstStepRule, the editwindow/plan/history (including the undo budget refusing rather than committing without undo), the crop
and survey, ridge and caldera geometry, and the road baker and router.
with itself; a road beside a natural cliff is not blamed for the cliff; an earthwork that cannot reach
the ground leaves a reported cut face rather than a refusal; a carriageway that cannot be supported is
refused; a gentle detour beats a steep short line; a road over walkable ground moves no earth at all.
asterra(read-only): the baked road is walkable byStepRulefrom foot to summit with zero seams.dotnet testgreen — 1,200 tests across 10 projects — wholesolution builds with zero warnings.
Checklist
just lintpasses (CSharpier + analyzers, zero warnings)just testis greenStack: 3 of 3, based on
feat/terrain-cutaway(#284), itself based onfeat/volume-world-f1(#283).Merge in order.