Commit graph

73 commits

Author SHA1 Message Date
Frederic Jung
372893ec75
Weekly puzzle generator: themed, solver-budgeted, verified by the game's own stars; first three weeks 2026-10-28 20:42:51 +01:00
Frederic Jung
a4f89491e6
Docs: the single-file page and English keys lasted until 1.34 2026-10-27 11:28:17 +01:00
Frederic Jung
0057e74472
Ship short ids instead of labels; checker, tests and docs for labels
The build swaps every label for a short id in the shipped page, the inlined
English and the translation files (scripts/lib/compile-labels.js). Labels
passed to N_() stay whole because saves keep them. Against 1.33: page +4%
gzipped (321 -> 335 KB), translations -40% (it.js 143 -> 85 KB); routing,
day, panels, dashboard, map and boot time unchanged.

- i18n-check rejects labels the build cannot see (outside tr/trn/N_)
- tests/pages.test.js plays the shipped page in English, Italian and French
- docs/adr/0003, add-strings skill, ARCHITECTURE, README, CONTRIBUTING,
  CLAUDE.md describe labels
2026-10-27 11:27:11 +01:00
Frederic Jung
9043af5ab0
port-branch: keep English for labels your side still uses 2026-10-27 11:06:29 +01:00
Frederic Jung
315ab1fac5
port-branch: merge English entry by entry, like the translations 2026-10-27 11:06:11 +01:00
Frederic Jung
76d3d7d199
port-branch: compare plural entries by value 2026-10-27 11:05:35 +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
6f95539b2d
port-branch: work in both merge directions 2026-10-27 10:23:33 +01:00
Frederic Jung
052fdd713f
port-branch: keep code after the ACT block in very old versions 2026-10-27 10:11:07 +01:00
Frederic Jung
657e7b8083
port-branch: also handles branches started from older versions of the page 2026-10-27 10:10:56 +01:00
Frederic Jung
c64b139a86
Fewer merge conflicts: actions by area, one city per line, sorted dictionaries
- ACT is split by area into game/90-actions/*.js (const ACT in the first file,
  Object.assign in the rest)
- CITY_LL, CITY_NUDGE and LANDS_LL have one entry per line; the id-keyed ones
  are sorted
- site/i18n/*.js are sorted, one entry per line; i18n-check enforces it and
  --fix (npm run i18n:fix) restores it; scripts/i18n-add.js adds, removes
  and renames entries in place
- scripts/legacy/port-branch.js moves a branch's site/index.html edits into
  src/ during a merge with main
- perf workflow and PR template build the base page with scripts/lib/page.js
2026-10-27 10:10:16 +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
Frederic Jung
c76dd4d556
Benchmark in real Chromium too, and only call a row slower when the samples say so
npm run perf -- --browser times the same workloads in Chromium as a desktop
and as a phone (390x844 at 3x, CPU slowed 4x), one browser per version. Each
run collects garbage first and ends by forcing layout and the map canvas, so
deferred work counts. The jsdom DOM is about 30x slower than a browser's and
has no layout, so the interface rows need this.

Shared machines swing single runs by 30% on identical code, CPU time
included. A row now counts as slower or faster only when it moved 15% and a
Mann-Whitney U test gives p < 0.01 (15 runs a side by default). Identical
code: no flags in three full runs; a routing slowdown planted in a copy is
flagged in jsdom and on the phone.

The panel workload renders both selections every run instead of alternating,
which split its samples in two. CI drives the runner's Chrome through
playwright-core, no browser download.
2026-10-26 12:04:57 +01:00
Frederic Jung
e5deb90968
Routing reference test runs on today's routing loop; perf bench reads exported saves
The reference test from #106 now patches the loop as it looks after #96
(business-first passes) and also covers prefer, prepend and protect
customers. It catches an exit index that ignores RouteScript preferences,
which the shortcut test in speed.test.js cannot see.

npm run perf -- --save accepts files from the in-game Export save, so
scripts/benchmark-performance.js and its README section are not needed.
The performance skill documents --save, both equivalence tests and how to
handle noisy runs.
2026-10-26 08:40:20 +01:00
LookedPath
ffb8c50895 Add routing reference regression and exported-save benchmark 2026-10-26 06:11:12 +00:00
Frederic Jung
308c3f7045
Performance benchmark on a big network, posted on every PR
scripts/perf-bench.js times routing, a game day, an action, panels, the
NOC dashboard and the map on tests/fixtures/big-network.json (104 POPs,
950 PNIs, 832 caches), base and head in alternating turns, and says
whether routing results changed. perf.yml runs it on every PR against
the base; perf-comment.yml posts the table as one updated comment.
New performance skill, CLAUDE.md rule, PR template and docs.
2026-10-26 06:39:23 +01:00
Frederic Jung
4e95b9b397
CI: translation coverage job
A separate 'translations' job runs the i18n checker on every push and
PR and writes a coverage table per language to the run summary, with
the missing, broken and unused keys listed. The checker now also fails
when a language file is not offered in SOT_LANGS or cached in sw.js.
2026-10-26 06:04:28 +01:00
Frederic Jung
5786f76ed9
Rework the phone layout and make the game installable
Phones get a one-row status strip, a bottom tab bar (play, speed, goals,
deals, NOC, networks) and draggable bottom sheets; in landscape the sheets
slide in from the side. Toasts can be tapped away, dialogs become bottom
sheets and the title screen keeps its start button in reach.

Adds a service worker for offline play and an install button (the
browser prompt on Android, instructions on iOS).
2026-10-24 22:52:55 +02:00
Danilo Carbonaro
42711456e2 Tidy the i18n layer after review
- Badges that react to sharks, anchors, crocodiles and llamas read the
  English text of the incident again, so they unlock in every language.
- Scenario names are looked up when shown, so they follow a language switch.
- Fall back to English (and lang="en") when the dictionary did not load,
  and version the dictionary URL so a release never pairs with a stale one.
- Share the segmented-button helper between settings and the title screen,
  merge keys that only differed in a placeholder name, and slim the check
  script.
- Tests: guard the hooks the tour patches into fireFailure/fireEvent, and
  cover the dictionary fallback and the scenario name.
2026-10-24 21:52:27 +02:00
Danilo Carbonaro
04eb32e0a5 Add Italian translation and a language switch
English stays the source text and the default. Player-facing strings go
through tr()/trn(), which look the English up in a per-language dictionary
(site/i18n/<lang>.js) and fall back to it unchanged. The dictionary is only
loaded when the game runs in that language. The language follows the
browser on the first visit and can be switched under Settings or on the
title screen; the choice is remembered.

- site/i18n/it.js: complete Italian translation (~1900 entries)
- scripts/i18n-check.js / npm run i18n:check: lists missing or stale entries
  and translations that drop a {placeholder} or HTML tag
- tests/i18n.test.js: language selection, fallback, dictionary integrity,
  and a tour of every screen, failure and event in English and Italian
2026-10-24 21:52:27 +02:00
Frederic Jung
494d71793e
Fix map wrap, touch and keyboard input; harden build and release workflow; docs 2026-10-23 17:56:34 +02:00
Frederic Jung
e082d6fc60
Persist games across reloads and announce new releases
- Autosave every five seconds while playing, plus on pagehide and when
  the tab is hidden. On load, a saved game resumes immediately (same
  speed and camera) instead of waiting behind the title screen.
- The build turns this version's CHANGELOG section into release notes:
  baked into the page for a one-time "What's new" card for returning
  players, and published as /version.json.
- Open games poll /version.json every 10 minutes and when the tab comes
  back into view; if a newer release is out, a banner offers to save
  and reload.
- "Start a new network" moves into the help screen, behind a confirm.
2026-10-23 11:42:28 +02:00
Frederic Jung
1685a045e6
Series of Tubes 1.0.0
A cartoon browser game about building the internet, deployed to
https://seriesoftub.es from published releases only.

- site/: the single-file game plus favicons, app icons, manifest,
  social image, robots.txt, sitemap.xml, llms.txt and a 404 page.
- Full SEO head: canonical URL, Open Graph and Twitter cards,
  WebSite and VideoGame structured data, noscript fallback.
- Cookieless Ridiculytics analytics via stats.seriesoftub.es, pinned
  with SRI and active only on the production domain.
- Headless test suite (node:test + jsdom), CI on every push, and a
  release workflow that verifies the tag, tests, builds, deploys to
  GitHub Pages and pings IndexNow.
2026-10-23 09:01:39 +02:00