Add grid primitives and data-backed maps #17
No reviewers
Labels
No labels
area/ai
area/build
area/character
area/combat
area/data
area/docs
area/game
area/net
area/ui
area/world
size
l
size
m
size
s
type
bug
type
design
type
feature
type
refactor
type
test
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
icub3d/terra-redux!17
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "2-grid-and-map-primitives"
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?
Stands up
src/world/and the spatial types M1 builds on.Coordinates
Two types, deliberately.
Footprintis a column of the map seen from above;GridPosis a cell in space, footprint plus height. Conflating them is the classic 3D-tactics bug
—
(x, y)quietly meaning(x, z)— and it is cheaper to let the compiler reject itthan to find it later.
Map::tilehas a test named after exactly that failure.Neighbour order (east, south, west, north) is documented as part of the contract rather
than an implementation detail: pathfinding breaks ties by visit order, so changing it
changes which of two equal-cost paths a unit walks.
Maps
Authored as rows of glyphs against a legend, not as tile records — a tactical map is a
picture, and a format you can read as one shows a misplaced wall or a walled-in spawn at
a glance. Follows
src/character/throughout: authored*Def, validated type, pluginthat drives loading,
RonAssetwith its own*.map.ronextension.Validation names the thing to fix — the glyph, the row, the column — because the file is
hand-written and "invalid map" alone is useless. Ragged rows, unknown glyphs, duplicate
legend entries, spawns out of bounds, spawns on walls, two spawns in one column, and a
side with nowhere to start all fail at load with the offending location.
Two things worth reviewing
Placement differs from the issue. The issue said to put the spatial types in
src/world/, butCLAUDE.md's layout assigns "grid/space primitives" tocore/and"map loading" to
world/. Canon won:GridPos/Footprintare incore/.Loading needed a gate, which the issue did not scope. With two registries loading
during
Loading, whichever finished first setMainMenuwhile the other was stillreading — the race the existing
TODO(data)anticipated. Subsystems now declarethemselves at plugin-build time and report in when validated, and
LoadingSetordersreporting before the check. The gate's test builds an app with both real subsystems and
asserts the menu never opens with either missing; I verified it fails when the gate is
short-circuited, rather than passing vacuously.
Verification
45 tests pass (was 14),
clippy --all-targets -D warningsandfmt --checkclean.No display here, so nothing visual is claimed — nothing renders yet. That is #3, which
will draw
Map::footprints().Closes #2