Repository navigation
One ground for everybody: Ground replaces eleven finders (refactor step 1) - #521
Conversation
The height a foot, a paw or a wheel stands on is found in one module. Town.ground, Drive.floor, Drive.bed, Fauna.drop, Roll.top, Arm.floor, Art.floor, Law.ground, Taxi.gnd, Rotor.floor and the saucer's scan are gone; Nav, Occ, Life, Pilot, Plan, Nest and Rotor walk the column through the kernel (Ground.cell / roof / room). Who asks says what it needs as data (GROUND.walk, fall, roll, fly, hover). Chosen changes: a body rolling over and a look from afar get the sloped top of a road ramp; plants are no floor from afar; a police car or a builders' truck put under a slab with no room goes on top of it, as the taxi did. tools/ground.test.mjs: the meaning on columns built by hand and 60 000 random columns against the old finders kept in the test word for word. tools/split.test.mjs: ground 11 -> 0; the scan detector is wider (it also sees a body that begins with a get) and counts 7 where the old one would count 0; a finder that was folded in may not come back (gone). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uiczdv1q9xAXyaDKTTGyWH
⏱ Performance: this PR against mainScenarios of src/game/98_perf.js, the two builds by turns on one runner (tools/perf.mjs, CPU side, draws counted not drawn). ❌ Slower than main in 1 gating metric(s)
Over budget (ms/frame, budget): drive Land.lightTick 13.52 > 1 · drive Land.gen 4.36 > 0 · drive Land.meshChunk 2.25 > 1 · tunnel Land.lightTick 2.21 > 1 · idle Town.update 1.55 > 1 · tunnel Land.meshChunk 1.19 > 1 · tunnel Land.gen 0.07 > 0 · flight Land.gen 0.06 > 0 Generated by Claude Code |
…eads the tools for calls of a function that is gone pax.test still called Town.ground through a one-letter name of the module (const T = G.Town), which no check of the game's own source sees: it failed only in the whole run. The same in 32 screenshot recipes and four more tests (Law.ground, Fauna.drop, Drive.floor, Drive.bed, Art.floor). split.test now reads every file of tools/ for a call of a gone function under the module's name or any name it was given there. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uiczdv1q9xAXyaDKTTGyWH
|
The three red checks on the first head (f0be4ed), one by one:
The PR is in the merge queue; it combines with main as build 487 ( Generated by Claude Code |
…a looks across the road The first recipe put them 11 cells from each other, less than a car is long, so they stood inside one another. A probe step prints the heights along the road for the dry run. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uiczdv1q9xAXyaDKTTGyWH
… before the picture; the probe step is gone Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uiczdv1q9xAXyaDKTTGyWH
…of the ramp The townsperson put into the list by hand was not drawn in the dry run, so the recipe and its title name the two cars only. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uiczdv1q9xAXyaDKTTGyWH
One ground for everybody: Ground replaces eleven finders (refactor step 1) Merge queue: build 491
…lan); srclist.test keeps such lists whole 10_vox.js reads PADB of 09_core.js since build 485; hut, roomy, villa and the plan tools listed 10_vox without 09_core and threw before their first check. Behind that the hut test had three more missing names (the species of the lot trees, treeId, the road net, airports and the ports' Settle.kmax): it loads the flora files and stands in for the rest as its sister tests do; its numbers are the ones it gave before (97 of 200). tools/srclist.test.mjs reads every self-contained list of game files in tools/ and fails when a listed file needs at load time a name no listed file declares and the test does not stand in for. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uiczdv1q9xAXyaDKTTGyWH
Screenshots of build v493🌍 One ground for everybody: a parked car and a police car put on the road ramp stand on its sloped top, pitched with the road, both by the same finder All of them are assets of the v493 release. |

Requested by Anton · project thread
One ground for everybody
Step 1 of the refactor to "one concept, one way" (docs/ARCHITECTURE.md): the height a foot, a paw or a wheel stands on is found in one module,
Ground(src/game/71_ground.js).Before: eleven modules had a finder of their own (
Town.ground,Drive.floor,Drive.bed,Fauna.drop,Roll.top,Arm.floor,Art.floor,Law.ground,Taxi.gnd,Rotor.floor, the saucer's scan) and eighteen loops walked down a column of blocks by hand. They differed in ways nobody had chosen: one knew the sloped top of a road ramp and the next did not, one fell through water and the next stood on it, one gave up inside a hill and the next dug on for a cave under it.Now: the column is walked in
71_ground.jsand nowhere else. Who asks says what it needs as data (GROUND.walk,fall,roll,fly,hover: how far up a floor still counts, how deep the search goes, what water is), never as code.Ground.at(x, z, y, o)Ground.drop/Ground.topGround.landGround.under/Ground.roadGround.cell / roof / roomNav, the walking grid of a lot, a driver's look ahead)About 130 call sites moved; the old finders are deleted.
Behaviour that changes (chosen)
Tests
tools/ground.test.mjs(new, under a second, no browser): the meaning on columns built by hand (a step, a wall, a pit, a ford, a ramp, a cave under a hill, a slab with no room, the land where no blocks are made) and 60 000 random columns where the new module must answer as the old finders did; they are kept in the test word for word.tools/split.test.mjs:split.ground11 → 0. The detector of column loops is wider now (it also sees a loop whose body begins with aget): it counts 7 where the old pattern would count 0 (the soil under plants, the water over a swimmer, every floor of a column for a jump: they ask something else and are next). A finder that was folded in is listed asgoneand may not come back. Second ways in all: 67 → 45.etho,herd,susp,navkeep: their stand-ins for the old finders now stand in forGround; the checks are the same.Found on the way, not changed here
tools/etho.test.mjshad a stand-in forTown.groundthat always said "none". With the real ground an animal that a scene leaves in the air between two plans is taken down at once by the pit rule ofFauna.foot. The test keeps its stand-in for that one rule (commented); falling becomes one law for every body in step 3.tools/plan.test.mjsfails on main itself (PADB is not definedwhen its file list is loaded), not from this change.Generated by Claude Code