285b5b19e7a9b038215a8e5e829a8e687ab836e3
4 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
285b5b19e7 |
fix: the merged board's live feeds, and two instruments it could not be judged without
An ultracode investigation mapped the single-board work across five parallel readers and three adversarial reviewers. It found things this session would have walked into, and two of them are fixed here. **THE MERGED BOARD WAS SHIPPING WITH THREE FEEDS SILENTLY OFF.** Live ADS-B and live weather were gated on `id !== "california"` — "not the coarse statewide board", correct the day it was written, since live aircraft over a board at 1,919 m to the unit are a glyph problem and one station cannot speak for a thousand kilometres of coast. `cities/unify.ts` then built a board that is the whole state AND metro-detailed, keeping the `california` id deliberately so the fire gate, the ladder's region table and every `?city=` deep link keep working. It inherited a gate meant for something else. Measured before the fix: the `#source` badge read `""` on the merged board and `live weather · live traffic` on the Bay Area's. A defect that reads as "it feels less alive" and never as an error. `carriesMetroDetail(city)` asks the pack instead: `focusRegions` is the honest predicate and needs no new field, because the coarse state pack declares none and every pack with ground worth drawing at metro resolution declares one. **AND ASKING WAS NOT ENOUGH, BECAUSE THE FEEDS ARE PER-METRO.** With the gate fixed the board asked — and was refused: `GET /flights?lat=37.30&lng=-119.25& radiusNm=402 → 400 bad_request, "Nothing this deployment serves is near 37.3,-119.25"`. Correctly: `regionOf` derives its circle from the board's bounds, which on a statewide board is 402 nautical miles centred on the middle of the state, and what the deployment serves is San Francisco and the Southland, five hundred and sixty kilometres apart. `mergedTraffic` asks for both. In `adapters/http.ts` and not `engine/flights.ts` for the reason `TrafficSource` itself lives there: the engine draws darts at coordinates and has no business with provenance, and every interesting part of this merge is provenance. De-duplicated by id, because overlapping circles both see the aircraft between them and `flights.ts` measures a track's span from repeated observations — a duplicate is not merely a double image. `live()` is `some` and not `every`, so one dark metro does not make the other's observed traffic claim to be simulated. Verified: `?lat=37.77` → 200 live, 24 aircraft; `?lat=33.82` → 200 live, 15 aircraft; `#source` now reads `live traffic` on the merged board and stays `""` on the coarse one. **TWO INSTRUMENTS, BOTH BECAUSE THIS SESSION KEPT FAILING WITHOUT THEM.** `scripts/performance-budget.mjs` gains a `california-one` cell. Until now the only way to measure the merged board was to hand-edit the `california` cell's query, run, and edit it back — done six times in one session, which is exactly the procedure that gets half-done. Its `ready` asserts `#sea-section`, not just the signature chapter: `california-overview` is on the coarse board too, so a cell whose `?one=1` quietly stopped working would measure the coarse board and pass. No ports, no section, no readiness. Caps are RECORDED from its first run with headroom, in the same spirit as bay-area and socal — they were briefly copied from `california` and that is wrong for the same reason that cell's numbers are wrong for this board. **No existing cap was raised.** `scripts/look.mjs` gains `--lat/--lng/--standoff/--height`. Every aim in this harness goes through a control a reader also uses, which is right and stays the default — but it means a board can only be photographed where a chapter already points, and the merged board carries the state pack's six: the whole state, the north, two corridors, two doors. None is near a city. The board exists to put cities on the state and there was no way to photograph one; three attempts by clicking the minimap and guessing wheel notches landed in open ocean twice and on empty coast once. The seek moves the camera and nothing else. **A regression the new cell caught within one run.** The first version of the marker fix gated on bounds alone, like the office doors. The coarse state board's rectangle contains San Francisco, so it picked up forty-four company markers it has no business drawing at 1,919 m to the unit: 373 draw calls → 417. Now gated on `carriesMetroDetail` as well, and `california` measures 372,415 triangles / 373 draws — identical to before this commit. All twelve budget cells pass. 1,705 tests pass. Recorded for the next round, from the review: **SoCal's two focus rectangles overlap by 1.7 x 4.6 km** (verified: lat 34.075–34.090, lng −118.300–−118.250), so any per-rectangle terrain tier must clip them to a disjoint cover first or it draws that ground twice. Today's per-axis lattice is what hides it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
068d4d71e5 |
feat: the merged board's cities are lotted like cities, and drawn one city at a time
Three findings, each of which changed the next.
**1. The metros on the merged board were lotted at 806 m.** `LOT` is fixed in
scene units — 0.42 — and `blocks.ts`'s own note already spelled out what that
means: a lot is 40 m on San Francisco's board, 164 m on the Southland's and
**806 m** on the statewide one. Put San Francisco's fifty-two districts *on* the
statewide board and they inherit 806 m. Lots go as the inverse square of their
size, so the Bay Area's ~84,000 buildings became about **two hundred**, and a
city rendered as a handful of grey slabs. That is the whole reason the merged
board's cities looked wrong.
A detail district now measures its lot in metres. 160 m, chosen against a
shipping reference rather than a feeling: it is what Southern California's own
board already builds itself at (0.42 x 390.6), so a metro on the merged board is
lotted about as finely as the Southland lots itself. Measured in the browser:
**59,166 building instances, of which 2,839 are the state's own and 56,327 the
two metros'.** Against roughly two hundred before.
**2. An all-or-nothing LOD could not carry them.** `InstancedMesh.count` draws
the first N instances, so "base first, detail last" can say "no cities" and
"every city" and nothing between. Driving into Los Angeles therefore revealed
San Francisco's fifty-two districts as well, four hundred kilometres away and
behind the camera: `california-drive` measured **925,854 triangles against a
430,000 cap**. Shrinking the lot to fit would have needed about 478 m, which
gives back the entire gain.
So `updateBlocksDetail` re-packs by district. Each detail district's lots and its
centre are recorded at build time; when the visible *set* changes — a handful of
times in a journey across California, not per frame — the visible districts are
copied into the front of the instance buffers and `count` moves. Three
attributes move together and must: the matrix, the colour and
`FACADE_ATTRIBUTE`, which is per-instance and decides which windows are lit;
moving matrices alone would light a tower's windows on a warehouse.
`california-drive` fell 925,854 -> **368,962**.
**3. Two bugs in that, both mine, both found by measuring rather than reading.**
- `DetailStore.key` remembers which districts the buffers hold, and started as
`""` — which is also the key an *empty* visible set produces. The first call,
at the whole-board pose where nothing should draw, compared equal, took the
early return and did nothing.
- `InstancedMesh`'s constructor sets `count` to capacity, so between
`createBlocks` returning and the scene's first `applyDetailLod` the mesh drew
every detail lot. The budget reports `maxTriangles` — a max over the whole
sample window — and caught that as **911,541 triangles while the steady
state was a correct 348,271**. A level of detail that is right on every frame
but the first is not a level of detail. The mesh is now born packed.
The second one is the instructive one: an instrumented log showed `count=2839,
want=false` at exactly the pose the budget was failing, which is what turned a
"the LOD is broken" hypothesis into "the LOD is right and the first frame is
not".
Result on the merged board, all triangles green: california 348,271 of 440,000 —
**lower than the state board's own 372,415** while carrying 56,327 more
buildings — and california-drive 368,962 of 430,000.
Still red, and unchanged from before this commit: `california-drive` mobile draw
calls, 315 against 280. Triangles there are now fine. That cap was set when the
corridor had no cities on it, and re-deriving it is an owner's call rather than a
number to quietly raise.
1,704 tests pass, including a regression test for the empty-key bug that reads
the source, because building a real `InstancedMesh` needs a GPU.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
64618cb47d |
perf: one lake mesh per board, and the merged board's metro layers get an LOD
Closing the merged board's red budget cells, and one of the two fixes turned out to be a win for every board in the product rather than for this one. **Every lake on a board is now one mesh.** `createWater` built a `Mesh` and a `MeshStandardMaterial` per inland-water polygon, so a board paid a draw call per lake. It went unnoticed while the boards were separate — California draws one, the Salton Sea — and a scene census on a phone found it the moment `unify.ts` folded three packs together: **water=20 against water=1**, nineteen of the fifty-eight draw calls that put the merged board over the mobile cap. They differ in nothing but shape, so the geometries merge and the material is shared. The 0.05 lift is baked in before the merge, since afterwards there is no per-lake mesh to carry it. Measured on the shipping default, unrelated to any flag: socal 218 -> 205 draw calls, bay-area 208 -> 202, california 374 -> 373, california-drive 233 -> 232. It was never free anywhere. **The metro-scale layers now follow the same reveal as the buildings.** Bridges, airports, ports and vessels are handed to `applyDetailLod` and hidden with the detail districts. That every one of them is metro detail on a merged board is measured rather than assumed: the same census showed all seven named bridges, all eight airport layers and every port mesh going from *zero* on the state pack to one on the merged board — `california.ts` authors none of them. Together they were the remaining 27 of those 58 draws, for structures sub-pixel at 1,919 m to the unit. Result on the merged board: california desktop 348,271 triangles of 440,000 and 372 draws of 415 on mobile, both green where mobile was 428 before. **`DETAIL_REACH_M` is 60 km, down from 150.** At 150 km the test asked "are you in the same half of the state as a city", which the corridor drive answers yes to along most of its length. 60 km asks "are you looking at a city", which is what the flag is for — and driving up US-101 the Southland now appears as you come into it rather than while you are still in the Salinas Valley. **The metro chapters were merged, photographed and reverted, and the reason is recorded rather than the attempt deleted.** Converting a metro rung onto this board is easy and was done correctly — `focus.lat/lng` is absolute, `distance` is horizontal in the owning board's units and `height` has already been through that board's exaggeration, so each keeps its true metres. The camera arrives exactly where it should. What is *at* that range is the problem: two scene units from the target on a 551-unit board, and the corridor there is a deliberate 4.7 km-wide atlas glyph, because DRIVE mode has to be able to drive down it on a board where a real freeway is a fifth of a pixel. The delivered frame is a black slab across San Francisco. A rung that flies you into that is worse than no rung. They come back when the corridor is drawn at true width, which is `createFreewayWorld` and the `roads` rule, not `unify.ts`. `airportsAndCard.test.ts` asserted a literal one-liner that is now two statements — the airport group is captured so the LOD can hide it. Split into the two facts it was ever about: the `?? []` call exists, and the result is added. 1,701 tests pass. The full budget passes on the shipping default. Still open on the merged board: `california-drive` mobile peaks at 315 draws against 280. The steady state is +3 drawables over the state board; the peak is the car driving into a metro and revealing it, against a cap set when the corridor had no cities on it. That is a cap to re-derive for a board that now has them, and it is an owner's call rather than a number to quietly raise — which is why this is still behind `?one=1`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
15d7accdbb |
feat: one California as one pack, behind ?one=1
The nesting preview is gone and this replaces it. That one drew each metro's
built scene inside the state board's under a similarity transform; the transform
was right and two independently built terrains then occupied the same ground and
interpenetrated. `cities/unify.ts` is the version with no seam to stitch,
because the way to not have two grids is to not have two grids: one `City`
carrying the state's landform and both metros' detail, so the engine builds one
world, one lattice and one terrain mesh.
**The merge is mostly a union and twice it must not be.** Everything that
describes a place in a `City` is absolute lat/lng, so hills, districts,
landmarks, bridges, ports and airports concatenate. Two do not:
- `World.elevationAt` *blends* every hill covering a point, so leaving the
state's coarse hills under a metro's fine ones adds their heights and lifts
the whole Bay. 25 state hills are dropped where a metro replaces them.
- The state's 17 districts include coarse stand-ins for both metros against
the metros' 99 real ones, and both drawn is two cities in one place. 9 go.
Filtering is by centre-in-bounds, which is honest and not exact, and the file
says so rather than hiding it.
**The lattice was the whole question and the answer was measured, twice.**
`TODO.md` records a statewide lattice at metro fidelity as 23.7M points and
dead. That is true at San Francisco's own 45 m cell, because `buildAxis` refines
per *axis* — a plus, not a box — so two metros at opposite corners refine most
of the state. The blowup is a function of the fine cell and is gentle until 45 m,
so the first pass took 150 m / x8, or 1.23M points.
That rendered **1,114,226 triangles at the whole-board pose against a 440,000
cap**, and the useful part is where it did *not* come from: with every metro
building hidden, triangles fell by 43,000 and draw calls by 111. The buildings
were never the cost. Terrain was. So the fine cell is what a statewide board can
afford without terrain LOD, and that is **300 m / x16** — 0.18M points, 11.6x
finer than the state pack's 3,473 m cell and 6.7x coarser than San Francisco's
own board. Measured at that size: california 392,862 triangles of 440,000 and
california-drive 405,124 of 430,000, both green on desktop.
**And the detail LOD is the cheapest kind there is.** `createBlocks` now orders
every `detail` district's lots *last*, so hiding 99 districts' buildings is one
assignment to `InstancedMesh.count` — no second mesh, no second draw call, no
allocation, and nothing for `nightlights.ts` to learn, since it holds the same
mesh either way. Landmarks are one mesh each so theirs is a `visible` flag.
The reveal is two tests and needed both. Stand-off alone passes for the drive
chapter, whose camera sits a few tens of metres off the ground half way up the
state while being two hundred kilometres from the nearest building this governs
— measured, it failed `california-drive` on triangles for lots nobody could see.
So detail draws only when the camera is inside `DETAIL_STANDOFF_M` *and* its
**target** is within `DETAIL_REACH_M` of a detail district. The target rather
than the camera, because the target is what is being looked at.
`src/test/unify.test.ts` pins the two non-union merges, the detail marking and
the lattice size. Writing it turned up something worth keeping: **six hills are
named in both the state pack and a metro pack** — Marin Headlands, San Bruno
Mountain, Mount Diablo, Bolinas Ridge, Mount Gleason, Mount Wilson — so the
first version failed on San Francisco's own Marin Headlands, identified as a
state hill by its name. `ladder.ts` hit this with "Whole Board" on two boards.
A name is not an identity; the test keys on the object.
Known and not fixed: mobile draw calls are 428 of 415 and 315 of 280 on the
merged board, from the port, vessel and bridge layers that the state board never
carried before and that no LOD hides yet. That is why this is still a flag.
Default is untouched and the full budget passes with it off.
1,700 tests pass.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|