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:
jvanvik 2026-10-11 19:05:03 +02:00
parent 249818a7aa
commit b18645dca1
87 changed files with 10201 additions and 71 deletions

View file

@ -109,6 +109,10 @@
editNotes: ['leader', 'diplomat', 'officer'],
broadcast: ['leader', 'diplomat', 'officer', 'member'],
disband: ['leader'],
shareReport: ['leader', 'diplomat', 'officer', 'member'], // put one of YOUR reports into the alliance folder
viewSharedReports: ['leader', 'diplomat', 'officer', 'member'],
unshareReport: ['leader', 'officer'], // plus whoever shared it
backboneBuild: ['leader', 'diplomat', 'officer', 'member'], // start the next Backbone node level on a held landing site
},
allianceBaseSize: 10, // size cap = base + perLevel * Peering office level (best POP of the leader)
allianceSizePerLevel: 2,
@ -235,6 +239,34 @@
researchSpeedMax: 0.5,
};
return { UNITS, UNIT_ORDER, MILITARY, RESEARCH, EXPANSION, TRANSPORT, MOVE_ROLES, INCUMBENT, HOUR_MS, RESOURCES, FORMULAS, FIELD_SLOTS, FIELD_TYPES, FIELD_PRODUCES, FIELDS_PER_TYPE, WILD_SLOTS,
// Trade at the Internet exchange. Offers are "give X of A for Y of B, max distance Z"; each side must fit one transport
// link (TRANSPORT.capacityPerLink). The exchange level sets how far you see and trade (reachPerLevel tiles per level)
// and how many offers you may keep open per POP together with running transports (links).
const TRADE = {
ratioMax: 2, // give/want must lie in [1/ratioMax, ratioMax] (pump-feeding guard)
ttlHours: 48, // an offer expires after this long, divided by world speed
reachPerLevel: 10, // tiles
maxDistance: 300, // upper bound of an offer's max distance
scanChunk: 200, // offers read per round trip when listing (the range filter runs in JS)
};
// End game (backbone race). World age is in WORLD days: real days * world speed.
const ENDGAME = {
openDay: 100, // the landing sites appear at this world age
sites: 7,
graceDays: 2, // after level maxLevel is reached the world ends this long after (divided by world speed)
siteRingMin: 0.35, siteRingMax: 0.8, // landing sites sit between these fractions of the map radius
siteMinSpacing: 6, // tiles between two sites
defenceMult: 12, // incumbent site defence x this = the heavy defence of a landing site
defencePerLevel: 0.03, // + 3% per built Backbone node level (the node is a bigger target)
scanStrength: 40, // a landing site counts as this many scanners when scanned
maxLevel: 100, // = BUILDINGS.backbone_node.maxLevel
costGrowth: 1.045, // level L costs BUILDINGS.backbone_node.cost * costGrowth^(L-1) of each resource
timeGrowth: 1.025, // level L takes BUILDINGS.backbone_node.time * timeGrowth^(L-1) seconds at 1x
notifyEvery: 10, // alliance members hear about every n-th level (and the last one)
rankingTop: 100, // final snapshot: entries per list
};
return { UNITS, UNIT_ORDER, MILITARY, RESEARCH, EXPANSION, TRANSPORT, MOVE_ROLES, INCUMBENT, TRADE, ENDGAME, HOUR_MS, RESOURCES, FORMULAS, FIELD_SLOTS, FIELD_TYPES, FIELD_PRODUCES, FIELDS_PER_TYPE, WILD_SLOTS,
SOCIAL, BUILDINGS, START, TILE, PROTECTION_HOURS, AS_RANGE, WORLD_DEFAULTS };
}));