Economy & Trade

Item valuation, trade offers, inventory management, and crafting recipes grounded in simulation supply and demand.

What this uses

src/sim/nutrition.ts src/sim/substance.ts src/sim/collective-activities.ts src/sim/world.ts src/sim/entity.ts tools/vertical-slice.ts

Economy is a host-level domain. Ananke provides the physical substrate — nutrition depletion, injury recovery costs, material supply — from which economic pressure emerges. Item mass, material properties, and energy costs inform valuation. The host implements price signals and trade resolution.

Tier 3 — planned A formal economy API is not yet implemented. These previews show typical host-side usage patterns.

Item catalogue — static preview

static preview
ItemBase valueMassCategory
arming swordq(0.55) AU800 gweapon
longswordq(0.80) AU1 400 gweapon
daggerq(0.18) AU300 gweapon
shortbowq(0.30) AU600 gweapon
mail hauberkq(1.20) AU9 000 garmour
plate cuirassq(3.50) AU7 500 garmour
leather jackq(0.35) AU2 000 garmour
hardtack (1 day)q(0.02) AU400 gfood
salted meat (1 day)q(0.04) AU500 gfood
iron ingot (1 kg)q(0.12) AU1 000 gmaterial
leather hideq(0.08) AU800 gmaterial

AU = arbitrary units relative to a base daily wage of q(0.03) AU. Values are illustrative; host sets its own currency base.

Trade offer evaluator — static preview

static preview
give: longswordreceive: 2× mail hauberksfair
give: 10× hardtackreceive: daggerslightly unfavourable
give: plate cuirassreceive: arming swordbad deal
give: 5× iron ingotsreceive: leather hidefair (material parity)

Crafting recipes — static preview

static preview
arming sword=5× iron ingot + 1× leather4h smith time
mail hauberk=18× iron ingot40h smith time
plate cuirass=12× iron ingot + 2× coal80h smith time
leather jack=6× leather hide8h tanner time
hardtack (7 days)=2× grain + 0.5× salt2h cook time

Craft time feeds into contributeToCollectiveProject from src/sim/collective-activities.ts. Competence attributes affect production speed.

Create / import catalogue items

Define a custom item and save it to localStorage, download as TypeScript, or import from JSON. Contribute new items to the codebase via pull request.

To add a new item to the codebase: download the JSON, add it to src/sim/items.ts (or create if absent), write a test, then open a pull request ↗ with the title feat: add [NAME] item.

Try this

  1. Use src/sim/nutrition.ts to drive food demand — track entity.nutrition.calorieBalance_Q to know when supply is critical.
  2. Link item mass to carrying capacity via entity.carry.currentLoad_kg — overfilled inventories impose speed and fatigue penalties.
  3. See planCaravanRoute in src/sim/collective-activities.ts for supply sufficiency calculations over a multi-day route.
  4. Price volatility: when faction casualties spike, demand for weapons rises and food supply drops — model this with simple Q-value adjustments.