Kneeshaw Developments
Back

The Codex · in development

Per-city markets · supply chains · NPC merchants riding profit

Real markets.Real consequences when you break them.

Every city tracks its own inventory, gold, buy orders, and what's been flagged for sale. NPC merchants find profitable routes between markets and ride them until the profit dies. Famine in one region raises prices in three more — and somebody usually shows up to fix it before you do.

allper-city marketsNPC-runmerchant professiontrackedsupply chainsappliesfaction tax

Faction taxes apply · merchants route around them

HIGHLOWPRICEFAMINESHOCKMARKETSIronhavenAzure BayGoldportSilverspire

Per-city prices · trade routes · live ticks

Ironhaven
Azure Bay
Goldport
Silverspire

How a market works

Each city's Market holds four things: a gold balance, an inventory map of every resource it has, a set of resources flagged for sale, and a list of active buy orders. Cities update these every simulation tick.

  • Buy orders. When a city needs more of something than it has, it posts a buy order with a maximum price per unit. Gold equal to the potential payment moves into an escrow account — the city can't accidentally double-spend it on something else. Any trader can fulfill the order; payment releases from escrow on delivery.
  • Sell orders. When inventory of a resource passes the excess threshold (150 units in default config), the resource gets flagged for sale. Traders see the flag and may buy. Selling automatically removes the flag once stock drops back below threshold.
  • Sales tax. A running 4% tax is skimmed off every transaction. It flows up to the local faction treasury — which is then taxed again at the faction's posted rate.

The full Market struct lives in the C++ World Engine (src/data/Market.h). Cities, factions, and traders all interact with the same object — there is no separate "player economy" running on different rules.

Dynamic pricing

Prices are computed every tick from base price × supply × demand × regional scarcity. There is no "set price" anywhere in the game.

FactorEffect
High supplyPrice ↓ 20–50%
Low supplyPrice ↑ 50–200%
High demandPrice ↑ 30–100%
Low demandPrice ↓ 10–30%
Regional scarcityPrice ↑ 50–300%
Abundance eventPrice ↓ 30–60%

Base prices (per unit, calm market)

From trade_config.json — the anchor prices before supply, demand, and scarcity modifiers.

ResourcePrice (gp)
Crop6
Food (cooked)8
Wood9
Stone10
Hide14
Lumber14
Cloth16
Herbs18
Leather20
Ore22
Potion base25
Coal28
Metal35
Silk45
Obsidian50
Crystal55
Gems60
Enchanted dust80
Mithril120
Dragon scale200

Market parameters (the actual numbers)

The exact values from trade_config.json that drive every market in the world. Listed here so you can predict when a market is going to flip from buying to selling, or when an order is about to expire on you.

  • Excess inventory threshold

    150 units

    When a city holds more than 150 of a resource it doesn't actively need, the surplus is automatically flagged for sale.

  • Buy order ceiling

    75 gp / unit

    The hard cap on what any city will pay per unit through a buy order, regardless of demand.

  • Buy order expiry

    48 hours (172,800 s)

    How long an unfulfilled buy order stays open before it expires and the escrowed gold returns to the city.

  • Default base price

    12 gp

    Anchor price for any resource without an explicit entry in the base-price table.

  • Trader minimum profit

    120 gp

    A trader will not walk a route unless the expected profit clears this threshold after travel cost.

  • Base travel cost

    60 gp

    Per-route subtraction from trader margin. Scales with distance.

  • Convoy capacity

    400 units

    Maximum cargo a single trader convoy can move per trip.

  • Sales tax

    4%

    Skimmed off every transaction. Goes to the local faction's treasury (which scales separately by tax rate).

Production chains

Six headline chains run end-to-end through the economy. Each chain is gather → process → craft, with optional alchemy / enchantment tiers on top. The professions page goes deeper into the per-role detail.

Metal chain

The Empire's industrial backbone. Ore → metal → weapons, armor, tools. Eight tiers — Tin (T1) at the bottom, Etherium (T8) at the top.

  1. 1 · Extract · Miner

    Ore from mining nodes. Tin at 10–15/cycle, Etherium at 1/cycle (90 min).

  2. 2 · Smelt · Blacksmith

    Ore → Metal. Requires coal as fuel. 10% quality loss at Tin, 35% at Etherium.

  3. 3 · Craft · Blacksmith

    Metal + grip/handle/padding → weapons, armor, tools. Tier of metal sets tier of output.

Wood chain

Furniture, building frames, weapons, transport. Eight tiers from Driftwood (T1) to Heartwood (T8). The Verdant Circle controls most ancient forest yields.

  1. 1 · Harvest · Lumberer

    Wood from forest nodes. Driftwood at 15–20/cycle, Heartwood at 1/cycle (100 min).

  2. 2 · Mill · Lumberer / Mason

    Wood → Lumber. 15% waste at Pine, 35% at Heartwood. Waste burns as half-strength fuel.

  3. 3 · Carpenter · Carpenter

    Lumber + nails / fittings → furniture, frames, bows, staves, shields, barrels, carts.

Textile chain

Cloth, silk, padding, soft goods. Less industrial than metal but every faction needs uniforms, banners, and tents.

  1. 1 · Gather · Harvester

    Fiber from plants, hides from hunts, silk from rarer sources.

  2. 2 · Process · Tailor

    Fiber → Cloth, Hide → Leather, raw silk → silk thread. Tannery / Weavery buildings handle this stage.

  3. 3 · Sew · Tailor

    Cloth + leather + dye → garments, padding, banners, tents. Premium grade requires silk.

Food chain

The most populous chain — every city needs food, every day. Drives demand for farmers, butchers, and chefs everywhere.

  1. 1 · Farm / Hunt · Farmer / Hunter

    Crops from farms, meat from hunts. Most volume comes from farms.

  2. 2 · Cook · Chef / Cook

    Crop + meat + spice → Meal. Cooks (a Support profession) produce higher-stamina meals.

  3. 3 · Distribute · Merchant

    Cities with food shortage post buy orders; cities with surplus get flagged for sale. Famine events spike prices.

Alchemy chain

Potions, elixirs, salves. The newest production chain to be implemented — a parallel medical and combat-consumable economy.

  1. 1 · Gather · Herbalist

    Plant herbs from natural nodes. Different aspects (healing, mana, anti-corruption) come from different regions.

  2. 2 · Distill · Apothecary

    Herbs + water → potion base. Ingredient grade scales with herb tier.

  3. 3 · Brew · Alchemist

    Potion base + reagents → finished potion. Combat enhancement and healing effects.

Enchantment chain

The premium overlay on every other chain — magical properties added to finished items. The Arcane Assembly dominates here, dark elves run the runic side.

  1. 1 · Channel · Enchanter

    Gem + essence → enchanted dust / focus stones. Quality scales with gem tier and channeler skill.

  2. 2 · Inscribe · Runecaster

    Dust + rune-paper + a special item → runes that can be bound to gear. Dark elf paired-link glyphs go here.

  3. 3 · Bind · Artificer

    Finished item + rune → enchanted item. Sets, set bonuses, and legendary-tier modifiers happen at this stage.

Industrial buildings

Cities (and player parties) build dedicated processing structures. The build cost is paid out of the city's gold and materials; the building then converts its input resource to its output on a steady tick.

BuildingI/O
SawmillWood → Lumber
SmelterOre → Metal
KitchenCrop → Meal
TanneryHide → Leather
WeaveryFiber → Cloth
MasonryStone → Brick
Jeweler's BenchGem → Jewel
Farm(passive) → Crop
Mine(passive) → Ore

Trade routes

Trade routes are persistent connections between two markets tracked by a single trader (or convoy). A route stores its primary resource, total completed trips, last trade time, a rolling price history, and a profitability flag. Routes that stop being profitable are dropped automatically.

Traders score candidate routes by:

  • Profit margin — highest weight. A trader will not start a route under the 120 gp minimum-profit threshold.
  • Distance — shorter routes are faster cycles. The base travel cost (60 gp) plus distance scaling eats directly into profit.
  • Reliability — a route with many completed trips beats a new one of equal apparent margin.
  • Competition — too many traders on the same route arbitrage the margin away. New traders look for less-contested options.

Geography's Trade routes section maps the four physical-route networks (Imperial Highway, Merchant Navy, Shadow Paths, Sky Routes). Each is a different terrain choice with different speed, cost, and risk profiles.

Faction tax rates

Sales tax is universal (4%). On top of that, the local faction applies its own rate to every market transaction in its territory. Tax rate is the cleanest tell for a faction's economic model.

FactionTax
Shadow Conclave5%
Verdant Circle8%
Silver Hand10%
Merchant Lords12%
Stone Brotherhood14%
Storm Riders15%
Golden Reach16%
Iron Covenant18%
Arcane Assembly20%
Obsidian Throne25%

How crises move through the economy

Because every market reads its own inventory and demand, a crisis spreads as a wave of price changes rather than a scripted event:

  1. A famine event hits a region. Local food supply drops. The WorldEventGenerator tags the region with resource scarcity at severity 0.9.
  2. Local prices spike. Cities post buy orders at the 75 gp ceiling. Traders running nearby food routes recalculate margins and accelerate deliveries.
  3. Adjacent regions feel it. Surplus food gets drawn out, raising prices there too. The wave propagates.
  4. Narrative seeds spawn. The event generator produces quest hooks: "Lithmere Faces Food Shortage" — collect-resource quest type, themes of scarcity and survival. Players see these as available board work.
  5. A faction politicises it. If relations are tense, neighbours may exploit the famine: embargo, raid the convoys, or post emergency aid to buy influence. The simulation handles this; no scripted handler required.

Most quest hooks in the game are spawned this way rather than hand-written. The economy is the procedural quest pipeline.

Trading is hard mode

A player picking up the Merchant profession runs the same rules as the NPC traders, which means:

  • You cannot dump a large stock at one city — the supply modifier crashes the local price as you sell.
  • You cannot stockpile cheap goods forever — buy orders expire after 48 hours, and the city you intend to sell to may run a surplus before you arrive.
  • You cannot chain trivial price differences indefinitely — the 4% sales tax, 60 gp travel cost, and 120 gp minimum profit threshold all combine to kill margins on small arbitrage.

The big wins are crisis routes (high regional scarcity = high tolerances on price), first-mover trade routes (rare resources newly discovered), and long-haul luxury runs (mithril, dragon scale, enchanted dust) where the absolute margin per convoy easily covers the travel cost.

Where to read next

Source: World-Engine — DYNAMIC_MARKET_SYSTEM, INDUSTRIAL_PRODUCTION_FLOWS, building_config.json, trade_config.json. Faction tax rates from MAJOR_FACTIONS_AND_CAPITALS.