Getting Started
1. Create the economy
The only types you touch are EconomyConfig (struct) and Economy (class).
2. Register commodities and markets
basePrice is the price when stock is balanced with targetStock. Below the target it gets more expensive; above it, cheaper.
3. Trading
A trade is a movement of goods, so it is inflation-neutral.
If stock is insufficient, it fills partially instead of throwing. Check the actual filled amount with r.Success and r.Quantity.
4. Production/consumption loop
A recipe turns input commodities into outputs each long tick. With empty outputs it acts as pure consumption (e.g. population eating food).
5. Inter-node trade
Stock equalizes between nodes connected by a trade route, flowing from surplus to deficit nodes — simulating AI caravan arbitrage.
6. Inflation management (source / sink)
Just tell it when goods are created from nothing (faucet) or permanently removed (sink), and inflation correction happens automatically inside.
7. Advancing time
If you need determinism in multiplayer (lockstep / Quantum, etc.), use manual Tick + equation-based simulation. Tick produces the same result for the same input.
If auto-tick is more convenient, new Economy(config, autoTick: true) makes a hidden runner call Tick every frame. In that case, call economy.Dispose() on shutdown to clean it up.
See the API reference for the full surface.