Skip to content

Road traffic as a stream of the world clock: same cars for host and guest, real hourly flows - #503

Merged
k06a merged 5 commits into
mainfrom
claude/project-thread-huaol5
Dec 2, 2026
Merged

k06a merged 5 commits into
mainfrom
claude/project-thread-huaol5

Conversation

@k06a

@k06a k06a commented Dec 2, 2026

Copy link
Copy Markdown
Owner

Requested by Anton · project thread

What

Second part of "every inhabitant runs its own deterministic algorithm" for the cars of the roads between towns.

  • 🛣️ Road traffic is a stream of the world clock. Car j of a lane sets off at j·D of Wx.clock(); its kind, seed and driver's pace follow from the lane's seed, its place from a time profile of the lane at that pace (Town.rdQ, rdCar, rdAt). The owner of a world and a guest have the same cars at the same places with nothing sent. The old per-device random filling (rdFill) is gone.
  • 🏍️ Only a car a player touches travels over the net (Net.rdHot): ridden or pushed, it is sent while the player is with it; then every device drives it on. A row carries the lane (rt −1) or the stall of the town it visits (rt −2 − k), so a device that lacks the car brings it back as the same car (rdFind, rdRevive), does not make a second copy of a ridden one (rdHold), and turns it into the town to the same stall (rdSame, roadIn(c, want)).
  • 🚗 Flows measured against real roads, by the hour. The roads were far emptier than real ones. The headway of a lane now comes from vehicles per hour per lane (rdPeak: 380 on 1+1, 900/600 on 2+2, 1000/750 on 3+3) and the share present at an hour from a weekday curve (RD_HOURS: peaks at 8 and 17, a twentieth at 3).
  • 🙋 A driver who gives the wheel up always stands somewhere (Drive.aside): beside the door, the other side, or on the road behind the vehicle when there is no ground at either side (a bridge edge). The driver used to get no place and vanish.

Rules and tests

  • docs/ARCHITECTURE.md: "The traffic of a road is a stream of the world clock; only a car a player touches travels over the net" and "How many cars a road carries is measured against real roads, by the hour".
  • tools/rdstream.test.mjs (new): a device that drove the world for 40 s and one that comes in then have the same cars at their places; nothing is made in sight; untouched cars are not sent; a missing car comes back on its lane and as a visitor to the same stall; a ridden car is not made again; flow past a point in a minute at 8:00 and at 3:00 against the flow asked for; the ceded driver stands on the road.
  • tools/roadin.test.mjs: picks a road that has a way into its town and enough strangers' stalls (since build 454 many road ends stop short of the streets; that generator defect is with the town thread).

Local runs on this branch built on main: rdstream OK, roadin OK, folk OK, urban OK, traffic OK.

Screenshots

tools/shots/468.mjs: the same road into a town at the morning peak and at 3 at night. The release workflow attaches them.

Not in this PR

Cars still exist only in the physics circle around the player; drawing the stream on far roads straight from rdAt comes next.


Generated by Claude Code

@k06a k06a self-assigned this Dec 2, 2026
@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
…the road

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UiczdrQkRq9cma4smGik1v
@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 2 gating metric(s)

scenario metric main PR Δ threshold
idle spikes/min 18.7 33.7 80% ❌ ±50%
night cpu.max 29.3 60.0 105% ⚠️ ±50%
night slow/min 0.00 8.99 new ❌ ±67%
scenario CPU mean p95 max slow/min spikes/min miss sync gens draws top systems (ms/frame)
idle 4.84 8.50 40.3 3.74 33.7 0% 0.50 363 Land.drawPass 0.78, BigMap.sample 0.44, Town.update 0.43, Walk.casters 0.23
night 5.38 9.05 60.0 8.99 21.0 0% 0.00 348 Land.drawPass 0.80, Town.update 0.73, BigMap.sample 0.33, Town.draw 0.28
drive 49.1 101 274 469 20.0 68% 81.0 99.0 Land.lightTick 20.9⚠️, Land.gen 6.50⚠️, Land.lodData 3.48, Land.meshChunk 1.99⚠️
flight 17.5 47.5 806 84.9 190 0% 2.00 47.0 Folk.update 3.74, Land.lodData 3.71, BigMap.sample 1.70, Nest.update 1.11
tunnel 18.6 64.0 396 142 177 0% 0.50 224 Land.lightTick 3.34⚠️, Land.lodData 2.56, Folk.update 1.62, Land.meshChunk 1.52⚠️

Over budget (ms/frame, budget): drive Land.lightTick 20.91 > 1 · drive Land.gen 6.50 > 0 · tunnel Land.lightTick 3.34 > 1 · drive Land.meshChunk 1.99 > 1 · drive gl.upload 1.64 > 0.8 · tunnel Land.meshChunk 1.52 > 1 · drive Town.update 1.44 > 1 · flight Land.gen 0.17 > 0


Generated by Claude Code

@k06a
k06a merged commit 1f948e8 into main Dec 2, 2026
1 of 2 checks passed
k06a added a commit that referenced this pull request Dec 2, 2026
dev: #498, #503, #507, #508 in one merge (builds 482, 483)
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Screenshots of build v476

🚗 The road into the town at 8:00, the morning peak: as many cars as a road of one lane each way carries then

The road into the town at 8:00, the morning peak: as many cars as a road of one lane each way carries then

🚗 The same road at 3:00: next to nobody on it

The same road at 3:00: next to nobody on it

All of them are assets of the v476 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