Trade & Embargoes: bilateral trade agreements (both economies grow) + embargoes (target economy decays) #58

Closed
opened 2026-10-15 17:05:42 +02:00 by kamilkrzywda · 0 comments
Owner

What

Add an economy interaction layer: nations can enter trade agreements (both economies grow over time) and impose embargoes (the target's economy decays).

Mechanism

  • TurnResult gains economy: { trade: { a: string; b: string }[]; embargo: { from: string; target: string; lift?: boolean }[] } — required, default []s.
  • GameState gains trades: [string,string][] and embargoes: {from:string;target:string}[]. On each committed turn, the engine applies: each active trade → a small economy stat increase to both parties (clamped); each active embargo → a small economy decrease to the target.
  • A war between two trading nations can auto-suspend the trade (or the LLM can declare it).
  • Ties into per-region stats: trade bonuses can also be applied at the region level for owned regions.

Acceptance

  • e2e safety (critical): stub returns economy: { trade: [], embargo: [] }, deterministic; additive (legacy games load with empty lists); must not break the UK-in-wwii-1939 e2e (empty frontier, military 80→85, 7-item legend).
  • Unit tests in server/engine.test.ts (trade growth, embargo decay, war-suspension).
  • System prompt documents economy; user prompt carries active trades/embargoes. Version bump at PR time.
## What Add an **economy interaction** layer: nations can enter **trade agreements** (both economies grow over time) and impose **embargoes** (the target's economy decays). ## Mechanism - `TurnResult` gains `economy: { trade: { a: string; b: string }[]; embargo: { from: string; target: string; lift?: boolean }[] }` — required, default `[]`s. - `GameState` gains `trades: [string,string][]` and `embargoes: {from:string;target:string}[]`. On each committed turn, the engine applies: each active trade → a small `economy` stat increase to both parties (clamped); each active embargo → a small `economy` decrease to the target. - A `war` between two trading nations can auto-suspend the trade (or the LLM can declare it). - Ties into per-region stats: trade bonuses can also be applied at the region level for owned regions. ## Acceptance - **e2e safety (critical):** stub returns `economy: { trade: [], embargo: [] }`, deterministic; additive (legacy games load with empty lists); must **not** break the UK-in-`wwii-1939` e2e (empty frontier, military 80→85, 7-item legend). - Unit tests in `server/engine.test.ts` (trade growth, embargo decay, war-suspension). - System prompt documents `economy`; user prompt carries active trades/embargoes. Version bump at PR time.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: OpenCode/History#58