Commit graph

20 commits

Author SHA1 Message Date
Frederic Jung
e90f5f675e
Puzzles: real traffic routed by the game, routers, link sizes and paths
Every puzzle now carries demand (eyeballs pulling from a content origin, circuits
with latency caps, best-effort flows) routed by compute(). Stars: delivered,
within budget, N-1 under load. Routers, ports, metrics, standby and the
redundancy check work in puzzles; the whole world is open. Weekly schema 2
carries the demand; scripts/lib/puzzle-solver.js sizes and searches builds.
2026-10-29 10:35:28 +01:00
Frederic Jung
efb14680cc
Merge save slots: one network per window, consistent saves 2026-10-29 07:57:00 +01:00
Frederic Jung
5f412f72d8
Merge v2 into v2-saves 2026-10-29 07:32:19 +01:00
Frederic Jung
5c2b3a4758
Map: a link's curve only measures the cities that could be in its way
bezGeom() measured every city against every candidate curve, for every link the
first time the map drew it. A curve stays inside the box of its end and control
points, so a city further than the clearance it needs outside that box always
measures as clear; leaving it out gives the same curve. About 4x faster, and
the curves on the big fixture are byte-identical.
2026-10-29 07:01:01 +01:00
Frederic Jung
adc312f27b
Map: test land polygons against their bounding box first
The sea waves, hills and the far view's islet list test points against every
coastline polygon while the page loads: about 0.8 s of a throttled phone's load.
A point outside a ring's box is outside the ring, so nearly every test stops
there. Waves, hills and the far view's islands come out byte-identical.
2026-10-29 07:00:53 +01:00
Frederic Jung
da8150b7c4
Save slots: several networks per browser, one per window, with a cross-window guard 2026-10-28 20:52:47 +01:00
Frederic Jung
946da17c8b
Merge Puzzles, Tier 1 by customer cone and badge variants into v2 2026-10-28 18:14:56 +01:00
Frederic Jung
8df1b82a2e
Puzzles behind the Puzzles door: merge v2-puzzles onto the ruleset
Puzzles run on the puzzle preset (clock off); the temporary title button is gone and the door opens the puzzle list.
2026-10-28 16:39:05 +01:00
Frederic Jung
7fc8d0f080
Puzzles: small, calm network builds with stars, packs and a weekly puzzle (#190) 2026-10-28 16:21:25 +01:00
Frederic Jung
fa4e30692e
Merge the ruleset and four doors into v2 2026-10-28 15:45:09 +01:00
Frederic Jung
531f90f107
One game, four doors: a per-save ruleset with Change Freeze, On-call and BGP at 3 a.m., a real Sandbox, and a new start screen 2026-10-28 15:27:04 +01:00
Frederic Jung
a6829b3d66 Merge #131: Custom routing metric for links (MurphysHub) 2026-10-28 14:58:12 +01:00
Frederic Jung
8b8bfadbaa
Start anywhere: pick any city with transit as your home 2026-10-28 08:30:17 +01:00
Frederic Jung
87fac683f0
Language is a dropdown on the title screen and in Settings 2026-10-28 08:18:56 +01:00
Frederic Jung
b4f8d9c7f5 Put a link on standby; the routing metric stays per city pair (#122)
A backup-only link next to a normal one still carried traffic, because
parallel links merge into one edge. The metric stays on the city pair
(S.pairMet), and any link can go on standby: it adds capacity that
fills only after the active links, so it idles as a backup, takes the
overflow when they are full and carries the traffic when they are down.
Build order no longer matters, and adding a link never idles the
others. Old saves keep each pair's lowest metric with every link
active, which is how they routed before. The panel says what a standby
link is doing, the redundancy list tags it, the map draws it dashed
while idle, and traceroute shows the active link.
2026-10-28 07:11:47 +01:00
Hugues
a3dd1dd810 Busy maps: no link labels or fiber dots above 1,000 lines on screen
On a save with 2,700 lines on screen, Firefox spent about 95% of each
frame painting, and the dotted line on lit fiber (~160 ms) and the link
labels (~55 ms) were half of it, in a tangle where neither can be read.

draw() now counts the lines it would paint (linesOnScreen(), same box and
margin as its own culling, boxes cached on the geometry) and above
MAP_BUSY = 1000 leaves out both. They come back as soon as fewer lines
show, zooming in for instance. The selected link keeps its label.

Firefox Developer Edition headless, 1600x900 at DPR 2, player save, median
of 3x9 frames: save view 414 -> 214 ms, pan 472 -> 238, zoom 0.6 269 -> 181,
New York zoom 2 213 -> 107, selected link 412 -> 201. Under the threshold
pixels are identical (canvas SHA-1): zoom 3.2 and 6 on the player save, six
views of the big-network fixture.
2026-10-27 14:03:04 +01:00
Hugues
ecb862e70d Map of huge networks: fiber capacity once per frame, skip links off screen
draw() asked dfCap() three to five times per fiber link and per frame (width,
colour, label, up or down), each time over all its channels: on a save with
3,140 dark fibers of 18 channels on average that was about half of draw()'s
JavaScript. dfCap() now keeps its answers in DFC while one frame is drawn
(cleared in a finally, so a failed frame keeps nothing), and the link label is
built once per line instead of once per world copy. Links entirely above or
below the screen are skipped like those left or right of it already were.

Player save (202 POPs, 3,142 links), jsdom: draw() 40 -> 25 ms; perf-bench
"Map at three zoom levels" 89.7 -> 47.1 ms. Canvas call log identical at
every zoom without the vertical skip; Firefox pixels identical (SHA-1 of the
canvas) in 7 views. Firefox still spends ~95% of the frame painting.
2026-10-27 13:44:47 +01:00
Frederic Jung
e817beed1a
Translations keyed by labels instead of English text
tr('pnis.delivery_2_to_6_weeks') instead of tr('Delivery: 2 to 6 weeks'): the
English lives once, in src/i18n/en.js (inlined into the page at build, so no
extra request), and it/pt/fr map the same labels. Changing English wording no
longer renames a key in every dictionary.

- 2,899 labels, made from where each text is used and its first words; short
  shared words are common.*
- plurals are one label with {one, other}: trn('label', n)
- static markup: data-i18n="label", data-i18n-aria-label, data-i18n-title
- saves from 1.33 and older stored English text in a few places; tr() still
  resolves it
- i18n-check: undefined/unused labels, markup drift, plural shape; i18n-add.js
  works on labels and --rename updates src/ too
- the old-branch port tool gives old English-keyed code and dictionaries the
  same labels
2026-10-27 11:05:09 +01:00
Frederic Jung
dbbbdaa1e3
Merge main (city density rule) into the split layout via port-branch 2026-10-27 10:23:42 +01:00
Frederic Jung
67a40942b4
Split the game page into partials under src/, assembled into one index.html at build
site/index.html (900 KB of HTML, CSS and JS in one file) becomes src/: a shell
(src/index.html), styles/ and game/, concatenated in path order by
scripts/lib/page.js. The assembled page is byte-identical to the old file, so
load time and in-game performance are unchanged.

- scripts/build.js replaces build.sh (same env vars, same output)
- npm run dev: a zero-dependency dev server that assembles on every request
- tests assemble the page in memory; npm test runs every tests/*.test.js
- perf-bench takes --base-ref to build a git ref's page
- scripts/legacy/split-index-html.js is the splitter, kept for older branches
2026-10-27 10:05:56 +01:00