Phase 3: trade/end-game client, bot simulator, first balance pass
Built: - Client: trade screen, world/end-game screen (landing sites, shipping, node build, final ranking), report sharing + alliance reports tab, alert describers for all notification types, error-code strings (en+nb) for every server CODE. - tools/bot.js (+ tools/bot/): 50 headless bots against the real server in-process with a fake clock; resource/unit conservation ledger, exit 1 on broken invariants. docs/BALANCE.md has method and every run behind a number. - Balance changes (evidence in docs/BALANCE.md): secondQueueCoreLevel 10 -> 3, TRANSPORT.capacityPerLink 500 -> 1000 (end game was shipping-limited in bot runs). - Server fixes: POST /reports/:id/share 500 without a pending reportCleanup; bounced link shipments were silent about cargo overflow. Tested: npm test 207/207 (new: bot determinism + invariants, client alerts/world/i18n over CODES, two regression tests that failed before their fix); openapi check up to date. Real-browser scratch runs (not in repo): WebSocket push shows an incoming-attack banner ~214 ms after launch, polling fallback ~52 s, 15 scripted flows, 71 screenshots. NOT tested: Playwright suite (e2e/ still empty), real devices/Safari, nginx proxy websockets, throttled networks, HTTP-level bot load. NOT claimed: balance. Bots are not humans; open balance items (loot waste, escrow refund clipping, no garrisons at landing sites, end game not scaling with world speed) are listed in docs/BALANCE.md. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q2MJaQ5LXAHzGnTDgceT14
This commit is contained in:
parent
d84b0c9d12
commit
931f59e11e
49 changed files with 4750 additions and 59 deletions
|
|
@ -98,7 +98,7 @@ notifications (`incoming`, `report`, `train_done`, `research_done`, `movement_re
|
|||
| ----- | ------- |
|
||||
| `POST /towns/:id/train {unit, count}` | queue a batch (201). Batches of one training building (NOC / Ops lab / Rollout depot) run in order, buildings in parallel; queue limit 8 per building (`queue_full`) |
|
||||
| `POST /towns/:id/research {unit, stat}` | +5% `attack` or `defence` per level for one unit type, one research at a time per POP, level n needs a Research lab of level n + 2 |
|
||||
| `POST /movements {fromTownId, type, toTownId \| x,y, units, ...}` | send `scan`, `raid`, `attack`, `takeover`, `reinforce`, `settle` (201). `type: transport` carries `cargo: {fiber, hardware, capital}` (Internet exchange: level = concurrent transports, 500 each). Extra fields: `target` (building for exploit kits), `wild` (two field types for a new POP), `confirmEndProtection` |
|
||||
| `POST /movements {fromTownId, type, toTownId \| x,y, units, ...}` | send `scan`, `raid`, `attack`, `takeover`, `reinforce`, `settle` (201). `type: transport` carries `cargo: {fiber, hardware, capital}` (Internet exchange: level = concurrent transports, 1000 each, `D.TRANSPORT.capacityPerLink`). Extra fields: `target` (building for exploit kits), `wild` (two field types for a new POP), `confirmEndProtection` |
|
||||
| `GET /movements` | your active movements (full detail, `recallableUntil`) and incoming ones from others: origin and ETA only, `type: "unknown"` |
|
||||
| `POST /movements/:id/recall` | turn an outbound movement around within the first 90 s (`recall_expired` after) |
|
||||
| `POST /towns/:id/withdraw {ownerTownId, units?}` | reinforcements in this POP go home (host kicks them out, or their owner calls them back) |
|
||||
|
|
@ -121,7 +121,7 @@ Later stages append their routes here and to the route table.
|
|||
|
||||
## Trade, end game, shared reports (stage 5 rest, stage 7 start)
|
||||
|
||||
**Internet exchange trade.** Offers "give X of A for Y of B within Z tiles". Amounts are whole numbers, each side 1..500 (one transport
|
||||
**Internet exchange trade.** Offers "give X of A for Y of B within Z tiles". Amounts are whole numbers, each side 1..1000 (one transport
|
||||
link), the two amounts differ by at most 1:2, the resources differ; `maxDistance` 1..300. Lists are newest first, `after` = id of the last
|
||||
offer you have (older ones follow). `status`: `open`, `accepted`, `completed`, `cancelled`, `expired`, `void`.
|
||||
|
||||
|
|
|
|||
419
docs/BALANCE.md
Normal file
419
docs/BALANCE.md
Normal file
|
|
@ -0,0 +1,419 @@
|
|||
# BALANCE
|
||||
|
||||
First evidence-based balance pass, driven by `tools/bot.js`. **Nothing here says the game is balanced.** It says what 50 scripted
|
||||
players did to the real server code, what looked wrong, what was changed in `public/js/data.js` because of it, and what is still
|
||||
unknown. The bots are not humans (sections 1 and 8).
|
||||
|
||||
**How to read the run labels.** A label like `m2-before-d30-s1` names an option set: default mix, "before" = `--set FORMULAS.secondQueueCoreLevel=10`
|
||||
(and, for the end game, `--set TRANSPORT.capacityPerLink=500`), 30 days, seed 1. The reproducible thing is always the command; the JSON
|
||||
outputs (1 to 2 MB each) are not committed. Every run cited here finished with `INVARIANTS OK`.
|
||||
|
||||
## 1. The harness
|
||||
|
||||
```bash
|
||||
node tools/bot.js --players 50 --days 14 --speed 1 --seed 1 # the run CLAUDE.md asks for
|
||||
node tools/bot.js --players 50 --days 60 --seed 1 --sessions-per-day 2 # a casual player's pace
|
||||
node tools/bot.js --players 50 --days 60 --seed 1 --set FORMULAS.secondQueueCoreLevel=10 # "before" of change B1
|
||||
node tools/bot.js --help # every option
|
||||
```
|
||||
|
||||
- **Driver: the commands layer, not HTTP.** `createServer({ dbPath: ':memory:', clock: FakeClock, autoArm: false })` runs in-process
|
||||
and the bots call `srv.commands.run(name, args)`, the function every REST route calls: same validation, same one-transaction
|
||||
commands, same events and notifications. HTTP, JSON and scrypt are skipped, which is what makes 50 players x 14 days take about
|
||||
3 s and 50 players x 170 days about 140 s on one core (about 3 000 to 5 000 commands per second, p95 command latency 0.1 to 0.5 ms).
|
||||
A route-level bug (schema, auth, rate limit) is therefore not covered by the harness; `npm test` covers those.
|
||||
- **Time:** a `FakeClock` is advanced from stop to stop (next bot sitting, next 2 h economy sample, next midnight), and
|
||||
`scheduler.runDue()` settles every event that fell due in between, each at its own `due_at`, in order.
|
||||
- **Bots** (`tools/bot/bots.js`): builder, raider, conqueror (raider that also takes POPs over), turtle, expander, trader,
|
||||
alliancer (founds and recruits for an alliance). Default mix of 50: 11 builder, 7 raider, 3 conqueror, 6 turtle, 8 expander,
|
||||
6 trader, 9 alliancer. They read the world through the server's own modules (own POPs, the map's towns, their reports) and use the
|
||||
`rules.js` previews (`buildPlan`, `trainPlan`, `footprintGate`, `resolveBattle` ...) before sending a command. Intel about another
|
||||
POP comes only from a real scan (and the scan can fail). They never write to the database.
|
||||
- **Human cadence** (this matters more than anything else in the numbers): a bot plays 3 to 5 short sittings a day at seeded times
|
||||
between 07:00 and 23:00 (a builder 4, a raider 5, a turtle 3 ...; `--sessions-per-day N` forces N for everyone). A sitting lasts
|
||||
5 minutes (`--session-min`, the first one 20): when the build in progress finishes inside the sitting the bot is still there and
|
||||
starts the next, so cheap early builds chain and expensive ones do not. `--always-on` (a sitting every 10 minutes) is the upper
|
||||
bound of what attention can do.
|
||||
- **Player skill:** fields are chosen to keep the production mix at what the bot spends (`--field-policy marginal`, default) or all
|
||||
fields level together (`balanced`, a lower bound). A bot that has been raided trains defence up to 1.25 x the strongest attack
|
||||
it saw, for 5 days (`--no-adapt` turns that off, an upper bound on how badly defenders can do). A bot that sees every store full
|
||||
upgrades the Rack hall first. Several of these were bot bugs before they were fixed, and each moved the results: see section 7.
|
||||
- **`--set PATH=VALUE`** changes `data.js` in place for one run and restores it afterwards. It reaches every value the code reads at call time
|
||||
(all the ones used here); a primitive copied when a module is loaded, e.g. `ENDGAME.scanStrength` in `server/military/landing.js`, is
|
||||
not overridable and the run would silently ignore it.
|
||||
- **Determinism:** every decision comes from a generator seeded with (seed, bot, purpose). The same options give the same stats;
|
||||
`test/bot-run.test.js` runs 12 players for 6 days twice and compares everything except wall-clock `perf`.
|
||||
- **Debug hooks:** `BOT_DEBUG=1` prints the first command errors of each kind, `BOT_DEBUG_DRIFT=1` prints the conservation drift
|
||||
at every economy sample (that is how server finding S1 was found).
|
||||
|
||||
### Invariants (the run exits 1 when one breaks)
|
||||
|
||||
| invariant | how it is checked |
|
||||
|---|---|
|
||||
| resources are conserved | `pools = sources + production - sinks`, per resource, at every midnight and at the end. Pools: POP stock, open trade escrow, cargo of movements that are out, landing-site stockpiles. **Production is exact**: a tap on `db.run` books the difference every `state.settle` writes (and drops it if the transaction rolls back). Sources: start stock of operators and founded POPs, the incumbent Hardware bonus. Sinks: build/train/research costs (command results), Backbone node levels, `cargoLost` in notifications (overflow at delivery), trade refunds clipped by the Rack hall cap (tap on the refund statement). Tolerance 0.5 per rounding event. |
|
||||
| units are conserved | alive (home + stationed + on the road) = trained (`trainDone` events that ran) - lost (battle, scan, incumbent, landing reports, decommission notifications) - consumed (3 crews per founded POP, 1 M&A team per loyalty hit). Exact. |
|
||||
| no negative stock | SQL scan of towns and landing sites. |
|
||||
| no failed events | `events.status = 'failed'` and any server log line mentioning a failure. |
|
||||
| no unexpected error codes | every refused command is counted by code; `validation_failed`, `internal_error` or a non-GameError throw fails the run. |
|
||||
|
||||
`test/bot-run.test.js` also proves the checks bite: it conjures Fiber, deletes units, makes a stock negative and inserts an event
|
||||
without a handler, and asserts the run reports BROKEN each time.
|
||||
|
||||
## 2. The state before this pass (what the bots saw)
|
||||
|
||||
"Before" in every table below means the data as it was: `--set FORMULAS.secondQueueCoreLevel=10` on top of today's `data.js`
|
||||
(that is the only economy number this pass changed, plus `TRANSPORT.capacityPerLink` for the end game, see section 3).
|
||||
|
||||
Default mix, 50 players, per-archetype cadence (3 to 5 sittings a day), speed 1, three seeds, 30 days (`m2-before-d30-s1..3`):
|
||||
|
||||
- Field level (mean over the capital's 18 fields) 10.3 on day 30; Core router 10 reached on day 27 (median); first expansion
|
||||
(a second POP actually founded) on day 27.5; median footprint 7 200.
|
||||
- **The footprint gate is not what holds expansion back.** 84 to 100 % of operators are over the 500 footprint of the first
|
||||
extra POP from day 8 on (`over gate` column); the Rollout depot needs Core router 10, and three Rollout crews cost
|
||||
1 200 / 900 / 900. A bot that beelines for it (the "expander") has Core router 10 on day ~13 and its first new POP on day ~16.
|
||||
- **Build time is irrelevant, the number of builds you can start is not.** A level costs one to three hours of one resource's production
|
||||
and takes 2 to 15 minutes to build. A player gets one build slot (two from Core router 10) and a 5-minute sitting, so what limits
|
||||
progress is how many builds can be started per sitting. Queue utilisation (share of POP-samples with a build running) is 0 to 6 %
|
||||
all game, and 28 % (14 days) to 32 % (30 days) of the production that the rates would give is lost to full stores.
|
||||
- Everyone who plays at all gets there; the question is when. 2 sittings a day: field level 9.8 after 60 days; 4 a day: 18.4
|
||||
(`node tools/bot.js --players 50 --days 60 --seed 1 --sessions-per-day 2|4 --set FORMULAS.secondQueueCoreLevel=10`); a 24/7 player is not much
|
||||
faster than 8 a day (field level 15.3 against 14.9 after 30 days, `--always-on` against `--sessions-per-day 8`).
|
||||
|
||||
## 3. What was changed
|
||||
|
||||
### B1. Second build slot at Core router 3 (was 10)
|
||||
|
||||
| parameter | old | new | file |
|
||||
|---|---|---|---|
|
||||
| `FORMULAS.secondQueueCoreLevel` | 10 | 3 | `public/js/data.js` |
|
||||
|
||||
Why: see above. The experiment that decided it (bots at 2 and 4 sittings a day, 50 players, seeds 1 and 2 averaged; "before" =
|
||||
`--set FORMULAS.secondQueueCoreLevel=10`, "after" = the new default; command pattern
|
||||
`node tools/bot.js --players 50 --days 60 --seed 1 --sessions-per-day 4 [--set FORMULAS.secondQueueCoreLevel=10]`):
|
||||
|
||||
**2 sittings a day, 60 days** (`--sessions-per-day 2 --days 60`, seeds 1+2):
|
||||
|
||||
| metric | before (second slot at Core 10) | after (Core 3) |
|
||||
|---|---|---|
|
||||
| day F>=10 | not reached | 39.0 |
|
||||
| day F>=15 | not reached | not reached |
|
||||
| day F>=18 | not reached | not reached |
|
||||
| F at end | 9.8 | 13.9 |
|
||||
| core10 day p50 | 53.9 | 35.7 |
|
||||
| first expansion day p50 | 49.9 | 36.8 |
|
||||
| footprint p50 | 13092 | 21607 |
|
||||
| net worth (all) | 142818 | 365943 |
|
||||
| storage waste % | 67.8 | 61.5 |
|
||||
|
||||
**4 sittings a day, 60 days** (`--sessions-per-day 4 --days 60`, seeds 1+2):
|
||||
|
||||
| metric | before (second slot at Core 10) | after (Core 3) |
|
||||
|---|---|---|
|
||||
| day F>=10 | 32.0 | 22.5 |
|
||||
| day F>=15 | 47.0 | 37.0 |
|
||||
| day F>=18 | 58.0 | 48.0 |
|
||||
| F at end | 18.4 | 18.9 |
|
||||
| core10 day p50 | 31.4 | 20.0 |
|
||||
| first expansion day p50 | 29.6 | 18.7 |
|
||||
| footprint p50 | 30849 | 42146 |
|
||||
| net worth (all) | 1002649 | 1167173 |
|
||||
| storage waste % | 53.9 | 67.2 |
|
||||
|
||||
(The 60-day waste rises because the economy saturates earlier: once every field is at its maximum the stores are full and the production has nowhere to go. At 14 days, before saturation, B1 halves the waste.)
|
||||
|
||||
**4 sittings a day, 14 days** (`--sessions-per-day 4 --days 14`, seeds 1+2):
|
||||
|
||||
| metric | before (second slot at Core 10) | after (Core 3) |
|
||||
|---|---|---|
|
||||
| F at end | 5.2 | 7.1 |
|
||||
| core10 day p50 | not reached | 8.9 |
|
||||
| first expansion day p50 | not reached | 10.8 |
|
||||
| footprint p50 | 1473 | 1883 |
|
||||
| net worth (all) | 35163 | 56845 |
|
||||
| storage waste % | 37.0 | 16.4 |
|
||||
|
||||
Default mix, per-archetype cadence, seeds 1 to 3 (`node tools/bot.js --players 50 --days 30 --seed N [--set ...=10]`):
|
||||
|
||||
**30 days** (seeds 1 to 3):
|
||||
|
||||
| metric | before (second slot at Core 10) | after (Core 3) |
|
||||
|---|---|---|
|
||||
| day F>=10 | 29.7 | 21.7 |
|
||||
| F at end | 10.3 | 13.2 |
|
||||
| core10 day p50 | 27.0 | 16.7 |
|
||||
| first expansion day p50 | 27.5 | 17.8 |
|
||||
| footprint p50 | 7215 | 10329 |
|
||||
| net worth (all) | 157200 | 307644 |
|
||||
| net worth builder | 108835 | 295333 |
|
||||
| net worth raider | 193321 | 277369 |
|
||||
| raids | 253 | 189 |
|
||||
| storage waste % | 31.8 | 26.0 |
|
||||
|
||||
**14 days** (seeds 1 to 3):
|
||||
|
||||
| metric | before (second slot at Core 10) | after (Core 3) |
|
||||
|---|---|---|
|
||||
| F at end | 5.5 | 7.3 |
|
||||
| core10 day p50 | not reached | 9.0 |
|
||||
| first expansion day p50 | not reached | 11.6 |
|
||||
| footprint p50 | 1569 | 2045 |
|
||||
| storage waste % | 28.1 | 13.2 |
|
||||
|
||||
World speed 2 and 3, 30 days, default mix, seeds 1 and 2 (`--speed 2|3`):
|
||||
|
||||
**Speed 2** (`--speed 2 --days 30`, seeds 1+2):
|
||||
|
||||
| metric | before (second slot at Core 10) | after (Core 3) |
|
||||
|---|---|---|
|
||||
| day F>=10 | 18.0 | 13.0 |
|
||||
| day F>=15 | 28.0 | 23.0 |
|
||||
| F at end | 16.2 | 18.0 |
|
||||
| core10 day p50 | 15.9 | 10.1 |
|
||||
| first expansion day p50 | 16.1 | 10.4 |
|
||||
|
||||
**Speed 3** (`--speed 3 --days 30`, seeds 1+2):
|
||||
|
||||
| metric | before (second slot at Core 10) | after (Core 3) |
|
||||
|---|---|---|
|
||||
| day F>=10 | 14.0 | 11.0 |
|
||||
| day F>=15 | 21.0 | 18.0 |
|
||||
| F at end | 18.6 | 18.9 |
|
||||
| core10 day p50 | 11.5 | 8.1 |
|
||||
| first expansion day p50 | 12.0 | 7.7 |
|
||||
|
||||
What it does not do: it changes nothing for a player who is always online (`--always-on`, 30 days: field level 15.3 before, 15.2 after, same day for Core router 10) and little at 8 sittings a day (field level 14.9 to 15.6); it helps most those who play 1 to 4 times a day (1 a day, 30 days: field level 3.8 to 4.6). A casual player is still behind a committed one (section 4, "attention"). Going further (slots
|
||||
2/3/4/5 at Core router 2/4/7/10) was measured with a three-line hook in `rules.queueSlots` (`FORMULAS.extraQueueCores`, default
|
||||
`[]`, so the committed behaviour is unchanged) and not adopted: slots 2/3/4/5 at Core 2/4/7/10 bring the 2-a-day player to level 18 on day 51 and everybody to saturation between day 40 and 51 (table in section 4). That removes most of the attention gap by speeding everybody up and leaves the committed player with nothing to build for ~60 days before the backbone opens, which is a pacing decision (how long should the economy last?) the bots cannot make.
|
||||
|
||||
Side effects worth knowing: builders now lose far less to raids (they are no longer slow targets, see "raiding" below), and the
|
||||
first expansion comes ~10 days earlier. Both are consequences of the faster early game, not separate changes.
|
||||
|
||||
### B2. Transport capacity 1000 per link (was 500)
|
||||
|
||||
| parameter | old | new | file |
|
||||
|---|---|---|---|
|
||||
| `TRANSPORT.capacityPerLink` | 500 | 1000 | `public/js/data.js` |
|
||||
|
||||
Why: the end game was **shipping-limited**, not production-limited. The Backbone node costs 7.2 M of each resource over 100 levels
|
||||
(21.6 M units in all) and the only way to bring them to the site is by transport, 500 units per link per trip, links = Internet
|
||||
exchange level, one trip per sitting per link. By day ~50 to 60 (4 sittings a day, with B1) a committed player's 18 fields are at their maximum;
|
||||
one 18-member alliance then produces roughly 2.6 M units a day (a world average of 600 / 600 / 480 per POP and hour on ~165 POPs, a third of
|
||||
them the alliance's), so production would cover the cost in about eight days, while the same
|
||||
alliance shipped 150 to 220k units a day (18 members x ~5 links x ~4 sittings x 500 = 180k). The early levels are cheap (level 1 is
|
||||
4 000 of each, level 89 is 193 000 of each, 580k for one level) so the stockpile covers them at once; from level ~60 on a single level costs more than
|
||||
a day of shipping and the alliance waits for trucks, not for the 2 h x 1.025^L build.
|
||||
|
||||
"Before" = `--set TRANSPORT.capacityPerLink=500`, "after" = the new default; commands
|
||||
`node tools/bot.js --players 50 --days 175 --seed 1 [--set TRANSPORT.capacityPerLink=500]` (speed 1) and
|
||||
`--speed 3 --days 110` (a 3x world). Winner = the first alliance to finish node level 100.
|
||||
|
||||
| world | before: 500 per link | after (B2): 1000 per link | measured, not adopted: 2000 per link | measured, not adopted: 500 per link and `ENDGAME.costGrowth` 1.035 (3.9 M of each) |
|
||||
|---|---|---|---|---|
|
||||
| speed 1, seed 1, 175 days | no winner by day 175, best node level 89 (about 45 more days at its rate) | winner day 164 (64 days after the sites opened) | winner day 143 (43 days after the sites opened) | winner day 159 (59 days after the sites opened) |
|
||||
| speed 1, seed 2, 190 days | no winner by day 190, best node level 97 (about 12 more days at its rate) | winner day 156 (55 days after the sites opened) | not run | not run |
|
||||
| speed 1, seed 3, 190 days | no winner by day 190, best node level 88 (about 61 more days at its rate) | winner day 178 (78 days after the sites opened) | not run | not run |
|
||||
| speed 3, seed 1, 110 days | no winner by day 110, best node level 79 (about 114 more days at its rate) | no winner by day 110, best node level 94 (about 22 more days at its rate) | winner day 84 (51 days after the sites opened) | no winner by day 110, best node level 94 (about 17 more days at its rate) |
|
||||
| speed 3, seed 2, 110 days | no winner by day 110, best node level 84 (about 76 more days at its rate) | winner day 109 (76 days after the sites opened) | not run | not run |
|
||||
|
||||
Reading it: at 500 per link nobody finished within 175 to 190 days at speed 1 (levels 88, 89, 97; the extrapolations are 12 to 61 more
|
||||
days at the rate the leading site was fed), so a 1x world would run to day ~200 to 250. At 1000 the winner arrives 55 to 78 days after
|
||||
the sites open, which is 1.5 to 2.2 times the 36 days that building the 100 levels takes on its own, so shipping still matters but does not
|
||||
decide everything. 2000 gives 43 days: shipping is then barely a constraint. Lowering the cost (`ENDGAME.costGrowth` 1.035) helps about as
|
||||
much as 1000 per link at both speeds (59 days at 1x; best level 94 on day 110 at 3x, the same as 1000 per link). Either dial works; capacity
|
||||
was taken because the cost curve was set on purpose ("far more than anything else", DECISIONS E5, and DESIGN.md quotes 7.2 M) while carrying
|
||||
500 units per trip is a convenience limit nobody argued for, and because it also lifts bulk trade a little.
|
||||
|
||||
**Not solved by B2:** speed does not shorten the end game the way it shortens everything else. A 3x world opens its sites on day 33, but
|
||||
its alliances still take 76 days (seed 2) after that, about as long as a 1x world, because shipping is per sitting, not per hour (and
|
||||
at day 33 the members are at field level ~12 with fewer links). `capacityPerLink x world speed` in `rules.transportPlan` would
|
||||
restore the scaling (a 10x world with a final push finished 8.5 days after opening, below) but the client reads the constant directly
|
||||
(trade form limits, send dialog), so it was left to the owner of that code.
|
||||
|
||||
|
||||
## 4. Found, not changed
|
||||
|
||||
Each item: what the runs show, the run to reproduce it, and why nothing was tuned.
|
||||
|
||||
### Attention is still the biggest lever (B1 narrows it, does not remove it)
|
||||
|
||||
Days until the average capital's mean field level reaches 10 / 15 / 18 (all 18 fields, mean over the 50 operators; 50 players, seed 1, 120
|
||||
days, `node tools/bot.js --players 50 --days 120 --seed 1 --sessions-per-day N [--set FORMULAS.secondQueueCoreLevel=10]`):
|
||||
|
||||
| sittings a day | before: second slot at Core 10 | after (B1): second slot at Core 3 | not adopted: slots 2/3/4/5 at Core 2/4/7/10 |
|
||||
|---|---|---|---|
|
||||
| 2 | 62 / 91 / 113 | 39 / 67 / 85 | 26 / 40 / 51 |
|
||||
| 4 | 32 / 47 / 58 | 22 / 37 / 48 | 18 / 29 / 41 |
|
||||
| 8 | 20 / 31 / 46 | 18 / 29 / 43 | 17 / 27 / 40 |
|
||||
|
||||
A 2-sittings-a-day player takes about 1.8 times as long as a 4-a-day player to level 18, and 2.0 times as long as an
|
||||
8-a-day player. That is a lot less than before B1 (2 a day: 113 days to level 18 against 58 at 4 a day) but it is not "a few minutes a
|
||||
few times a day is enough": the casual player gets level 18 on day 85, two weeks before the backbone opens, the committed one
|
||||
on day 48. More slots narrow it further (last column), at the price of pushing the committed player to saturation even sooner;
|
||||
that is a pacing decision (how long should the economy last?) that the bots cannot make for you, so it is left open.
|
||||
|
||||
### Raiding: profitable per raid, not a winning strategy at equal attention
|
||||
|
||||
Every bot at 4 sittings a day, B1 config, 30 days, seeds 1 to 3 (`node tools/bot.js --players 50 --days 30 --seed N --sessions-per-day 4`;
|
||||
net worth = everything spent on buildings, units and research plus the stock left):
|
||||
|
||||
| archetype | n | net worth, seeds 1 / 2 / 3 | field level (seed 1) | POPs (seed 1) | raids won / sent (seed 1) | times hit, mean over the archetype (seed 1) |
|
||||
|---|---|---|---|---|---|---|
|
||||
| builder | 11 | 302k / 301k / 297k | 13.7 | 3 | - | 2.5 |
|
||||
| raider | 7 | 214k / 232k / 216k | 11.9 | 1 | 63/63 | 0.3 |
|
||||
| conqueror | 3 | 309k / 246k / 284k | 12.7 | 3.67 | 43/43 | 4.3 |
|
||||
| turtle | 6 | 156k / 157k / 154k | 10.4 | 1 | - | 0.0 |
|
||||
| expander | 8 | 384k / 385k / 386k | 14.2 | 6 | - | 4.6 |
|
||||
| trader | 6 | 206k / 212k / 231k | 12.1 | 3 | - | 5.2 |
|
||||
| alliancer | 9 | 286k / 289k / 291k | 13 | 3 | - | 2.3 |
|
||||
|
||||
- Raids are won (100 % in all three seeds, attack/defence median 4 to 27: the raider only attacks what it beats by a wide margin
|
||||
after a scan that succeeds 81 to 86 % of the time), they return about 2.7 to 3.2 times the value of the units lost, 106 to 153 raids
|
||||
per run. Nobody younger than 4 days is raided (72 h protection and the bots prefer rich targets); 3 to 8 raids per run hit
|
||||
operators of 4 to 7 days.
|
||||
- But the raiders end 23 to 29 % behind the builders in net worth and (seed 1) 1.8 levels behind in field level: a 1.5-day army is not paid back within
|
||||
a month, and the 15 to 27k of loot per raider (nominal; see the overflow note below) is much less than the army costs. Builders lose
|
||||
2 to 4k each, about 1 % of their output. Turtles (two days of production in defence) were never hit (0 hits in all three 30-day runs, and in a 170-day run made with the
|
||||
bot build before B1) and are 48 % behind builders: defence is cheap per point (a Honeypot is 0.42 defence per resource point against 0.27 attack
|
||||
per point for a Script crew, before the Firewall) but a turtle pays for it every day.
|
||||
- `--no-adapt` (nobody answers a raid with more defence): 137 and 213 raids instead of 106 and 153, builders hit 24 and 13 times
|
||||
instead of 27 and 19; net worth within 3 % for everybody except raiders (+3 to +12 %) and conquerors (+3 to +7 %). The army cost, not the
|
||||
defenders' reaction, is what keeps raiding in check here.
|
||||
- Earlier in this pass raiders looked dominant (net worth 1.8 times a builder's). That was the old single build slot (builders were
|
||||
slow and easy to hit, raids 253 against 189 per run) plus a cadence difference: with per-archetype cadence a raider plays 5 sittings and a builder 4.
|
||||
After saturation (day ~50 at 4 sittings a day) net worth stops being comparable: everybody turns the surplus into units
|
||||
(60-day runs `arch-d60-s1/2` show raiders ahead 1.5 to 1.6 times, which says nothing about raiding).
|
||||
- Sensitivity, so the next pass knows the dials (per-archetype cadence, 30 days, seeds 1+2, B1 config; builder loot loss per
|
||||
builder / raids per run / raider net worth against the untouched run):
|
||||
`MILITARY.cacheMax 0.7 + cachePerLevel 0.14`: 4-6k, 181, -4 to -5 %; `cacheMax 0.8 + cachePerLevel 0.2`: 2-3k, 87 to 164, -8 to -11 %;
|
||||
`MILITARY.raidLossFactor 0.8`: 4-6k, 142-158, -4 to -6 %; `script_crew carry 30, botnet 90`: 3k, 137-197, -7 to -12 %. Untouched:
|
||||
10-11k, 188-198. None adopted: the untouched game is not dominant and bots scout better than most players will.
|
||||
- **Loot is mostly wasted on arrival** (`m2-after-d30-s1`): loot is split evenly over Fiber, Hardware and Capital whatever the raider
|
||||
needs, the raider's Hardware and Capital stores are usually full, and overflow at delivery is destroyed: over all deliveries of that run 77k Hardware,
|
||||
14k Capital and 2k Fiber vanished against 251k looted in total. Real value of a raid is mostly its Fiber. A rule that weights
|
||||
the split by free storage would double the effective loot; that is a design change, not a number.
|
||||
|
||||
### Takeover is expensive enough
|
||||
|
||||
A conqueror-heavy world (12 of 50 conquerors, 20 expanders, 18 builders, 4 sittings a day, 45 days, seeds 1 and 2: `cq-base-d45`,
|
||||
`cq-base-d45-s2`):
|
||||
|
||||
| run | POPs in the world | taken over | takeover battles (one M&A team each) | conqueror: net worth / footprint / POPs | expander: net worth / footprint / POPs | builder: net worth / footprint / POPs |
|
||||
|---|---|---|---|---|---|---|
|
||||
| seed 1, M&A team 700/600/800 (as shipped) | 279 | 42 | 613 | 911k / 21k / 5.83 | 981k / 27k / 7.7 | 934k / 25k / 3.06 |
|
||||
| seed 1, M&A team x3 (2100/1800/2400) | 254 | 4 | 266 | 905k / 21k / 3.25 | 975k / 27k / 7.95 | 934k / 25k / 3.11 |
|
||||
| seed 2, as shipped | 288 | 46 | 657 | 1000k / 22k / 6.17 | 984k / 27k / 8 | 937k / 25k / 3 |
|
||||
| seed 2, M&A x3 | 252 | 3 | 304 | 979k / 22k / 3.17 | 978k / 27k / 8 | 934k / 25k / 3 |
|
||||
|
||||
Taking over costs about 14 to 15 M&A teams per POP (loyalty 100, 15 to 30 per hit, +1 per hour back, the bots hit once per sitting),
|
||||
about 30k of resources, and the 12 conquerors in that world end level with the expanders and builders in net worth (911 to 1 000k
|
||||
against 975 to 984k and 934k) and behind them in footprint (21 to 22k against 27k and 25k): not dominant. Tripling the M&A price
|
||||
(2 100 / 1 800 / 2 400) leaves 3 to 4 takeovers: the mechanic dies. So 700 / 600 / 800 sits in a narrow working window. Not tuned.
|
||||
(Net worth is read near saturation here, hence the footprint column.)
|
||||
|
||||
### Trade works but is thin, and escrow loses resources
|
||||
|
||||
38 to 47 offers completed per 30 days in the standard runs (volume about 40k units), roughly half of all posted offers expire. Every
|
||||
operator is short of Fiber (buildings cost Fiber : Hardware : Capital in a ratio of about 1 : 0.7 : 0.5, the 18 fields give 5 : 5 : 4
|
||||
plus 4 substations), so the market has no natural counterparties and trade is mostly Hardware or Capital surplus for Fiber or each
|
||||
other. Completed offers trade at 1.00 give/want (median). Not tuned: a thin market is an observation about this bot population, not a
|
||||
number to move.
|
||||
|
||||
**Server finding S2 (not fixed):** the escrow of an offer that expires or is cancelled after the POP's store filled up again is
|
||||
refunded only up to the Rack hall cap (`trade.refund`, decision R1). The harness books it: 36 refunds per 30-day run (all three seeds) lose
|
||||
12 to 15k Hardware and Capital in total (`arch-d30-s1`: 3.3k Hardware, 11.2k Capital in 36 events), invisibly to the player.
|
||||
DESIGN.md says nothing is lost in trade. Fix options: credit the clipped part back as a transport that waits, or let escrow refunds
|
||||
exceed the cap the way the existing "stock above a lowered cap is kept" rule does for stock.
|
||||
|
||||
### Power binds early and then recedes
|
||||
|
||||
Share of POPs that carry units whose net power is below 3 per hour: 64 to 77 % on day 4, 52 to 56 % on day 8, about 30 % on day 12,
|
||||
6 to 11 % from day 20 (`arch-d30-s1..3`). The bots size armies to net power, so no unit went offline in any standard run (0 `units_offline`
|
||||
notifications, 0 decommissioned); that path is covered only by the unit tests. Units on the road draw power from nobody, so a raider that is
|
||||
out frees headroom, trains more, and finds the POP over its output when the army returns: in a one-off probe (not part of the harness) 22 of 1 039 raiding sittings of a 20-day run found
|
||||
the capital's units offline (transient, fixed by the next substation level). Not tuned.
|
||||
|
||||
### Everything else that looked fine, with numbers
|
||||
|
||||
- **Footprint gate vs reachable footprint:** the gate for the first extra POP (500) is passed on day ~8 by 84 to 100 % of operators; the
|
||||
8th extra POP needs 21k and the median footprint is 10k on day 30 and 40k on day 60 (4 a day). The gate never binds before Core
|
||||
router 10 and the crews do.
|
||||
- **Incumbent sites:** 14 to 21 attacks per 30-day run (raiders and conquerors only), all won, +2 500 Hardware each (35 to 52k in total)
|
||||
for units worth 1.4 to 1.6k lost per attack: farmable, not a runaway (defence grows 4 % a day, the bots' armies and travel time cap the
|
||||
rate). Not tuned.
|
||||
- **Storage:** with B1, 13 % (14 days) to 26 % (30 days) of the production the rates would give is lost to full stores, mostly Hardware and
|
||||
Capital (28 to 30 % against 19 % Fiber), and from saturation on (day ~50 at 4 sittings) nearly all of it. Stores are meant to cap
|
||||
the economy; the point is that a committed player has nothing left to spend on in the capital for ~50 days before the backbone
|
||||
opens, except units and extra POPs. A pacing decision, not changed.
|
||||
- **Beginner protection** (72 h): 0 raids against operators younger than 4 days in any run.
|
||||
- **Rack hall cache** and **loyalty/takeover** behave as described above.
|
||||
- **Performance:** 50 players x 60 days in 17 to 30 s (the higher figure with 16 runs in parallel), 200 players x 14 days (radius 100) in 14 s, p95 command latency 0.1 to 0.5 ms,
|
||||
no failed event and no unexpected error code in any run listed here.
|
||||
|
||||
## 5. The end game
|
||||
|
||||
### What the bots do
|
||||
|
||||
When the world is at day `ENDGAME.openDay / speed` every alliance with at least 3 members plans (a shared in-memory plan, what an
|
||||
alliance would agree in its chat): the site with the lowest static defence (a little weight on distance); ONE member with an Ops lab trains
|
||||
Script crews to 1.12 times the site's defence at arrival and attacks with everything it has (an attack is one movement from one POP and is resolved
|
||||
against the full static defence, so attacks cannot be added up); once the alliance holds a site every member ships its spare Fiber, Hardware and Capital
|
||||
(`backboneShip`, up to its free links per sitting) and anyone starts the next level when the stockpile pays for it (`backboneBuild`).
|
||||
`--endgame-step-min N` adds a final push: those members also act every N minutes after the sites opened.
|
||||
|
||||
### What the runs show
|
||||
|
||||
- **Capturing is not hard for a developed alliance.** In the 1x runs three alliances took a site within 0.1 to 2.5 days of the opening (the
|
||||
first attack that was strong enough; 3 of 3 landing attacks won), in the 3x world six sites were held by six alliances after 14 won attacks (sites
|
||||
change hands while the defence is still low). The static defence of a site at day 100 is 27k to 45k depending on the site (600 x 5.0 x 12 x a seeded +-25 %), i.e. an army of
|
||||
700 to 1 150 Script crews before research, which the striker (the member with the best economy and an Ops lab) had within days.
|
||||
- **Nothing is contested afterwards, and nothing can be.** The biggest army any single POP held at the end was 55 to 62k attack before research;
|
||||
the defence of a built-up site was 200 to 240k at speed 1 (levels 89+), 370 to 440k at speed 3. Defence passes what one POP can send
|
||||
at node level ~25 (weakest site) to ~40. That is E1 (no garrisons) showing up: after the opening days the race is shipping and node build
|
||||
time, not war. The only interaction is the opening scramble (the 3x world saw 14 won attacks for 6 sites; the 1x worlds none after the
|
||||
first three).
|
||||
- **Is 7.2 M of each resource feasible or trivial?** Not infeasible, not trivial: with the capacity it was (500) the leading alliance (13 to 19 members) needed
|
||||
more than 90 days after opening at 1x (extrapolated 100 to 150); with 1000, 55 to 78 days (seeds 1 to 3). Production is not the limit (previous section).
|
||||
- **With attention it is fast.** A 10x world, seed 1, members of the alliances that chase the backbone online every 30 minutes after the
|
||||
sites opened (`--speed 10 --days 24 --endgame-step-min 30`): the winner finished 13.8 days after opening with 500 per link and 8.5 days
|
||||
with 1000 (85 world days; the node build time alone is 3.6 days at 10x). Without the final push (`--speed 10 --days 30`, 500 per link) the best
|
||||
node was at level 58 nineteen days after opening. So the race is decided by who is online, as designed, and 1000 per link does not make it trivial
|
||||
for people who are not.
|
||||
- **Conservation holds through all of it**: shipments, bounces, stockpiles and Backbone levels are in the ledger; every run above finished
|
||||
`INVARIANTS OK` (the first speed-1 runs of this pass were flagged only because the bots kept commanding an ended world; the harness now stops
|
||||
and treats `world_ended` as expected).
|
||||
|
||||
|
||||
## 6. Server findings
|
||||
|
||||
| # | finding | status |
|
||||
|---|---|---|
|
||||
| S1 | **Cargo above the Rack hall cap was destroyed silently on bounced shipments.** A shipment that comes home (landing site changed hands, POP gone) rides back on a `link` return leg; `events/return.js` sent no notification for link legs, so the overflow was invisible to the player and to any audit. The conservation ledger found it as 1 000 Hardware + 2 718 Capital of drift in the first speed-10 end-game run (`node tools/bot.js --players 50 --days 14 --seed 1 --speed 10 --endgame-step-min 30`; with the fix the same command shows no drift, and it reproduces the bug if the `carrying` condition in `return.js` is taken out). | **fixed** (`return.js` notifies when a link leg carries cargo), `test/bot-server-fixes.test.js` fails without the fix |
|
||||
| S2 | Trade escrow refunds are clipped at the Rack hall cap and the loss is not reported (section 4). | open, design decision |
|
||||
| S3 | `reports.id` is `INTEGER PRIMARY KEY` without `AUTOINCREMENT`; the 14-day cleanup can empty the table and SQLite then reuses low ids. A consumer that keeps "the last report id I saw" (the harness did, and silently missed every report after the first cleanup in a 170-day run) skips new reports. The API's own cursor (`GET /reports?after=` with `r.id < after`, newest first) is not hurt unless a client mixes old and new ids. Repro in five lines: insert three reports, `DELETE FROM reports`, insert one more: its id is 1 (the harness hit it in 170-day runs, where raids stop and every report expires). | open, low severity |
|
||||
| S4 | Loot is split evenly over the three resources and destroyed on overflow (section 4). | open, design |
|
||||
| S5 | `ensureSites` is lazy (E2): the first touch of a landing site writes `backbone_open`; the harness reads sites with `E.siteStates` and never triggers it. No bug, noted so nobody expects the push in a bot run. | known |
|
||||
|
||||
## 7. Bot bugs that moved the numbers (so nobody trusts an early number from this pass)
|
||||
|
||||
- Bots read reports with "id greater than the last id": after the first 14-day cleanup new reports were skipped and the unit ledger
|
||||
drifted (phantom `script_crew -855`). Fixed with a (created_at, ids at that instant) cursor (S3).
|
||||
- The wish list offered the field that was already being built, so a bot with two or more build slots could only ever have ONE field
|
||||
upgrade running. That understated B1: before the fix the second slot at Core 3 looked like +25 % net worth for casual players, after
|
||||
it 2.6 times (2 sittings a day, 60 days). Every table in this document was produced after that fix.
|
||||
- Bots tried to send raids from POPs whose units were offline (676 refused commands in one 30-day run) and ran a fixed "balanced"
|
||||
field policy that wasted Capital; both fixed (`--field-policy balanced` keeps the old one as a lower bound).
|
||||
|
||||
## 8. What is still unknown
|
||||
|
||||
- Bots are not humans. They never forget to log in, never panic, never coordinate beyond a shared in-memory plan, never mis-click, and play
|
||||
the same sittings every day. They do not use reinforcement, recall, the shared report folder, messages, sitters, or night play. They
|
||||
never choose a different capital or sell their stock off before an attack.
|
||||
- No real players means no data on how many sittings a day people really play; the whole B1 argument rests on the 2-to-8 sittings-a-day
|
||||
band that the CLAUDE.md pitch implies.
|
||||
- Rural bonuses, wild slots and the Peering office size ladder were not examined. The offline/decommission power path never ran in a bot
|
||||
run. The alliance war/peace states were exercised (NAP, confederation, war appear in the runs) but never made to matter in a fight.
|
||||
- The end game was run with a single plan per alliance that nobody contests after the first days (section 5); a determined rival with
|
||||
several armies cannot beat a built-up site (single-POP attack ceiling), so there is no data on what an actual fight for a site would look like.
|
||||
- `--always-on` is an upper bound on attention, not a model of a person.
|
||||
|
||||
|
||||
|
|
@ -230,3 +230,25 @@ Accepted for now, written down so nobody is surprised:
|
|||
the reviewer or ~70 fuzz seeds; a recovery sweeper is a stage-7 item.
|
||||
- HTTP connections per IP are not capped (only WebSockets are); behind nginx Proxy Manager the per-IP request limiter applies.
|
||||
- Tokens do not expire and there is no change-password route yet (revoke from Settings works).
|
||||
|
||||
## B1 — Second build slot at Core router 3, and slots are data (stage 7 balance pass, `docs/BALANCE.md`)
|
||||
The bot harness (`tools/bot.js`) showed that progress is limited by how many builds a player can START per sitting, not by resources or
|
||||
build time (builds take minutes, a level costs hours of production; with one slot a 5-minute sitting starts one or two). 2 sittings a day
|
||||
needed 62 days for the capital's mean field level to reach 10, 4 a day 32. `FORMULAS.secondQueueCoreLevel` 10 -> 3 (data only) brings that to 39 and 22 days
|
||||
and changes nothing for a player who is always online. `rules.queueSlots` now also reads `FORMULAS.extraQueueCores` (default `[]`: more
|
||||
slots at the listed Core router levels; behaviour unchanged until someone fills it). That is a three-line extension of a formula, not a bug
|
||||
fix, logged here because the rule was "formulas only if wrong": more slots (2/3/4/5 at Core 2/4/7/10) would remove most of the gap between
|
||||
casual and committed players but saturate the committed ones six weeks before the backbone opens; left as a pacing decision.
|
||||
|
||||
## B2 — Transport capacity 1000 per link (was 500)
|
||||
The end game is shipping-limited, not production-limited: 21.6 M units (7.2 M of each resource) in 500-unit trips. In three seeds with 50 bots
|
||||
(4 to 5 sittings a day, alliances of 13 to 19) nobody finished level 100 by day 175 to 190 at speed 1 (levels 88 to 97); with 1000 per link one alliance
|
||||
won in each seed, 55 to 78 days after the sites opened (node build time alone is 36 days). Raising `ENDGAME.costGrowth` to 1.035 or
|
||||
the capacity to 2000 were measured and not taken (2000 leaves only the 36-day build floor as a constraint). Not solved: a 3x world takes about as
|
||||
long after the sites open as a 1x world, because shipping is per sitting, not per hour; `capacityPerLink x world speed` would fix it but the
|
||||
client reads the constant. See BALANCE.md section 5.
|
||||
|
||||
## B3 — A bounced shipment reports its overflow
|
||||
`events/return.js` stayed silent for empty-carrier return legs AND for shipments that came home with cargo; cargo above the Rack hall cap is
|
||||
dropped on arrival, so that loss was invisible. Link legs that carry cargo now send `movement_returned` with `cargoLost`
|
||||
(`test/bot-server-fixes.test.js`). Found by the harness's conservation ledger (BALANCE.md section 6, S1).
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ One build queue per POP. The **Core router** level shortens all build times. Lev
|
|||
|
||||
| Building | Role |
|
||||
| --------------- | --------------------------------------------------------------------------------------------- |
|
||||
| Core router | Required for everything. Build time ÷ (1 + 0.04·L). Unlocks the second queue slot at 10. |
|
||||
| Core router | Required for everything. Build time ÷ (1 + 0.04·L). Unlocks the second queue slot at 3 (was 10, BALANCE.md B1). |
|
||||
| Rack hall | Storage cap for Fiber/Hardware/Capital: `cap(L) = 1000 * 1.22^(L-1)`. |
|
||||
| Battery bank | Power buffer: `buf(L) = 200 * 1.22^(L-1)` points. |
|
||||
| Firewall | Defence multiplier `1 + 0.03·L`. DDoS rigs reduce it during attacks. |
|
||||
|
|
@ -159,11 +159,11 @@ A new POP starts at level 0 everything and 1 h of resources. Takeover requires t
|
|||
|
||||
The Internet exchange lists offers "give X of A for Y of B, max distance Z". Ratio bounded 1:2 to stop
|
||||
pump-feeding. Accepting an offer spawns two transport movements. Direct transports to own POPs or to any player
|
||||
(e.g. alliance support) use the same links. Transport links: level of the exchange, capacity 500 each.
|
||||
(e.g. alliance support) use the same links. Transport links: level of the exchange, capacity 1000 each (500 before BALANCE.md B2).
|
||||
|
||||
**Clarified (what the server does).**
|
||||
- An offer is "give `giveAmount` of `giveRes` for `wantAmount` of `wantRes`, within `maxDistance` tiles", posted from one POP that has
|
||||
an Internet exchange. Each side must fit ONE transport link (1..500) and the two amounts differ by at most 1:2:
|
||||
an Internet exchange. Each side must fit ONE transport link (1..1000) and the two amounts differ by at most 1:2:
|
||||
`give <= 2 x want` and `want <= 2 x give` (count-based, the resources are not weighted). The resources must differ.
|
||||
- The offered amount is **escrowed**: it leaves the POP when the offer is posted. Cancelling or expiry (48 h / world speed) credits it back
|
||||
to the POP without the Rack hall cap (an amount above the cap is kept, it only stops growing), so nothing is created or lost.
|
||||
|
|
@ -204,7 +204,7 @@ stays with the site. Landing sites cannot be settled, only taken.
|
|||
home otherwise). A full attack with attack > defence wins: the attacker's alliance holds the site. No loot, the site loses nothing, the
|
||||
survivors drive home. Level, stockpile and a running build stay with the site. A holder that disbands leaves the site to the incumbent
|
||||
(level kept).
|
||||
- **Feeding the node:** members of the holder alliance send resources by transport (`POST /backbone/:id/ship`, same links, 500 per link, 12
|
||||
- **Feeding the node:** members of the holder alliance send resources by transport (`POST /backbone/:id/ship`, same links, 1000 per link, 12
|
||||
tiles/h). On arrival they join the stockpile if the sender's alliance still holds the site, otherwise they ride home. A ledger records
|
||||
who sent what.
|
||||
- **Building:** level L (1..100) costs `4000 x 1.045^(L-1)` of each resource (level 100: 312 301; about 7.2 million of each in total) and
|
||||
|
|
@ -251,7 +251,7 @@ computed from `serverTime`.
|
|||
or attacked, never raided or taken over, and never fight back.
|
||||
- **Power:** when the battery is empty and net power is negative, all units in that POP are offline; after 24 h / speed the most
|
||||
expensive are decommissioned until the draw fits.
|
||||
- **Transport:** 12 tiles/h, 500 per link, links = Internet exchange level; a link is busy until the empty carriers are back.
|
||||
- **Transport:** 12 tiles/h, 1000 per link, links = Internet exchange level; a link is busy until the empty carriers are back.
|
||||
- **Protection and recall:** see S3-4 and S3-7 in DECISIONS.md; the recall window is 90 s of real time (not divided by world speed).
|
||||
|
||||
## Open questions
|
||||
|
|
|
|||
69
docs/NEXT.md
69
docs/NEXT.md
|
|
@ -20,7 +20,7 @@ Not done:
|
|||
- Marketplace / Internet exchange: DONE on the server, see "Trade, end game, gaps" below.
|
||||
- Shared report folder and "see each other's incoming": DONE on the server (below). The pact effect "no attacks inside a NAP/confederation"
|
||||
is enforced by the military stage (`pactBlocks`).
|
||||
- No web client; WebSocket push (stage 6) now exists server-side, see "Stage 6" below.
|
||||
- Web client: see the client sections below; WebSocket push (stage 6) exists server-side and in the client.
|
||||
- Message retention/cleanup of old rows, alliance rename/description, mass-mail abuse reporting, sitter accounts.
|
||||
- Rankings are not cached; battle rankings stay empty until the military stage writes `operator_stats`.
|
||||
- Not run: Playwright, load, or any bot balance run; the social numbers in `SOCIAL` (limits, TTLs, role table) are first guesses.
|
||||
|
|
@ -41,7 +41,7 @@ its protections, offline units and decommission, restart catch-up from a reopene
|
|||
recall, research, reports/cursor/retention, API smoke over HTTP). Fake clock, in-memory DB, port 0; no Playwright.
|
||||
Not done / not claimed:
|
||||
- **Nothing is balanced.** All unit stats, costs, research curves, incumbent defence and the 50-unit-scale combat numbers are first guesses;
|
||||
there was no bot run (`tools/bot.js` does not exist yet). Do not cite any of them as tuned.
|
||||
there was no bot run when this was written (`tools/bot.js` exists now: see "Stage 7" below and BALANCE.md; most of these numbers are still untuned). Do not cite any of them as tuned.
|
||||
- Training cannot be cancelled; no sitter, no night protection. (Report sharing and allied incoming: done, see below.)
|
||||
- Units in transit draw no power from anyone; an operator cannot choose a new capital POP (no command); a captured POP keeps its footprint.
|
||||
- Backbone landing sites and the Backbone node: see "Trade, end game, gaps" below.
|
||||
|
|
@ -133,6 +133,47 @@ Not done / not claimed:
|
|||
- Close 4401 stops the socket but does not itself send the player to login: that happens on the next REST 401 (`api` `unauthorized`).
|
||||
- `ready.serverTime` is not used for the clock offset (no round-trip estimate on the socket); REST responses keep doing that.
|
||||
|
||||
## Client: trade, end game, alerts (public/)
|
||||
Built (More group; strings in `strings/{trade,world,alerts}.js`, en + nb):
|
||||
- **Exchange** (`screens/trade.js`): tabs Offers / New / Mine / Send. Offers: filters give / want / POP, reach pills, "Take" sheet with a POP chooser
|
||||
from `acceptableFrom` (distance, transport time, stock, free links, why a POP is greyed out). New: live check with `rules.tradeTermsCheck` (1:2 band,
|
||||
1000 per link, distance), stock and free-link checks, the exchange level a taker needs, escrow/expiry rules in words. Mine: status chips, poster/acceptor
|
||||
role, expiry countdown, cancel. Send: direct transport through the send dialog (`App.openSend({ type: 'transport' })`; `milcore.moveOptions` got a
|
||||
`transportOnly` flag so a rival's POP can be the target) plus links in use per exchange POP. No exchange: empty state with the requirement (Core router 4).
|
||||
- **Backbone race / ended world** (`screens/world.js`, `endcore.js`, `cargo-ui.js`): phase banner (countdown to the landing sites, leading alliance, winner,
|
||||
ended), the 7 sites with holder / level / build progress / stockpile, Manage sheet for your alliance's sites (build next level, ship resources, ledger),
|
||||
scan/attack through the send dialog (`milcore.moveOptions` landing branch), final ranking tabs after the end. Whole-client ended mode: `App.worldEnded()`,
|
||||
pill in the top bar, card on the POP screen, action buttons (primary/danger/`[data-act]`, not `[data-keep]`) disabled by a MutationObserver; a stale page
|
||||
learns it from a `world_ended` error (via `App.errMsg`), the `world_ended` push or `/me`.
|
||||
- **Map**: landing sites drawn as a diamond with a level ring (gold = incumbent, cyan = yours, magenta = rival alliance), legend row, tile sheet (holder, level,
|
||||
Backbone race button, send). **Reports**: `landing` type, scans of landing sites, share to alliance, Alliance tab (folder), remove from folder; shared reports
|
||||
are told from nobody's side. **Movements**: shipments to a site are labelled; `alliedIncoming` was already there and never counts in the red badge.
|
||||
- **Alerts** (`alertkinds.js`, pure): every notification type the server writes (found by a test that greps `server/`) has a describer; includes trade_*,
|
||||
backbone_*, world_ended, alliance_*, diplomacy_*, message kinds.
|
||||
- Tests: `test/client-world.test.js` (endcore, moveOptions, string coverage, no HTML sinks, every public script parses), `test/client-alerts.test.js`,
|
||||
`test/client-i18n.test.js` now iterates `CODES` of `server/errors.js`. 203 tests green.
|
||||
- Looked at in headless Chromium against the real server (real clock, in-memory DB; scratch scripts, not in the repo): screenshot sweep of every new screen on phone
|
||||
portrait, phone landscape and desktop (en, plus nb for trade/world) in three world states (day 62, day 100+ with held sites, ended); scripted flows with DB
|
||||
assertions (take an offer, post with live validation, cancel, transport to a rival by coordinates, ship, build, scan/attack dialog, tap a site on the map, share
|
||||
and unshare a report, alerts feed, a stale page hitting `world_ended`).
|
||||
- **Push, end to end in real browsers**: Alice raids Bob; Bob's page (real login, WebSocket open) showed the incoming banner, red Moves badge and toast 214 ms
|
||||
after the launch with no reload; the banner went away and the Reports badge rose when the raid arrived. With `WebSocket` undefined, and with a socket that is
|
||||
closed at once (reconnect loop, 7 attempts in the run), the same raid showed up after about 52 s through the REST poll (15 s tick, 45 s gap): worst case about a
|
||||
minute. Confederate Carol gets no push for `alliedIncoming` (known server gap): it shows when the Moves screen is opened or the poll runs, and never in her badge.
|
||||
Found and fixed in the client: `report` pushes now also refetch movements (the incoming banner used to linger up to a few seconds after the arrival).
|
||||
Not done / not claimed:
|
||||
- Not run: real devices, Safari, a socket behind nginx Proxy Manager, throttled networks, the Playwright suite (`e2e/` is still empty), long lists (offers > 25 per
|
||||
filter paged only up to what the sweep seeded).
|
||||
- Ended-world locking is a DOM sweep, not per-button wiring: a new primary/danger button that is NOT a game command must carry `data-keep`. Messages, ranking and
|
||||
settings screens are exempt by selector. Open send/trade sheets that were opened before the end stay usable until the next DOM change or a refused command.
|
||||
- Trade: no order book or price history, no notification for new offers in reach, offers are listed per page of 25 with a cursor only. The landing-site manage sheet
|
||||
does not poll while open (it reloads after your own actions and when the site screen refreshes). Ledger shows the top 15 contributors.
|
||||
- Site numbers are `index + 1` ("Landing site 1..7"), not a name from the server. `backbone_open` is only pushed on first touch (server E2): the countdown flips
|
||||
by the client clock at `opensAt`, the sites appear after the next status fetch.
|
||||
- A transport to a rival's POP is a gift that warns its owner (`incoming`, type hidden); the UI says so, but nothing stops a griefing stream of them.
|
||||
- Server bug found and fixed (tiny): `POST /reports/:id/share` threw a 500 when no `reportCleanup` event was pending (`ensureCleanup` needs `ctx.enqueue`);
|
||||
`reportShare` now wraps its ctx with `ctxOf`, regression test `test/report-share-cleanup.test.js` (failed before).
|
||||
|
||||
## Stage 6 (server half): WebSocket push
|
||||
Built: `/ws` on the game's HTTP server (`server/push.js` transport, `server/pushHooks.js` routing), contract in `docs/PROTOCOL.md`.
|
||||
Auth as first message (`ready` / close 4401), Origin check (`net.originAllowed`), per-IP cap `MAX_CONN_PER_IP` (HTTP 429), 1 KB frames,
|
||||
|
|
@ -173,7 +214,7 @@ Built and tested (`test/trade-*.test.js`, `test/endgame-*.test.js`; fake clock,
|
|||
Not done / not claimed:
|
||||
- **Nothing here is balanced.** Defence multiplier 12 (+3% per level), node cost 4000 x 1.045^(L-1) (about 7.2 M of each resource in total),
|
||||
node time 2 h x 1.025^(L-1) (about 36 world days), 48 h offer ttl, 10 tiles of reach per exchange level, 500-per-side offers: first guesses,
|
||||
no bot run (`tools/bot.js` still does not exist). Whether an alliance can actually ship 7 M of everything in time is unknown.
|
||||
no bot run when written (now there is one: BALANCE.md section 5 says an 18-member alliance needs 55 to 78 days after the sites open with 1000 per link, and does not finish in 175 days with 500).
|
||||
- **No garrison at landing sites** (E1): defence is static, holders cannot station units. If the first world shows the race is decided by who
|
||||
hits first, the next step is a small `site_units` table with reinforce-to-site and defenders in `landing.js`.
|
||||
- No `backbone_open` push at the moment the sites appear unless something touches a site first (E2); clients see the phase by polling status.
|
||||
|
|
@ -182,9 +223,25 @@ Not done / not claimed:
|
|||
- Ended worlds: movements still `out` and queued builds are left as they were (events cancelled, E3); there is no admin "end world now" or
|
||||
"reset" yet (stage 7 world lifecycle: the `worldEnd` event can be enqueued by hand); several winners are impossible by design.
|
||||
- The ranking snapshot is the same numbers as `/rankings`, computed once; `/rankings/*` after the end still compute live from the frozen state.
|
||||
- Client: nothing in `public/` was touched. New notification types (`trade_*`, `backbone_*`, `world_ended`), the `landing` report type, the
|
||||
`backbone` map special / tile, `world_ended` and the new error codes (`trade_ratio`, `offer_closed`, `own_offer`, `trade_out_of_range`,
|
||||
`world_ended`, `backbone_closed`) need strings and screens.
|
||||
- Client for all of this: see "Client: trade, end game, alerts" above.
|
||||
|
||||
## Stage 7 (first part): bot harness and first balance pass
|
||||
Built: `tools/bot.js` (+ `tools/bot/*`): N headless bots (builder, raider, conqueror, turtle, expander, trader, alliancer; a coordinated alliance
|
||||
plays the end game) against the real server in-process (`createServer` with an in-memory DB and a FakeClock, bots drive `srv.commands.run`, no
|
||||
HTTP), 50 players x 14 days in ~3 s, x 170 days in ~140 s. Per-day economy, progression, combat, trade, alliance, end game, performance and
|
||||
error tables; `--json`, `--set PATH=VALUE` data overrides, `--sessions-per-day`, `--always-on`, `--speed`, `--strategy-mix`. Exit code 1 when an
|
||||
invariant breaks: exact resource conservation (production measured at every settle, sinks from command results and notifications), exact unit
|
||||
conservation, no negative stock, no failed events, no unexpected error codes. `docs/BALANCE.md` has the method, every run behind a number, what
|
||||
was tuned and what was not.
|
||||
Tuned (each with before/after runs in BALANCE.md): second build slot at Core router 3 (was 10), transport capacity 1000 per link (was 500).
|
||||
Server fix found by the harness: bounced shipments reported no overflow (`events/return.js`).
|
||||
Tests: `test/bot-run.test.js` (12 players x 6 days twice, identical stats, invariants, the checks catch tampering, a fast world reaches the end game),
|
||||
`test/bot-server-fixes.test.js`.
|
||||
Not done / not claimed: **the game is not balanced**; the bots are not humans (no reinforcement, recall, messages, sitters; fixed sittings). Open
|
||||
items from the pass: a 3x world's end game is as long as a 1x world's (shipping is per sitting; `capacityPerLink x speed` needs the client to stop
|
||||
reading the constant); trade escrow refunds are clipped at the Rack hall cap silently; raid loot is split evenly over resources and destroyed on overflow;
|
||||
the capital runs out of things to build ~50 days before the backbone opens at 4 sittings a day; a built-up landing site is out of reach of any
|
||||
single-POP army (no garrisons, E1), so there is no fight for a site after the first days.
|
||||
|
||||
## Not done
|
||||
- Everything else. See CLAUDE.md "Working in stages".
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue