select navigate esc close

Ports and trading

twarp ·

Trade routes pay. The ports & trading epic is merged: every port in the universe now carries a live economy, the classic haggle is playable over the protocol, and a Merchant Cruiser flew a buy-low sell-high circuit at a profit against the real server. This is twarp's second playable milestone — the first put a ship in a knowable universe; this one gives it a reason to move.

What runs now

Port economies. Every trading port holds mutable per-commodity stock built on the recovered three-number model — productivity, current stock, and the signed max-price-deviation that doubles as the buy/sell flag. Prices ride the recovered linear curve: full sellers discount, hungry buyers pay over base. Stock regenerates 5% of max per day (the v3.34-attested default), clamped at half of max per accrual. The mechanism recovery behind all of this — the v1 Pascal source, the decoded v3 string table, the provenance tiers — is documented in the previous entry; the engine implements what that entry describes, every constant declared once with its provenance tag.

The haggle. Trading is a negotiation, not a menu. The port issues two to four quotes, opening off its true price; counteroffers converge it; an offer beyond the tolerance band ends the negotiation with the goods consumed and no trade — the classic penalty, faithfully. Frivolous offers re-prompt without cost. Haggle quality pays experience at the recovered tiers. On the wire this is a bidirectional stream: open, counter, and accept frames from the client; quote, accepted, and refused frames from the server, every quote re-rendered from live port state. Closing the stream mid-negotiation abandons the line and takes the journaled penalty with it — a disconnected client cannot dodge a bad haggle.

Class 0 and StarDock. The special ports are open for business. Sol and its siblings sell holds, fighters, and shields on the original seven-day price cycle. StarDock fields the full facility row: the Shipyards with the 16-ship catalog and the original trade-in rule (75% of hull and contents, everything aboard surrendered, the new hull arrives bare), the Hardware Emporium at the prices recovered literally from the v3 string table, and the 2nd National Galactic Bank — deposit, withdraw, and trader-to-trader transfer, no interest, exactly as attested.

Flavor names. The generated universe now names its ports from the combined pool — 2,405 recovered originals plus the 100 buildtall additions — under the recovered decoration grammar. The first flight docked at Basilice and Essex.

The flight

The milestone gate is not the test suite — it is flying the game. The acceptance flight, against the dev server with a fresh identity:

  • Docked at Basilice (Class 5, selling), bought 10 Equipment at 185 — the near-full port's discount visible in the quote.
  • The commerce report held its dock-time snapshot until re-docking showed the depletion — the original's stale-screen behavior, kept.
  • Sold the load at Essex (Class 3, buying) for 478 — a 293-credit profit on the circuit, with one deliberately frivolous highball re-prompting penalty-free along the way.
  • Re-equipped at Sol's Class 0, bought a Marker Beacon at the Emporium's recovered 100-credit price, round-tripped the bank.
  • Rolled the day and watched every depleted line regenerate 5% of max.
  • Restarted the server: credits, bank balance, experience, cargo, day counter, and port stock all came back byte-identical.

That last point is the engine's standing invariant doing its job. Every economic action — each haggle round, each purchase, the daily regeneration itself — is a journaled command in the deterministic engine. The whole economy replays from the journal to the byte, which is also how the previous milestone's saved universe carried straight into this one: the old state replayed into the new format with economics seeded, position and turns intact.

The protocol surface

The wire delta is entirely additive — the frozen v1 baseline never moved. Commerce arrived as new Action verbs (Dock, the Haggle stream, Class 0, Shipyards, Emporium, bank), a full economics readout on GetSelf, and commodity lines on the port report. The reference CLI gained the matching verbs: dock, trade, buy, shipyard, hardware, bank. Any client or bot speaking the published schema gets the same commerce surface the flight used — no screen scraping, the founding premise holding at the second milestone.

Next

Turns and maintenance: the daily bang as a scheduled command, turn accounting, and the housekeeping that makes a running game a persistent world. The regeneration that an admin verb triggers today becomes the clock's job.