While a structure is being placed, the land beyond reach draws dimmed #133
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "task/3612-while-a-structure-is-being-placed-the-la"
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?
Tracker: #3612
Step 6 of plan #3558 (decision D2, refusal row 14). While the player arms a structure (Factory, Turret, Airport, Helipad, Silo or Shipyard), the ground and water beyond their reach draw dimmed. Disarming, placing, a right-click, arming a house or aiming the bomb clears it.
What it delivers
The mask is the shared rule's reach refusal.
beyondReachin src/shared/site.ts marks every map tile that lies beyondSTRUCTURE_RANGEof the ground of every city the player holds. Those are the tiles whereinReachfails, whichsiteRefusalrefuses asSiteRefusal.Reachwhen no earlier refusal (terrain, a held tile, a street, a plot or the block) applies.heldLayoutsnames the cities a player holds, and both the replica's site view and the veil call it.The veil (a new src/client/render/reach.ts) is one plane over the map, at TILE_TOP + 0.05. That is above the land's top and a street's paving, and under every unit, tree and building. It draws black at 45% over each tile beyond reach, with crisp tile edges (nearest filtering). It runs
SEA_MARGINpast the map's edges. Its texture holds the map's tiles inside a one-texel border at full dim, and the clamped texture carries that border across the margin, so every point off the map draws dimmed: nothing can be placed there.Nothing draws at rest. The veil is hidden until a structure is armed. Its program is compiled with the view (three r186's
compileprepares hidden meshes too), so arming adds no shader program.Arming (src/client/input/pointer.ts): the Commander's
onPlacinghook shows the veil when a structure is armed and hides it when placing changes to anything else.GameView.renderderives the held cities from the frame's players, cities and layouts.The Map Yard gains
&placing=<type>, a structure'sUnitTypeId(for example&placing=4for a Factory). Once the yard settles, it dims the land beyond player 1's reach, as arming that structure does, and holds. The view and finish links keep it, and?benchbenches it.The help's Build line and changelog.md record it.
The HUD layout phone test (src/client/hud.phone.ts) runs each scene as its own test on each screen, on one page per screen, instead of one test looping over all 29 scenes. Each test then takes a fraction of vitest's 5 s timeout inside the full phone suite. This is bug #3419. At
375b644it failed run 235's secondfull, the gate step'sfull(job 47), run 239's three quietfullruns (at 5002–5006 ms) and run 241's own phone suite. Run 233'sfullat942a9c5and run 235's thirdfullat375b644passed it.Evidence
Tests
siteRefusal(…) === SiteRefusal.Reachtile for tile, for a land structure on land and a shipyard on water.SEA_MARGIN− 0.5 tiles out along its whole length, corners included, all read dimmed.&placing=4adds exactly one draw call and no shader program from the settled yard to the held frame. The lush probe, which lies beyond player 1's reach, draws at 0.5–0.6 of its brightness at rest.Map Yard renders (WebKit, iPhone 15 landscape, reduced motion), every finish at 1×, 0.5× and the overview, at rest and with
&placing=4: no page error, and in each finish and view the placing load draws one more call and two more triangles than the rest load, with the same program count.Off the map (
?land, where player 1's towns at 5,15, 79,6, 118,20 and 116,35 reach the west, north and east edges): every finish at the overview,view=edgeand 0.25×, for the reviewed veil at942a9c5and this head with&placing=4, and this head at rest.Draw checks (the standing Map Yard WebKit bench, iPhone 15 landscape, default finish), run at
942a9c5. The border since grows only the veil's texture, from 128² to 130² texels, and adds no call or triangle, so they were not rerun. There were 5 sessions of 7 interleaved runs per arm, 1,155 pages in all.4c87e97, head942a9c5, head?placing=4(Factory), and?doom=battle,?doom=battle&spare,?doom=nukeand?doom=nuke&spareon both base and head.git archivetrees served by vitepreview. Figures are medians of the 35 runs per arm, in ms a frame, with the phone estimate (7.5 × the delta) in brackets.At rest: head draws the same calls and triangles as base in every view, 67 / 65 / 41 calls. Its frame time is within ±0.007 ms of base's.
Placing: the veil adds 1 call and 2 triangles. It costs at most +0.023 ms a frame (+0.18 ms on a phone). The per-session deltas at 1× were +0.020 to +0.030 ms.
Destruction peaks (doom − spare, head against base):
Each peak's head − base gap is within ±0.03 ms (±0.2 ms on a phone).
Gates on
375b644, on s32:sak-gate fastrun 1 failednpm test882/883, only on craft's "lands two gunships on their helipad…" with "Test timed out in 5000ms", the known s32 contention timeout. That file passed alone, 22/22 in 3.2 s.sak-gate fullrun 2 passednpm test883/883.test:phonegave 66/67, failing only on the HUD 1280×720 layout timeout, bug #3419. Every Map Yard test passed, the?placingtest among them.hud.phone.tsrun alone then passed 31/31 in 20 s.sak-gate fullrun 3 passed:npm test883/883 in 28.6 s, andtest:phone67/67 in 202 s.Gates after the gate step's
full(job 46 on s32 at375b644, which failednpm test876/883). Every failure was "Test timed out in 5000ms" or hud-mock's follow-on assertions after its scene loop timed out: hud-css text contrast, hud-mock's scene loop, two craft gunship-landing tests and collapses' no-scale test. A later run on the same head, with no code change:sak-gate fullruns 1 and 2 started while Spotlight indexing and another session's Gradle build loaded s32. Both failednpm teston the same kind of timeouts, at 47.7 s and 44.5 s. In the same window, the base tree (4c87e97) and the head each failed craft's gunship-landing timeout, at 36.4 s and 37.2 s.sak-gate fullruns 3, 4 and 5 started on a quiet machine. Each passednpm test883/883 in 27.6–29.6 s. Each gavetest:phone66/67, failing only on the HUD 1280×720 layout timeout (bug #3419) at 5002–5006 ms, and every Map Yard test passed.hud.phone.tspassed 31/31 in 20–23 s, with the 1280×720 case taking 2.8 s. The base tree's phone suite failed the same test at 5002 ms. This branch changes no HUD code: its only HUD-visible change is one sentence in the help's Build line.The HUD layout test split (#3419), on s32:
375b644: the gate step'sfull(job 47) and this run's own full phone suite each gave 66/67, failing only the 1280×720 loop over 29 scenes at 5002 ms, as run 239's threefullruns on a quiet machine had.546c7da: the full phone suite passed 179/179, the 4 loop tests having become 116 scene tests. Under the full suite the 1280×720 screen's 29 scenes summed to 5.2 s, more than the old single test's 5 s limit. The slowest scene took 654 ms (base, the first, which loads the mock cold), and the next 349 ms. Run alone, hud.phone.ts passed 143/143 in 19.4 s.factorytaken out of the scenes that must show Selected and a control that does not exist added to base's, 8 tests failed: the base and the factory scene on each screen, each naming its fault.Gates on
546c7da, on s32:sak-gate fullrun 1 passed:npm test883/883 in 29.0 s, andtest:phone179/179 in 204.6 s.full(job 48) failednpm test882/883 in 37.6 s, only on craft's "lands two gunships on their helipad…" with "Test timed out in 5000ms". This is the load timeout of bug #3595.sak-gate fullrun 1 passed:npm test883/883 in 27.7 s, andtest:phone179/179 in 202.4 s.