Early-level build discount (B4) and start stock 1000 (B5)

Playtest on the live world: first hour feels a bit slow. B4: levels 1-3 of any building take x0.5/x0.67/x0.83 of the time (FORMULAS.earlyLevels/earlyTimeFactor, off at earlyLevels 0). Builds at 1 h (4 sittings/day) 8.9 -> 11.4, at 24 h 16.5 -> 20.4; mid game moves ~1 day head start (default mix), more for 2 sittings/day. B5: start stock 750 -> 1000 (measured separately: mid game unchanged, 60-min first sitting 12.1 -> 15.4 builds at 1 h). Numbers in docs/BALANCE.md.

Tested: npm test 208/208, openapi check, npm run e2e 61/61 (before B5), 50x30-day bot run INVARIANTS OK after B5. NOT tested: humans (bots only, 2 seeds), B4+B5 combined beyond one run, e2e does not exercise the discount (runs at 4000x speed). Not claimed: balanced.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q2MJaQ5LXAHzGnTDgceT14
This commit is contained in:
jvanvik 2026-10-11 22:38:37 +02:00
parent cc0524de5e
commit bf7af0679c
10 changed files with 194 additions and 12 deletions

View file

@ -8,21 +8,21 @@ WebSocket push); stage 7 is partly done (bot harness + first balance pass, admin
playtested by humans, and has never run on the real target (Debian LXC + systemd + nginx Proxy Manager).**
Runnable and checked just now:
- `npm test`: 207 tests pass in about 7 s (rules as pure functions, commands/events/scheduler with a fake clock, REST over HTTP with every
- `npm test`: 208 tests pass in about 7 s (rules as pure functions, commands/events/scheduler with a fake clock, REST over HTTP with every
response checked against its schema, push with a real `ws` client, client logic, bot harness, admin CLI). `npm run openapi` leaves
`docs/openapi.json` unchanged (it is in sync with the route table: 68 paths).
- `node tools/bot.js --players 50 --days 14 --speed 1`: about 3 s, `INVARIANTS OK`. `node tools/admin.js help` works.
- The deploy path from DEPLOY.md in a scratch directory, without systemd: first boot (migrations, world), `/healthz`, signup, a build,
`admin.js` status/worlds/users/inspect/events/replay/backup/verify-backup/ban/grant, SIGTERM + restart (state kept), SIGKILL + restart
after a build fell due (caught up in order), restore of a snapshot into a fresh `DB_PATH`.
- `npm run e2e` (`e2e/run.js`, Playwright): see the e2e section of this file, if present; not re-run for this status.
- `npm run e2e` (`e2e/run.js`, Playwright): 61 checks pass (re-run after B4, 54 s).
Never run: real devices, Safari/iOS, a Proxmox LXC, a unit under systemd, the backup timer firing, nginx Proxy Manager (WebSocket upgrade,
idle timeouts, real client IPs), Let's Encrypt, a restore on the real box, load with many real sockets, any human player. Node 22.13 (the
stated minimum) was not run, only 24.21.
Known gaps, consolidated (the sections below have the detail and the reasoning):
- **Balance:** nothing is tuned beyond B1/B2 (BALANCE.md). Open: a 3x world's end game is as long as a 1x world's; after the opening days
- **Balance:** the first hour of a player who plays it all is limited by the 750 starting stock (about 12 builds), not by build time; a bigger stock was measured and not adopted (B4). nothing is tuned beyond B1, B2 and the B4 early-level build discount (BALANCE.md). Open: a 3x world's end game is as long as a 1x world's; after the opening days
nobody can contest a built-up landing site (no garrisons, E1); raid loot is split evenly and destroyed on overflow (S4); trade escrow
refunds are clipped at the Rack hall cap without a notice (S2); the capital runs out of things to build long before the backbone opens;
the bots are not humans.
@ -222,7 +222,7 @@ one tick are merged. Small edits outside the new files: `scheduler.js` (outbox,
Tests: `test/push-ws.test.js` (auth ok/bad/timeout, origin, path, per-IP cap and its release, rate limit, bad budget, oversize frame, dead
socket, revoked token, banned user, shutdown, REST with no socket) and `test/push-game.test.js` (build/train done, incoming only to the
defender, report/message/alliance invite hints, recall, coalescing, rollback). Real `ws` client, fake clock, port 0. `npm test`: 113 pass
when this was written (207 on 2026-10-11, whole suite).
when this was written (208 on 2026-10-11, whole suite).
Not done / not claimed:
- The client now exists (`public/js/ws.js`, see "Client: military, expansion, WebSocket") and was run against this server in a headless browser; not through a proxy.
- Revocation closes the socket at the next ping tick (default 30 s), not instantly: `POST /auth/logout` and token deletion do not call push.
@ -286,5 +286,5 @@ Not done / not claimed: nothing of it has run under systemd or on Debian 13 (DEP
world lifecycle through the CLI is partial (above); no scheduled "create next world".
## Not done
- Stage 7 remainder: balance passes beyond B1/B2 with the open items above, a real world lifecycle (start, natural end, reset) driven from the CLI,
- Stage 7 remainder: balance passes beyond B1, B2 and B4 with the open items above, a real world lifecycle (start, natural end, reset) driven from the CLI,
load test over HTTP/WebSocket, the full e2e suite and a human playtest. Everything else in CLAUDE.md "Working in stages" is built.