Phase 2: client military/social screens, WebSocket push, trade + endgame, review findings pending
Built: units/movements/reports/send/expansion screens, alliance/messages/rankings screens, ws client + server /ws push (docs/PROTOCOL.md), Internet exchange trade, backbone endgame + world end, shared reports, buildDone relative levels. Tested: npm test 175/175. Two adversarial reviews found issues (trade-leg recall exploit, __proto__ via validate.js, rankings DoS, static headers, ...): fixes follow in the next commit. NOT done: bots/balance, e2e suite, real-device checks. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q2MJaQ5LXAHzGnTDgceT14
This commit is contained in:
parent
249818a7aa
commit
b18645dca1
87 changed files with 10201 additions and 71 deletions
|
|
@ -148,6 +148,12 @@ A new POP starts at level 0 everything and 1 h of resources. Takeover requires t
|
|||
- Diplomacy states between alliances: war, neutral, non-aggression pact, confederation (can reinforce each other,
|
||||
see each other's incoming). Pacts take 24 h to cancel.
|
||||
- Messages: player-to-player and alliance broadcast, plain text, 2000 chars, basic rate limit.
|
||||
- **Shared report folder (server):** a member puts one of their own reports (any type) into the alliance's folder (`shareReport`); every
|
||||
member reads it (`viewSharedReports`), the sharer or leader/officer (`unshareReport`) takes it out. Sharing pushes the report's expiry
|
||||
out to 14 days from the share (it is one row for everybody) and it goes with the report or the alliance.
|
||||
- **Seeing each other's incoming (server):** members of one alliance and of confederated alliances get `alliedIncoming` in `GET /movements`:
|
||||
movements heading for a partner's POP, origin and ETA only (type, units and cargo hidden), except traffic from operators who are partners
|
||||
of the target themselves (friendly).
|
||||
|
||||
## Trade
|
||||
|
||||
|
|
@ -155,6 +161,22 @@ The Internet exchange lists offers "give X of A for Y of B, max distance Z". Rat
|
|||
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.
|
||||
|
||||
**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:
|
||||
`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.
|
||||
- **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
|
||||
<= links); accepting converts the reservation into the real transport. Direct transports see the reservation as a busy link.
|
||||
- **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
|
||||
ends (`void`) and the escrow stays in the POP.
|
||||
|
||||
## Incumbent (NPC)
|
||||
|
||||
The legacy telco. Holds incumbent sites spread over the map with large static defences that scale with world age.
|
||||
|
|
@ -169,6 +191,33 @@ far more than anything else and requiring resources shipped in from members (tra
|
|||
wins and the world ends two days later with a final ranking. Backbone nodes can be attacked and taken; the level
|
||||
stays with the site. Landing sites cannot be settled, only taken.
|
||||
|
||||
**Clarified (what the server does).** World age is in world days (real days x speed). All numbers below are first guesses, no bot run.
|
||||
- **Sites:** `rules.backboneSites(seed, radius)`: 7 fixed positions, one per sector of the circle (jittered), on plain land between 35% and
|
||||
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
|
||||
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, 500 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
|
||||
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
|
||||
the stockpile when the level starts; any holder with `backboneBuild` may start it.
|
||||
- **Winning:** when a level completes and the node is at level 100, the holder at that moment wins (once per world) and the world ends two world
|
||||
days later (`worlds.end_at`). The winner is final: losing the node during those two days does not change it. If a finished node is taken while
|
||||
nobody held it, the new holder wins.
|
||||
- **Ending:** the `worldEnd` event stores a ranking snapshot (operators by footprint, alliances by the sum, top attackers and defenders by
|
||||
battle points, winner, the sites), sets the status `ended`, and cancels everything still pending in that world. An ended world refuses
|
||||
every game command with `world_ended`; reading (map, reports, rankings, town views, status, results) and chatting (messages, marking reports
|
||||
read) keep working.
|
||||
|
||||
Rankings throughout: operators by footprint, alliances by sum, attackers/defenders by points from battles.
|
||||
|
||||
## Fairness and anti-frustration
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue