feat: cut the terrain structurally, and judge authored terrain with the game's own rule #284
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!284
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/terrain-cutaway"
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?
Summary
The client removes the layers above you only when the world's own structure says you are inside it —
never because something happens to be drawn in front of you.
That distinction is the whole PR, and it was arrived at by getting it wrong first, in the open. Cutting
on occlusion — "something is between the camera and the body" — is true on any slope with a hill in
front of it, and it blacked out half the screen in an open forest. Cutting on "there is higher ground
nearby" is the same mistake spelled differently; the forest has that too. What separates a crater from a
forest is measured: of the eight compass directions, how many still offer a way out (0-1 against 4-5,
at every radius tried).
So there are exactly two ways in:
EscapeRadiusCells.A canyon has two ways out along its length and is deliberately left alone; so is a plain with a hill on
it. Nothing in it is absolute, so a canyon at z −80 behaves exactly like the same canyon at z +80 and
terrain authored below zero needs no special case — the owner's requirement, in his words: "van scritte
regole strutturali precise, un domani creerò canyon e valli sotto z0, non voglio ripetere sta
discussione". And nothing in it is a camera, so the answer is identical from every viewing angle.
What is then removed is everything above a structural height — the bottom of the ceiling you are
under, or head height over the floor you are shut in on — and never a shape derived from where the player
stands. A boundary anchored to the walker slides across the landscape at every step ("il problema non è
la zona nera, è che si muove"); one anchored to a height is a contour of the terrain and holds still.
The full model lives in the header of
TerrainCutaway(Client.Core) — it is the reference, andCLAUDE.mdcarries the invariant so it cannot quietly drift back to occlusion.Screenshots / recording
Not attached, and I am not going to pretend otherwise. This behaviour was developed and judged
interactively with the owner over several rounds on his own world, against his screenshots — that is how
the occlusion version was caught and rejected. What I can attach now would be a re-staging after the fact,
not the evidence that drove the decisions.
What replaces them here, and is stronger for a reviewer:
TerrainCutawayis pure and unit-tested, andthe landform contract is pinned as a table — cave → cut, crater (0-1 ways out) → cut, canyon (2 ways out)
→ no cut, valley and plain → no cut.
CutawayStatealso exposesUnder,ShutIn,CutModeand aone-word
Shapeto the admin overlay, so the decision is legible in-game rather than being a black screenwith no explanation.
Three known gaps are filed rather than hidden: #279 (a v3 that preserved a reachable region and cut by
screen-space occlusion — built, judged worse by the owner, reverted; the revert pair is not in this branch
because the two cancel exactly), #280 (the character reads as detached from the terrain when the cut is
active) and #281 (silhouette in the open).
How it was tested
IsoMmo.Client.Core.TestsoverTerrainCutaway: the two entries (UNDER / SHUT IN), theeight-direction escape count, and the landform table above.
DisplayZ— asserted, because thatis the one substitution that would make the answer depend on presentation.
dotnet testgreen (10 test projects), wholesolution builds with zero warnings.
Checklist
just lintpasses (CSharpier + analyzers, zero warnings)just testis greenStack: 2 of 3, based on
feat/volume-world-f1(#283). Merge that one first; this PR's base can then beretargeted to
main.Added by the merge of #285: the map editor redesign (closes #282)
While this PR was being rebased onto the squashed
main, #285 was merged into this branch, so it nowcarries the editor work as well. Nothing was lost or changed by that: the tree here is byte-for-byte
identical to the original 43-commit branch, verified by diff. The two halves stay independent — the
cutaway touches the client renderer, the editor touches
tools/IsoMmo.MapEditor*— so they can still beread separately.
Summary of the editor half
The height tools were producing terrain the game could not use, and the editor could not show it. They are
rebuilt around one idea: nothing reaches the map until it has been judged, and it is judged with the
game's own rule (
StepRule) rather than with arithmetic of the editor's own — an editor that scoresterrain its own way ends up promising ground the server refuses.
byte-for-byte as it was. The 3D view carries the proposal too — a road is a shape, and a top-down canvas
cannot show a shape.
SustainableRisePerStep) and asingle ledge (
MaxWalkStepZ) apart: a mountain built of legal single steps is a wall you can stroll up.caldera gained an explicit
CliffWallbecause a smooth cone turned out to be walkable — measured, notdeduced.
alike; routing that prices each step's rise by its square and earthwork at 25 a Z, so it takes the
gentlest line and accepts being longer ("come una vera strada di montagna"); and the routed line
rounded off, because a grid path at an angle is a staircase (107 direction changes in 272 cells).
How much to round is the ground's call —
RoadPlannerkeeps the smoothest line that costs the roadnothing.
edge of its earthwork, so a flat road on flat ground was refused for a 131 Z escarpment seventy cells
away. It now measures the delta.
Measured on the authored massif, 116 Z over 260 cells: 272 cells instead of 262, steepest steps 6
instead of 55, no earthwork at all; turning 369° → 206° after rounding, shoulder 140 cells → 26. The
baked road is walkable by
StepRulefrom foot to summit, 984/984 paved cells reachable, 0 seams.Screenshots (editor half)
Driven through the editor's own automation channel on a copy of the authored world:
Instradata contro linea dritta — 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:
Gates, on this exact head
CSharpier clean (608 files),
dotnet testgreen — 1,200 tests across 10 projects — whole solutionbuilds with zero warnings. 192 of those tests are the editor's, all pure, including the road regressions
pinned from real failures: a wide road climbing a hill is not a conflict with itself; a road beside a
natural cliff is not blamed for the cliff; a gentle detour beats a steep short line; a road over walkable
ground moves no earth at all.
5732a5903ae77f53712bfeat(client): cut the terrain when the world encloses you, not when it occludes youto feat: cut the terrain structurally, and judge authored terrain with the game's own rule