Phase 4: close loot/refund leaks, landing-site garrisons, speed-scaled shipping, update/offsite tooling, broad e2e
Built: - Economy: raid loot capped to the room the raiders have at home (rest stays with the victim, "lootLeft" in the report); trade escrow reserves its room so refunds always fit; trade accept refuses with no_room_for_goods when the goods would not fit. Loot destroyed per 30-day run 31-61k -> ~1k, refunds clipped ~27k -> 0 (docs/BALANCE.md, 3 seeds). - End game: members of the holding alliance garrison landing sites (migration 005_site_garrison.sql), garrison counts in site defence, 72 h capture shield, withdraw route, POP view lists garrisoned units. Shipping capacity scales with world speed (3x world: winner 76-98 -> ~30-36 days after sites open). Bot runs show real contests (84-194 attacks on held sites at 1x). - Ops: deploy/update.sh (backup, stop, ff-merge, npm ci --ignore-scripts, health check, rollback), deploy/upstream-offsite (rsync only), admin end-world snapshots results, EPIPE fix, docs/workflows/ filled in. - e2e 62 -> 163 checks: units, raids/reports, alliance+messages, trade, end game, nb, PWA, reconnect, slow polling fallback (opt-in). Two app bugs found: message push ignored, "New" button stayed English. Tested: npm test 274/274, openapi check, npm run e2e 163/163 (137 s), bot runs 50x30d seeds 1-3 and 140-day/60-day speed-3 end-game runs INVARIANTS OK, adversarial review pass (findings fixed or documented). NOT tested: update.sh on a real box (systemd, real npm, runuser; stubs only, shellcheck not installed), garrison card/loot text on a phone, Node 22.13, humans. Known leaks left open and documented (BALANCE S6): loot/shipments can still overflow when stock arrives in flight, bounced backbone shipments lose overflow (reported to the sender). Garrison numbers (heldDefenceMult 2, shield 72 h) are first guesses from 2 seeds. 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:
parent
9104480463
commit
3c23c51902
92 changed files with 4887 additions and 300 deletions
|
|
@ -114,7 +114,8 @@ Movement types: scan, raid, attack, reinforce, settle, takeover, transport (reso
|
|||
target sees an incoming movement with ETA and origin (type is hidden; a successful scan reveals it). Movements
|
||||
can be recalled within the first 90 s.
|
||||
|
||||
Returning units carry loot and come back at the same speed. Units cannot be re-routed while out.
|
||||
Returning units carry loot and come back at the same speed. The one-time Hardware bonus of an incumbent site is delivered in full even
|
||||
onto a full store (stock above the hall size is kept, it only stops growing): a reward that cannot be earned twice never vanishes at the door. Units cannot be re-routed while out.
|
||||
|
||||
## Combat
|
||||
|
||||
|
|
@ -126,8 +127,12 @@ Resolved at arrival, in the event queue, in order. Deterministic given the input
|
|||
spread proportionally across unit types. On a win with exploit kits, one chosen building loses
|
||||
`floor(kits/20)` levels (min 1 if kits ≥ 5).
|
||||
- Raid: both sides lose a fraction only: `losses = ratio^1.5 * 0.5`, so raids are for loot, not for killing.
|
||||
- Loot: winner takes `min(carry, available)` from Fiber/Hardware/Capital evenly, never from Power. Rack hall
|
||||
hides 10% per level up to 50% from raids (the "cold spare" cache).
|
||||
- Loot: winner takes `min(carry, available)` from Fiber/Hardware/Capital evenly, never from Power, **and never more than the
|
||||
raiders' home Rack hall can bank when they are back** (room = hall size minus the stock projected to that moment; a resource with
|
||||
no room is skipped and its share goes to the others). What is not taken stays with the victim and the report lists it as "Left
|
||||
behind" (`lootLeft`). Room already promised to other return legs still on the road to that POP (earlier raids, bounced shipments) is
|
||||
subtracted first, so several raids from one home cannot all count on the same free room; stock that production or a delivery adds on the
|
||||
way is not predicted (BALANCE.md S6). Rack hall hides 10% per level up to 50% from raids (the "cold spare" cache).
|
||||
- Takeover: on a winning full attack with an M&A team present, loyalty drops by `rand(15, 30)` points. At ≤ 0 the
|
||||
POP changes owner, loyalty resets to 25 and grows +1/h. Capital POP (the player's chosen one) cannot be taken
|
||||
over; it can be destroyed to zero loyalty and left. A player's last POP cannot be taken over either.
|
||||
|
|
@ -165,9 +170,12 @@ pump-feeding. Accepting an offer spawns two transport movements. Direct transpor
|
|||
- 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..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 **capped by the Rack hall** (`trade.refund`, review fix R1: stock already above the cap stays, a refund never lifts it further). If
|
||||
the POP's store filled up meanwhile, the clipped part is destroyed without a notice (BALANCE.md S2, open); otherwise nothing is created or lost.
|
||||
- The offered amount is **escrowed**: it leaves the POP when the offer is posted, but **it keeps its room in the Rack hall**: while the
|
||||
offer is open that resource stops filling at hall size minus the escrow (`rules.storageCapOf`; the HUD shows the lower cap). Cancelling
|
||||
or expiry (48 h / world speed) therefore always fits: nothing is lost, and the escrow is no extra storage (review fix R1 stays true: a
|
||||
refund never lifts stock above the hall size). The only case that can still clip a refund is a Rack hall that was shot down below stock +
|
||||
escrow meanwhile; then the part that does not fit is lost and a `trade_refund_clipped` notification says how much (BALANCE.md S2).
|
||||
A delivery of the traded goods onto a full store still loses the overflow and says so (`cargoLost`, as for every transport); accept refuses up front when that is projected.
|
||||
- **Reach:** a POP sees and takes offers of other operators within `min(offer.maxDistance, 10 x Internet exchange level)` tiles. The poster
|
||||
cannot take their own offer.
|
||||
- **Links:** an open offer holds one transport link of the poster's POP in reserve (open offers + running transports + returning carriers
|
||||
|
|
@ -175,7 +183,8 @@ pump-feeding. Accepting an offer spawns two transport movements. Direct transpor
|
|||
- **Accepting** (one transaction): the acceptor's payment leaves their POP as a transport to the poster's POP (needs a free link and the
|
||||
resources there), the escrow leaves the poster's POP as a transport to the acceptor's POP; both arrive after `distance / 12 tiles/h /
|
||||
world speed`. The offer is `accepted`, then `completed` when both have been delivered. A delivery above the receiver's Rack hall cap
|
||||
loses the overflow and says so (the existing transport rule). If the poster's POP is taken over while the offer is open, the offer
|
||||
loses the overflow and says so (the existing transport rule), and accepting is refused (`no_room_for_goods`) when the acceptor's hall is projected
|
||||
to have no room for the goods at arrival (production and cargo already on the way to that POP counted; a projection, not a promise). If the poster's POP is taken over while the offer is open, the offer
|
||||
ends (`void`) and the escrow stays in the POP.
|
||||
|
||||
## Incumbent (NPC)
|
||||
|
|
@ -197,16 +206,33 @@ stays with the site. Landing sites cannot be settled, only taken.
|
|||
80% of the map radius, at least 6 tiles apart, never in the free centre. They exist from the start (spawning and settling refuse them),
|
||||
the tile reads `backbone` from day 100 / speed (`rules.tileAt(seed, radius, x, y, ageDays)`; without the age argument terrain is unchanged).
|
||||
- **A site is not a POP** (DECISIONS E1): it has a holder alliance, a Backbone node level, a stockpile of Fiber/Hardware/Capital and at most
|
||||
one level in progress. No units can stand there, so a site is defended by a static value only:
|
||||
`defence = incumbentDefence(seed, x, y, age) x 12 x (1 + 0.03 x node level)`. At day 100 that is about 40 000 with no node, 160 000 at
|
||||
level 100 (a Script crew attacks with 40).
|
||||
- **Taking:** `scan` and `attack` only (no raid: the stockpile would be lootable; no takeover, no reinforce, no settle). The attacker must be in
|
||||
one level in progress. Its defence is a static value plus a **garrison** (below):
|
||||
`static = incumbentDefence(seed, x, y, age) x M x (1 + 0.03 x node level)` with M = 12 while nobody holds the site (the opening scramble)
|
||||
and M = 2 once an alliance does (`ENDGAME.defenceMult`, `ENDGAME.heldDefenceMult`; DECISIONS E6). At day 100 an unheld site is about
|
||||
40 000, a held one about 7 000 at node level 0 and 28 000 at level 100 (a Script crew attacks with 40).
|
||||
- **Garrison** (E6): members of the holding alliance (nobody else) can `reinforce` a site they hold: the units move in, count in its defence at
|
||||
their owner's research, and keep drawing power from THEIR OWN POP (a site has no power budget; offline POP = offline units, decommission
|
||||
takes them out of the garrison too). They leave by `POST /backbone/:id/withdraw` (owner only, any time), automatically when their owner
|
||||
leaves or is kicked from the alliance, when the alliance disbands, or when the POP they belong to is taken over (a return movement each time),
|
||||
and they die when the site is taken. A static + garrison defence is fought like a POP: a lost attack kills (attack/defence)^1.5 of the
|
||||
garrison, so the next wave in arrival order faces less; the static part loses nothing, so the last wave alone must beat static + what
|
||||
is left. That is what makes a held site contestable by several members (a single POP's army tops out around 60 000 attack), and why
|
||||
`heldDefenceMult` is small: static defence must stay below what one POP can send or a built-up site would be out of reach again.
|
||||
- **Capture shield:** a site that changed hands cannot be attacked for `ENDGAME.captureShieldHours` (72 world hours = 3 world days, / speed):
|
||||
attacks are refused when sent (`site_shielded`) and turned back if the site was taken while they were on the road. Scans and garrisoning
|
||||
are allowed. Without it a light static defence made sites flip every few hours in bot runs; 24 h still flipped them every ~1.7 real days
|
||||
at 3x (BALANCE.md section 5).
|
||||
- **Limit of the static rule:** `incumbentDefence` grows 4 % of its base per world day, so a held level-100 site's static part is ~51 000
|
||||
at world age 240 and ~68 000 at age 330, past what one POP can send (~60 000). The "static below one army" rule has an expiry date
|
||||
(real day ~85 in a 3x world); then only a garrison already worn down by waves can be finished, and a holder with no garrison is the only one beatable.
|
||||
- **Taking:** `scan` and `attack` only (no raid: the stockpile would be lootable; no takeover, no settle; `reinforce` only for the holder, above). The attacker must be in
|
||||
an alliance, and may not be in the holder's alliance or in a NAP / confederation with it (checked when sent and again on arrival, units come
|
||||
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, 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
|
||||
- **Feeding the node:** members of the holder alliance send resources by transport (`POST /backbone/:id/ship`, same links, 1000 per link x the
|
||||
world speed, 12 tiles/h). On arrival they join the stockpile if the sender's alliance still holds the site, otherwise they ride home (`backbone_ship_bounced`). The sender's Rack hall can have refilled while the shipment was away: what then does
|
||||
not fit is destroyed and reported with exact amounts (`movement_returned.cargoLost`); no room is reserved for it (BALANCE.md S6). 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
|
||||
takes `2 h x 1.025^(L-1) / world speed` (level 100: 23 h; about 36 days of world time in total, one level at a time). The cost is paid from
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue