Commit graph

67 commits

Author SHA1 Message Date
jvanvik
61e31c53d3 Merge upstream: Lambda Bazaar, traffic badges, moving customers and faster routing (3.3.0)
Some checks are pending
CI / plan (push) Waiting to run
CI / part (push) Blocked by required conditions
CI / build (push) Waiting to run
CI / translations (push) Waiting to run
CI / test (push) Blocked by required conditions
CI / timings (push) Blocked by required conditions
Container image / gate (push) Waiting to run
Container image / test (push) Blocked by required conditions
Container image / publish (push) Blocked by required conditions
CHANGELOG.md: upstream's released sections as they are; main's 11 Unreleased bullets kept under Unreleased.
scripts/lib/route-fuzz.js: upstream's skip of dashboard tabs the base lacks, plus main's trimming of args the base's buttons lack.
src/game/10-catalog/40-ports.js: upstream's one-pass portsAt(); an express still takes ports per channel at its ends.
src/game/10-catalog/60-reach-and-subsea.js: upstream's dfLit/dfCap0/dfOn (managed waves carved out); capOf() keeps xp and sat.
src/game/60-features/80-new-game.js: upstream's vol and cm in a new game, with main's ip4, rgen, mp and saved-shape fields.
src/game/60-features/95-standing-orders.js: upstream's portsAt, cachePlan and promiseCheck, inside main's build-standard routers order, optup marks, opsDarkPre and decom gone list; opsPairs still leaves satellites out.
src/game/80-simulation/30-compute.js: upstream's routing core; main's satellite edges (SATN) pass into it, express risks and sat/ip4 money stay.
src/game/80-simulation/29-route-core.js: main's satellite latency note moved into the core, where upstream moved the flow loop.
src/game/80-simulation/40-billing.js: main's linkCut() and xp/sat in linkDown(), with upstream's dfOn().
src/game/80-simulation/50-sanitize.js: upstream's cmClean listings and cmFix/volFix; main keeps the xp/sat kinds, mpSanitize, ip4Fix and satSanitize.
src/game/80-simulation/60-requirements.js: upstream's shared diversity graph; an express link carries the list of trenches it rides.
src/game/91-save.js: upstream's saves in the worker, except a multiplayer session network, whose text is made on the page (mpSave) so the server gets the very save the slot holds; bootNotes() kept.
src/game/91-slots.js: upstream's slot text and day, with main's mp badge on a slot.
src/game/93-ui/70-link-panels.js: a fiber says both its managed waves and the expresses it carries.
src/game/94-dashboard/60-dashboard.js: upstream's carried tile, main's themed demand line.
src/game/95-modals/70-link-modal.js: main's Express tab, then upstream's hint for a coast no cable lands on (#321).

After the merge:
- Moving a circuit: a path over an express shares the trenches of the fibers it rides, so it is never called fully diverse from a path along them (test in express-fiber).
- The capacity market and moving customers leave the slots expresses hold (test in express-fiber; no code change needed).
- The NOC log keeps only the kinds a reload keeps: the market's info/warn news is a plain line, live as after a reload.
- New acts classified for server-run play: market and path moves sent, marketOpen and pathOpen local; pathPin's path may be longer than 64 characters.
- Server-play fixtures written again (new cm and vol fields); the dark-mode test reads mapStill()'s three states.
- A big multiplayer network that moved on still pushes its save to the server (test in multiplayer).
- The full suite ran on jsdom 31.0.0 and playwright-core 1.65.0, the versions the merged lockfile pins.
2026-11-09 19:04:21 +01:00
Frederic Jung
1579f3743b
Merge pull request #311 from thesysadmindev/move-customer-path 2026-11-09 13:15:55 +00:00
Frederic Jung
249ad4d478
Merge pull request #320 from antt0n/perf/routing-core 2026-11-09 10:21:20 +00:00
Christopher Hawker
93d7c87dc7 Move a customer to another path between the same two POPs
Alien waves and leased fiber pairs sit on one fiber (b.link), so they move to
another working fiber between the same cities, under the rules for selling
capacity on it. Circuits have no link of their own, so moving one pins it to a
list of cities (b.pin), which routing follows while every link on it is up. When
one is down the circuit follows routing, and it comes back by itself.

The window lists the most diverse options first, compared by trench. Moves are
free and instant, and contracts keep their price.
2026-11-09 16:23:59 +11:00
Frederic Jung
4292cd4c74
Merge pull request #319 from antt0n/perf/intern-and-promises 2026-11-08 11:00:54 +00:00
Antoine
44116103be
The intern and customers' promises counted once per network: ports, caches and PNIs in one pass, shared searches
The game plays exactly as before.

* The NOC intern plans every POP in one pass: portsAt() counts router ports for all cities at once (routers, ports
  and cache orders; the ports job keeps ports in use and reserved by city between two jobs), cachePlan() sorts the
  boxes by POP once and cityShSum() sums a city's shares once per table, pniFlows() reads every POP's flows from
  routing's columns (R.flc) in one pass and pniWant() gives the weekly PNI round its sort key from typed columns.
  pniBatchRun() lets a frame through every few networks; pniQuote() looks existing PNIs and ports up from the batch.
* A dark fiber's capacity asks optG() once per run of identical optics (dfLit()); linkDown() and ownGlass() ask
  dfOn(), whether it carries anything for you, without the sum unless an optic is out or managed waves are sold on
  it. terrIslands() tests !l.sub first.
* Latency: latGraph() lists each city's links once in S.links order (typed arrays), latRun() is the same search with
  the same sums, latPairs() searches once per city for a boutique's finance routes and the latency offers.
* Diverse paths: divGraph()/divOn() number the cities and risks once; promiseCheck() shares a diversity graph, the
  land islands and one latency search per origin across every customer when the intern weighs taking a fiber out,
  and spots0() shares the graph for sovereign offers.

Tests: day-steps (cache planner, ports at every POP and flows from columns equal the old ways; the PNI round through
pniBatchRun), fiber-lit-and-latency (with failed optics and managed waves), shared-promise-checks, intern-personas.
2026-11-07 23:55:37 +01:00
Antoine
1edf0abb54
Routing core made once, list orders kept, and Auto-TE's detour searches cut: same routing, much less work
The game plays exactly as before.

* The core of compute() (rankPass, directPass, sendGroup, send, push, carry, altPath) is ROUTE in 29-route-core.js,
  built once by routeCore(): made inside compute() they were new functions every call and V8 threw away their code.
  Exits are read by number from typed columns (USED, CAPX, CIX, HPX, VISX), each list is an object of one shape.
* The route cache keeps, for each list and source city, the order routing tries it (xOrder()); a list whose exits,
  cities and preferences are unchanged on the same graph keeps its orders when other exits change (rcExitKeep()).
* Auto-TE: pairs with no detour are marked (TEF), exits that cannot help are skipped (dud()), one failed search
  answers the next ones, dijkstraTo() searches in arrays kept between calls, teSearch() runs on the graph as flat
  arrays and picks up where the last search from the same POP stopped.
* The PNI/IX tie-break (#298) reaches the core.

Tests: route-cache, routing-reference, speed (the fast core against the plain path, Auto-TE on crowded meshes with
POPs outside the core, picked-up searches counted).
2026-11-07 23:51:35 +01:00
Antoine
b9d6319302
The page stays free while big networks play: ambient map at 30 fps, saves in the worker, less to carry back
The game plays exactly as before; only what holds the page changes.

* mapStill() tells three cases apart: still (drawn once a second), ambient (only the animation clock moved: drawn at
  most every 29 ms, so 30 fps on 60 and 120 Hz screens) and moving (camera, pointer, selection, network: every frame).
  The animations follow the clock, so they keep their speed.
* save() skips the storage write when the text is the one the slot already holds (SLOT.txt) and no write is on its
  way; leaving the page still writes. A big autosave that moved on is packed, turned into text, stamped and
  compressed in the route worker (rwSave(), rwGzip()); the page only writes what comes back. A lost worker hands its
  pending saves back to the page (rwSaveBack(), rwGzBack()).
* Less crosses back from the worker: R.efg stays there while R is its own last answer (RW.wR, efg 0), R.egDesc comes
  as 0 or as the entries that changed (rwDescOut()/rwDescIn()), what crossed each link travels as typed arrays decoded
  on demand (rwLOut()/rwLIn()), and the full ports (hotMap) come along with R. Every message is read in order
  (rwMsg()), so both sides always hold the same last answer.
* Idle frames build the diverse-paths map and the latency floors a millisecond at a time (diversityWarm(),
  latWarm()), before the first offer asks.
* Diagnostic info shows how fast days really come: speed asked, speed held, how long a day takes (15-day-pace.js).
* perf-bench: "The NOC intern's shift: opsDay()" and, in Chromium, "One game day in play: page time only", a day
  played with the real route worker counting only the time it holds the page.

Tests: frame-pacing, day-pace, save-size, persist, route-worker (efg as typed arrays, hotMap from the worker),
day-steps (a second page plays the worker: answers without R.egDesc, with only its changes, posts without R.efg,
renewal haggles answered through the worker), intern-dark-fiber-worker, webgl-zoom-sprites, speed.
2026-11-07 22:22:51 +01:00
jvanvik
4b922aba02 Merge upstream: sharded test runs, auto-release follows CI (3.1.0)
Some checks failed
CI / plan (push) Waiting to run
CI / part (push) Blocked by required conditions
CI / build (push) Waiting to run
CI / translations (push) Waiting to run
CI / test (push) Blocked by required conditions
CI / timings (push) Blocked by required conditions
Container image / test (push) Has been cancelled
Container image / publish (push) Has been cancelled
The fork's Unreleased bullets stay above upstream's 3.1.0 section. The dark
mode test reads the theme script from the page's HTML, since the harness
now runs script bodies outside the DOM.
2026-11-07 10:29:33 +01:00
jvanvik
d1e127da67 Server-run play, part 1: game prerequisites and shared contracts
Groundwork for running multiplayer games on the session server; nothing
of it is switched on yet, and the plain build is unchanged.

- A new network in two halves (beginState/beginShow), the coach split into
  tutAdvance/coachDom, toastPop split out of toast, bootNotes() for the
  once-per-load toasts, the five text actions take their text as an
  argument, and srvOn() with its two checks in the loop.
- Live state is what a reload makes of it (migrate() is a no-op on it):
  new POPs, ports, PNIs, customers, attacks, dark fiber and the intern's
  notes are written in their saved shape; a 365-day test proves it.
- pniAll and bstdApply check the quote the sheet showed (bstdApply by its
  plan, within 1% for the daily hardware drift; utilityKit too).
- assemble({mp}) leaves src/game/98-server-play/ and its CSS out of every
  page but a multiplayer build's, which also gets a SIM_ID build id.
- Contracts for the server, protocol and browser parts: the action tables
  and envelope check (scripts/lib/mp-sim-acts.js), event fixtures, a shape
  checker, a fake engine, and load({mp:true}) in the test harness.
- route-fuzz judges both pages with one migrate(), so reload repairs of
  the base no longer count as divergences.
2026-11-07 10:26:06 +01:00
Frederic Jung
03523cb16b
Auto-release follows CI instead of testing the release again
A version bump on main ran the whole suite twice: once in CI for the
push, once more in auto-release. Auto-release now starts when CI
finishes on main and releases only if that run was green, tagging the
exact commit CI tested. Started by hand, it still tests first, since
there is no CI result to go by.
2026-11-07 10:00:15 +01:00
Frederic Jung
0342d90657
Faster tests, split everywhere: one sharded CI for pushes and releases
- The harness builds the DOM without the page's 2 MB of script text and
  runs the scripts straight in the window: a page load in tests takes
  about half the time (jsdom's parser was slow on the script text).
- That also took the game's source out of the DOM, which showed three
  tests that matched a phrase in the page source rather than the screen;
  they now check the panel, the routing window and the dictionary.
- CI plans its split once and runs the tests on 6 runners; every run on
  main records each file's time and caches it, so the parts stay even
  without anyone refreshing tests/durations.json.
- auto-release.yml and release.yml call the same sharded tests instead
  of running all 170 files on one runner each (11 and 15 min); a release
  is tested once, before it is tagged.
- Audit: five tests that duplicated a gameplay rule or checked nothing
  are gone; the two slowest checks sample a third of the cities, and a
  year of play to reach one due date became a moved due date.
2026-11-07 07:24:09 +01:00
jvanvik
032470f486 Merge upstream: route worker for every routing, intern specialisations, sales renewals, French cities
Some checks are pending
CI / test 1/4 (push) Waiting to run
CI / test 2/4 (push) Waiting to run
CI / test 3/4 (push) Waiting to run
CI / test 4/4 (push) Waiting to run
CI / build (push) Waiting to run
CI / test (push) Blocked by required conditions
CI / translations (push) Waiting to run
# Conflicts:
#	CHANGELOG.md
#	src/game/60-features/39-sales-auto.js
#	src/game/60-features/95-standing-orders.js
#	src/game/85-incidents/40-chaos-monkey.js
#	src/game/88-days/10-day-tick.js
#	tests/gameplay-rules.test.js
#	tests/i18n.test.js
2026-11-07 05:26:28 +01:00
jvanvik
2cd6b71198 Dark mode: Light, Dark or Auto under Settings › Theme (#80)
A device preference (localStorage sot-theme, never in the save), applied
by a small script in <head> before the first paint, so there is no flash;
Auto follows prefers-color-scheme live, and a choice reaches other tabs
and the NOC window. Panels, HUD, drawers, toasts, modals, the phone tab
bar, charts, puzzles, the architect and Pie Control take their colours
from custom properties with night values (AA text contrast); light tints
keep their old colour as the fallback, so the light look is unchanged.

Both map renderers read a light and a dark palette (96-map/15-palette.js):
sea, land, clouds, coastlines, labels and the tube outline. A theme
switch repaints the cached layers once (the WebGL land buffers are
rebuilt once); nothing changes per frame. The multiplayer leaderboard's
own row and the menu rank badge follow the theme too.
2026-11-07 01:01:50 +01:00
Frederic Jung
52e740cdae
A slow phone gives a day longer slices between frames
A device that cannot hold 50 frames a second waited a whole slow frame at almost every rest of a big day, so the
game played up to a third slower at 8x. There a day gets half of its own frame, up to 32 ms; screens that keep up
keep 3 to 8 ms.
2026-11-06 22:48:52 +01:00
Frederic Jung
410eb81544
Merge pull request #313: every routing a day needs runs in the route worker, and a long day lets frames through
Conflicts with main resolved: the intern's chosen router model, optical upgrades and personas are generators like the
other orders, with a rest after each job. The optical upgrade's fiber test is a step the day answers, in the route
worker in play (opsDark(), {dark}), like the sales desk's trial; the renewal desk's reroute is a step too (slRenRun()).
2026-11-06 22:47:54 +01:00
Frederic Jung
74e8611f8e
The sales desk answers renewal haggles, each salesperson their way
With the new switch at the sales desk, whoever runs sales answers a
renewal haggle three days after it opens, unless the player did first.
The engineer gives business customers their discount and keeps nerdy
ones at the market price (nobody leaves); the shark holds the old price,
often with a fresh promise, bills a month of the saving, and loses some
(nerds most); the CEO gives 10% more off for a double term, says yes, or
picks a fight. Every answer is a hash of the contract. The switch is
stored only when on, so existing saves are unchanged.
2026-11-06 20:56:50 +01:00
Antoine
3c45d7dca1
A day that reroutes no longer stops the page at x8: every routing it needs goes to the route worker
The day split of #312 on its own, from 3.0.0, without its routing core, save or map changes. On a big network at
x8 the game stopped whenever a day rerouted: after a failure, an event, the NOC intern's shift or the sales desk's
signing, dayPost() routed on the page.

* The day is a generator (dayRun(), dayPreRun(), dayPost()): each yield is a compute() it needs. dayTick() answers
  them on the spot (tests, fallback); in play rwGo() posts each one to the route worker. A failure (failureRun()), a
  DDoS and Auto-RTBH (ddosNewsRun()), the chaos monkey's snip (mkSnipRun()), an event's cut (eventRun()), the
  intern's shift (opsRun()) and the sales desk (slAutoRun(), its trials answered by the worker with offerTrial())
  are steps of the day. fireFailure(), opsDay() and slAutoDay() still play them in one go.
* yield DAY_REST lets a long day draw a frame between two steps (half a frame, 3 to 8 ms, RW.budget). One day in
  flight at a time, resting or routing: the clock waits for the day, and a half day is never saved.
* UI.tick is set around every step (dayStep()), so quiet notifications hold in play, not only in dayTick().
* The daily mood check works out the land islands once per pass over the customers (TERR), instead of walking
  every land link for each customer afraid of sharks. This fix is thesysadmindev's, from #310; here the islands are
  worked out again if something routed meanwhile (RW.gen), since the mood loop can now rest between customers.

Same game either way: tests/day-steps.test.js plays a second page as the worker and compares each day with
dayTick(), the intern on every order, failures, events, DDoS and the monkey forced.

Thanks to thesysadmindev for the profiling in #310 that pointed at the reroutes, and for the sharks fix.
2026-11-06 14:24:18 +01:00
Frederic Jung
9a5522bbb1
Deals belong to Sales: the intern sticks to the network, the sales desk signs deals for you, orbit ones too
The NOC intern loses the sales order. Saves that had it load cleanly: sanitize drops the order, its log lines and its
weekly tally, and an intern who was running it hands its switch and minimum to the sales desk (S.slAuto).

With someone at the sales desk, the player can let them sign offers once a game day and decline the ones under a
minimum (39-sales-auto.js), each in their own style: the engineer and the CEO sign after the #185 routing trial (one a
day, a misfit waits a week), the shark signs every offer whose POPs are up, promises and commission included, and the
CEO's declines are a handshake away. Orbit offers need room on their landing dish instead of a trial. Nobody at the
desk (the default; the CEO is a choice, not a given): every deal is signed by hand. The sales desk runs before the
intern's shift, so a deal signed today is in the loads the intern works from. The sheet shows the switch, the minimum
and this week's and last week's tally; the NOC gets one notice a week.

Orbit offers go through the desk too (99-pie-sales.js): they carry o.by, so commission, renewal haggles and each
one's mark at renewal apply. The engineer only offers where the landing dish has 1.5x room on a well-served POP, and
those customers renew like the nerds (0.5x leave). The shark rings airlines, cruise lines and the Mars mission first,
at the biggest size that fits and 25% more, and half of them get a full-sky promise (REQS.skyfull: a crust at 90%)
before there is one; they grumble down to 40 happiness and never cancel over the promise alone. The CEO plays every
other golf game with the Founder: the biggest orbit deal that fits, Mars first, at 30% off; jitters cut his orbit
prices by 0.4x the jitters and from 0.6 the Founder skips golf. Without a salesperson orbit offers are drawn exactly
as before (the O7 balance save has nobody at the desk: payback unchanged, 7.0 years on seed 7, 7.5 on seed 11).

Also: the scenario reference plays 'sales' as the CEO signing for you; the route fuzz leaves out the state and
buttons of a standing order only main still has; the intern's on/off dials (paid peering, keep a spare) show their
translated value in the shipped page instead of the raw label.
2026-11-06 09:58:01 +01:00
Frederic Jung
f303f29f22
PNIs and IX ports are both peering: traffic leaves at the nearest one (#298)
Routing tried every PNI (rank 1) before any IX port (rank 2), like a
local-pref above peering, so a PNI in London pulled New York's traffic
across the Atlantic even with the same network at the New York IX. PNIs
now route at rank 2 with the IX ports, nearest first. At the same distance
the PNI goes first: an IX port counts as PNI_TIE (0.001) further away,
far below any link weight (at least 1). Distances compare as
(Da-Db)+(dta-dtb) so exits at one distance stay exactly equal, and the
POP-local shortcut skips lists that mix PNIs and IX ports. Backup only and
RouteScript's prefer pni keep their say. The traceroute, the reference
allocation in the tests and the RouteScript help follow.
2026-11-06 06:31:21 +00:00
thesysadmindev
e62e4c7c98
Merge branch 'main' into unbuilt-pops 2026-11-05 21:01:24 +11:00
Frederic Jung
13768c61cb
Merge #281: draw the map with WebGL2 by default, 2D as fallback 2026-11-05 10:13:28 +01:00
Frederic Jung
27c4977412
A sales desk: the engineer turned salesdroid, the shark, or the CEO
From customer level 2, one person runs sales at a time, next to the NOC intern:
- The engineer turned salesdroid ($9k/mo) books you into every network operators' meeting 30 days
  ahead at the usual ticket price, brings 40% more offers (half as many again while a meeting's glow
  lasts) but never the huge deals, and their customers leave less often at renewal (half as often
  for the nerdy ones: HFT, ISPs, universities, L2). Haggles badly.
- The shark ($15k/mo) brings bigger sizes at 25% more, takes a month of each deal as commission,
  oversells half of them with a requirement the network does not meet yet, never brings technical
  customers, makes selective peering desks want 25% more traffic, wins most haggles, and their
  customers leave 50% more often.
- The CEO (free) signs the biggest internet customer the network can take on the golf course every
  50-80 days at 30% off, often with a promise nobody checked, signs about a third of the offers you
  decline anyway, and has opinions. He cannot be fired: a board meeting brings a VP of Sales a month
  later.
Customers remember who signed them (by), which the renewals read. Every roll is a hash of the day
or the deal, so games without a salesperson keep their random stream.

The differential fuzz also leaves out buttons for actions main does not have yet.
2026-11-05 09:32:24 +01:00
Christopher Hawker
5259e93034 Merge remote-tracking branch 'upstream/main' into unbuilt-pops
# Conflicts:
#	CHANGELOG.md
2026-11-05 18:27:21 +11:00
Christopher Hawker
0cdbef97fe A dashboard tab listing the cities with no POP yet
The dashboard shows what you have built, not what you haven't. The new tab lists every city you could still open, with its eyeballs, exchange and price, and sorts, filters by region and pages like the other long lists. Open selects the city on the map, so a build still goes through the city panel and its warnings. The tab also works in the NOC window.
2026-11-05 18:26:44 +11:00
Frederic Jung
8841fdacb9
Customers come and go: contracts, renewals at the market price, growth, haggles and leaving (#178)
Every customer now signs for a term (enterprise and hosting 1-3 years, wholesale and circuits 2-5,
fiber pairs 10-20). When it ends most renew at today's bandwidth price, happy ones often grow to
the next size, a few with competitors around ask for a discount 30 days ahead (match, meet halfway
or let go in Deals; no answer matches), and some leave: unhappy ones because of the service, others
acquired, bust, insourced, moved (they stay if you have a POP there), multihomed, project ended,
a cheaper bid, or now and then one of the odder reasons (never more than one every 60 days).

The bandwidth market is flat for six months, then about 10% cheaper a year, slowed by dearer
hardware, moving in a slow three-year cycle and pushed up during a shortage. New offers and
renewals are priced in it; one renewal moves a price at most 25% down or 10% up.

Nothing happens in a first term. Rolls are hashes of the customer and its term, never Math.random,
so seeded games keep their stream. Old saves get renewals spread over the next year. Happy
customers of a year or more send a referral about every six weeks. The dashboard's Customers tab
shows customers won and lost each month and why, renewals due and the market; customer rows show
the contract end.

The differential fuzz now leaves out state fields only this checkout has, so a new feature's state
does not fail the comparison with main while everything both games share must still match.
2026-11-05 08:15:53 +01:00
Antoine
cf9ab5e774
Draw the map with WebGL2 by default, with the 2D canvas as fallback
- Sea, land, waves, clouds, cables, tubes and packets are drawn by the
  graphics card; the land is geometry built once, so panning and zooming
  repaint nothing.
- Cities, labels and markers are painted once into a sprite atlas and drawn
  in one call (with drawImage in 2D, which speeds up the 2D map too).
- Settings > Map drawing: Auto or Always 2D, per device. Browsers without
  WebGL2, a lost context and puzzles keep the 2D map.
- npm run bench:gpu compares 2D and WebGL in a real browser on a real GPU;
  ?fps shows a frame meter.
2026-11-04 22:37:12 +01:00
Christopher Hawker
f9d24699c1 Merge remote-tracking branch 'upstream/main' into noc-window
# Conflicts:
#	CHANGELOG.md
#	src/game/99-loop.js
#	tests/harness.js
2026-11-04 20:01:57 +11:00
Christopher Hawker
80f671953a A NOC screen in its own window, for a second display
A button next to the speed controls opens this page at ?noc=<slot> in a
noopener pop-up, so it runs on its own thread. The window never claims the
slot, saves or runs a day. The game sends it a copy of S and R over a
BroadcastChannel, at most once a second and only while a window is connected,
and runs its clicks through an allowlist of the same ACT.* a click uses.

The window opens on a dark wallboard: a live world map of links and POPs,
traffic and money graphs, alarms, and the hottest ports with the dashboard's
own upgrade buttons (connUp). Clicking a POP filters the ports. Details shows
the full dashboard. Phones do not show the button.
2026-11-04 20:01:37 +11:00
Wolfgang Nagele
7438fd1065 Agent mode: an AI agent plays in the player's own tab, with the agent's clock or a running one
The MCP server gains a second session, --browser: the game in the player's tab, reached through the
agent relay npm run dev hosts at /agent (loopback unless --host; Host and Origin checked, no token).
The player turns it on in Settings → Agent API, a section only the development page has, and picks the
clock: a pace of 30 s to 5 min a day that nobody can pause, or the agent's own. Headless gets the
running clock too (--clock realtime --pace MS) and both get a wait tool.

All of it lives in src/agent/ (development page only). The game offers HOOKS, UI.clockLocked,
setSpeed() and runClock(dt), the frame's day block moved out unchanged, and nothing more: the page
players get grows by under 1 KB gzipped and runs exactly as before.
2026-11-03 16:18:43 -05:00
Wolfgang Nagele
2526dd458d MCP server on the official SDK, over stdio or HTTP
scripts/mcp.js registers the same tools on @modelcontextprotocol/server (2.4.0, with
@modelcontextprotocol/node 2.1.2 for node:http; dev dependencies, pinned) instead of its own JSON-RPC
loop. stdio works as before; --http [HOST:]PORT serves Streamable HTTP at /mcp, on loopback unless
told otherwise.

Over HTTP every request's Host must be an address of this machine (or --allow-host), an Origin other
than localhost is refused, and a bearer token (SOT_MCP_TOKEN or --token-file) is optional; bound
beyond loopback without one, the server warns. load_save and export_save take JSON only there, or files
under --save-dir and nowhere else. Calls from every client run one at a time, in order.
2026-11-03 16:18:38 -05:00
Wolfgang Nagele
5b76685e5c MCP: the agent facade moves into src/agent/, assembled into the development page only
The command tables and the page-side reads, screens and dispatch (scripts/lib/mcp-commands.js and
mcp-page.js) become src/agent/, the facade window.TUBES.call(tool, args) in the page's own scope.
A new <!-- @include-dev agent --> line in src/index.html pastes it in after the game, but only in the
development page (npm run dev, the MCP server, i18n-check, tests that ask with load({agent:true})).
The build drops the line whole: _site/ is byte for byte what main builds.

Tests load the page players get by default, the build test fails if anything outside src/agent/ names
the facade's api/API_ names, and the pages test checks the built page carries none of it and still
plays. ADR 0004 records the rule.
2026-11-03 16:18:38 -05:00
Wolfgang Nagele
a72cb7d760 MCP server: typed, checked actions with outcomes and dry-run prices; schema, catalog, state, results and ui tools 2026-11-02 21:10:35 -05:00
Frederic Jung
640b65ce9a
Differential random games: main's page and this checkout's play the same seeded game move for move
scripts/route-fuzz.js plays many random games (every mode: presets, sandbox, scenarios,
the weekly, puzzles, architect runs, or a save) on two pages in one process and compares
all of R, R.fl, R.ef, the PNI lists and S after every move and every day, and routing with
the kept tables against routing without them. tests/route-fuzz.test.js plays four.
2026-11-01 21:44:30 +01:00
Frederic Jung
8b0c624b21
Merge remote-tracking branch 'origin/main' into perf/6-routing-design 2026-11-01 19:42:12 +01:00
Frederic Jung
37def9dd6b
The game as a local MCP server: play, inspect and debug it from an AI client
scripts/mcp.js speaks MCP over stdio and loads the game from src/ in jsdom,
seeded, like the tests. Tools: new_game, load_save, export_save, status,
advance (with per-day timings), network, city, find, traceroute,
peering_check, hot_spots, actions, act, screen, panel, click, open_link.
Actions go through ACT as buttons do; files, slots, settings and the clock
stay out of reach, and nothing evaluates code in the page. Nothing is
hosted and the page is unchanged. See docs/MCP.md.
2026-11-01 18:04:22 +00:00
Frederic Jung
2122db8cc4
Architecture notes on the kept routing tables and compute()'s small functions; CHANGELOG 2026-11-01 19:04:18 +01:00
Frederic Jung
18db953818
Merge remote-tracking branch 'origin/main' into perf/3-worker
# Conflicts:
#	src/game/80-simulation/30-compute.js
2026-11-01 16:14:07 +01:00
Frederic Jung
96e2c2f537
Cable ships: club repair ships sail out to subsea cuts, private charters jump the queue, lay ships build your cables
A subsea cut sends the nearest free ship of its region's maintenance club from its port, along the cable routes at about 500 km a day; the cut lasts while it sails, waits for permits in slow countries and splices (3-5 days shallow, 6-12 deep). Ships stay busy until home (S.fleet). With the club's ships all out the cut waits; a private charter of the quickest free ship costs $1M + $200/km sailed. Own subsea builds show survey/factory, then a lay ship at 150 km/day; a second lay ship can be booked before laying ($3M + $150k/day saved), and crews no longer speed up cables at sea. Ships are drawn on the map and can be tapped.
2026-11-01 11:24:53 +00:00
Christopher Hawker
eb78d7104e Prefer keeps the say at its own POP only, and the direct ranks stop slowing the game day
Review of #205:

- Prefer no longer switches the carrier-direct rule off for the whole network.
  A POP with a Prefer-marked transit port keeps what Prefer says; every other
  POP keeps the rule. compute(), traceroute and the reference loop in the tests
  all use the same per-POP rule, and a new test covers it (New York and Chicago,
  Prefer on one POP's Tell-Ya port).
- dayTick() cost. The harness is neutral (the same page on both sides differs by
  1%), but the cost was real: the four extra rank passes inside compute()'s main
  loop made V8 deoptimise compute() 954 times in 30 game days against 46 on main.
  The direct ranks now run in a small function of their own, in the plain way the
  reference loop does (their lists are one carrier's ports), so the main loop is
  the one main has, and the setup moved out of compute(). 61 deopts instead of 954.
- Italian: "Porta qui" read as "port here" next to "Porta più vicina"; it is
  "Instrada qui" now, and "Ogni POP instrada il traffico..." matches.
- Help text: says that real BGP carries the traffic from every POP (the shorter
  AS path beats IGP distance), that Carry here does that here, and that Nearest
  port is the default. All six languages.
2026-11-01 20:07:23 +11:00
Christopher Hawker
9dc8aac45a Merge remote-tracking branch 'upstream/main' into own-carrier-egress
# Conflicts:
#	CHANGELOG.md
#	src/game/80-simulation/30-compute.js
#	tests/game.test.js
2026-10-31 23:57:19 +11:00
Frederic Jung
72fb233af7
DDoS rework (#242): world-sized floods on customers, spread over every port, RTBH per target, Flowspec rule budgets, magnet scrubbing, new NOC card
Work in progress: the full test suite is still being brought in line.
2026-10-31 12:20:14 +01:00
thesysadmindev
296de1d946
Merge branch 'main' into own-carrier-egress 2026-10-31 22:16:55 +11:00
Frederic Jung
92536606dd
Tests, CHANGELOG and docs for the peering desk 2026-10-29 21:41:28 +01:00
Frederic Jung
0ece48a79d
Ship weekly scenarios with the weekly puzzle run; docs and skills 2026-10-29 17:34:38 +01:00
Christopher Hawker
ac5928d41d A carrier's own transit port takes its traffic, with a Carry here switch for other POPs
Transit ports at a POP shared load by free capacity whatever the traffic
was for, so Level Tree's own traffic went out of a Tell-Ya port about
half the time. Traffic bound for a carrier, or for a network that buys
transit from it, now goes out of that carrier's port at the same POP
first (the shorter AS path). Each such port is still an ordinary transit
exit, so POPs without one use it when nothing nearer has room.

A new switch on each transit port, Carry here, pulls that traffic from
every POP across your network to this port. The default, Nearest port,
keeps using the closest transit port from POPs that have no port of the
carrier. The switch only shows when another carrier's port could take
the traffic instead.

Prefer-marked ports, Backup only, RouteScript and Auto-TE keep their say,
and any Prefer-marked transit port switches the rule off. Traceroute
follows the same rule and says why it picked an exit. The setting is
repaired in sanitize(); old saves load with it off.

The routing reference test now has several carriers sharing POPs, ports
that carry, backup ports and RouteScript, and its reference loop knows
the new ranks.
2026-10-29 21:16:21 +11:00
Frederic Jung
0ad1ef6435
Changelog and architecture notes: puzzles with traffic 2026-10-29 10:51:00 +01:00
Frederic Jung
5f412f72d8
Merge v2 into v2-saves 2026-10-29 07:32:19 +01:00
Frederic Jung
94488bf8f7
Save slots: CHANGELOG and architecture notes 2026-10-29 07:05:48 +01:00
Frederic Jung
13376ceb97
Merge the weekly puzzle generator into v2 2026-10-29 07:01:34 +01:00