Skip to content

One ground for everybody: Ground replaces eleven finders (refactor step 1) - #521

Merged
k06a merged 6 commits into
mainfrom
claude/project-thread-63bh1y
Dec 2, 2026
Merged

k06a merged 6 commits into
mainfrom
claude/project-thread-63bh1y

Conversation

@k06a

@k06a k06a commented Dec 2, 2026

Copy link
Copy Markdown
Owner

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.js and 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.

Call Answers
Ground.at(x, z, y, o) the height to stand at near y (a fraction on a ramp), or null
Ground.drop / Ground.top whole cells: the floor cell under y, the top of whatever is there
Ground.land the generator's answer where no blocks are made yet
Ground.under / Ground.road both joined, for what comes from afar (a plane, a police car driving into view)
Ground.cell / roof / room the kernel for searches that walk thousands of columns (Nav, 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)

  • A vehicle rolling over and a look from afar get the sloped top of a road ramp (they got the cell).
  • Plants are no floor from afar (a plane or a far car stood one cell up on crops for a frame).
  • A police car or a builders' truck that is put under a slab with no room (a bridge deck) goes on top of it, as the taxi already did.

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.ground 11 → 0. The detector of column loops is wider now (it also sees a loop whose body begins with a get): 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 as gone and may not come back. Second ways in all: 67 → 45.
  • etho, herd, susp, navkeep: their stand-ins for the old finders now stand in for Ground; the checks are the same.

Found on the way, not changed here

  • tools/etho.test.mjs had a stand-in for Town.ground that 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 of Fauna.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.mjs fails on main itself (PADB is not defined when its file list is loaded), not from this change.

Generated by Claude Code

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
@k06a k06a self-assigned this Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

⏱ Performance: this PR against main

Scenarios 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)

scenario metric main PR Δ threshold
idle cpu.max 33.6 50.9 51% ⚠️ ±50%
idle spikes/min 26.2 7.49 -71% ✅ ±50%
night spikes/min 0.00 5.99 new ❌ ±200%
tunnel draws 277 266 -4% ✅ ±3%
scenario CPU mean p95 max slow/min spikes/min miss sync gens draws top systems (ms/frame)
idle 7.08 11.2 50.9 3.75 7.49 0% 2.00 396 Town.update 1.55⚠️, Land.drawPass 0.66, Town.draw 0.56, Walk.casters 0.36
night 5.69 9.40 21.9 0.00 5.99 0% 0.50 371 Town.update 0.86, Land.drawPass 0.69, Town.draw 0.47, Walk.casters 0.31
drive 34.4 74.1 401 341 137 43% 101 120 Land.lightTick 13.5⚠️, Land.gen 4.36⚠️, Land.meshChunk 2.25⚠️, Land.lodData 1.61
flight 13.8 35.5 618 74.6 137 0% 1.50 51.5 Land.lodData 3.04, Folk.update 2.47, BigMap.sample 1.79, Herd.update 0.74
tunnel 12.7 48.4 305 110 145 0% 4.00 266 Land.lightTick 2.21⚠️, Land.meshChunk 1.19⚠️, Land.lodData 1.17, Folk.update 0.96

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
@k06a k06a added the queue In the merge queue: lands on main by itself (node tools/merge.mjs <pr>) label Dec 2, 2026 — with Claude

k06a commented Dec 2, 2026

Copy link
Copy Markdown
Owner Author

The three red checks on the first head (f0be4ed), one by one:

  • 6/12, pax: this PR's. The test still called Town.ground through a one-letter name of the module (const T = G.Town), which no check of the game's source sees. Fixed in 8991bb3, together with the same call in 38 more files of tools/ (four tests, the screenshot recipes); tools/split.test.mjs now reads tools/ for a call of any function that was folded away.
  • 5/12, escape (boxed6 1 scrape, narrow_car_xl 2 scrapes, deadend_car_bus stuck): not this PR's. SC=boxed6,narrow_car_xl,deadend_car_bus node tools/escape.test.mjs gives the same three failures with the same times and counts on main (1bff8c7) and on this branch.
  • perf ab (night spikes/min 0.00 → 5.99, "new"): within the noise of the measure. In the same run idle spikes/min went the other way, 26.2 → 7.49, and this change replaces one column walk by the same walk with its limits read from an object. PRs that carry no rebuilt index.html compare main's bundle with itself in this check and fail the same way (Grass follow-up: no column made in the frame for a far car; marks set aside where the land is compared #519 draws 282 → 292, Plants lean away as whole stems, feet leave trails that grow back #502 idle spikes 3.74 → 15.0), so the thresholds sit below what two runs of one build differ by.

The PR is in the merge queue; it combines with main as build 487 (node tools/queue.mjs try 521).


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
github-actions Bot added a commit that referenced this pull request Dec 2, 2026
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
@k06a
k06a merged commit bebb739 into main Dec 2, 2026
4 of 24 checks passed
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

queue In the merge queue: lands on main by itself (node tools/merge.mjs <pr>)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants