Idle Kingdom Clicker Internals
How raw goods turn into Food, Material and Science, what every recipe consumes and produces, how much value each step adds, and how the game plans its carts. Built from Code.dll (BalanceTools, ResourceTools, EconomyResolver, EconomyNetworkNode) and the BalanceData25 tables.
Food, Material and Science aren't stockpiles of their own. They're virtual totals: every good sitting in storage counts towards its category at a fixed exchange rate.
The same sum is used for the totals you see (UpdateTotalAvailableResourcesSystem), for deciding whether you can afford something (CanPayFromGlobal), and for prestige's "collected this run" (TrackTotalAmountCollectedInRunSystem). When you spend Food, carts draw real goods out of storage at the same rate (ResourceCollectorTools.LoadResources). So a good's value is exactly what one unit is worth everywhere in the economy.
"Routing value" is the solver's value (section 5). It only decides what carts prioritise, never what anything is worth.
How to unlock the producer is the research that unlocks the building that makes each good (research page). The research's tier and its first-level Science cost show roughly when in the game it comes within reach. Four researches are yours from the start (Castle Construction, Foodstore, Foraging Hut, Grassland Dwelling), and a few unlock free as your castle levels up. Some producers also need a deposit or a terrain you can claim.
Each good has exactly one producing building, and no chain crosses categories. Arrows show how many units per second one level of the consumer takes. Hover a building to highlight its supply chain.
A refinery's inputs scale exactly like its output, with the same level, tier doubling and boosts (ConverterConsumptionWithAllBoosts applies the same global and local adjustments). So its input:output ratio is fixed at every level, and boosts don't make a converter more efficient, only bigger. The table shows rates for one level at tier 0, valued with section 1's exchange rates.
Net = output value − input value, per second per level. Refineries only count if their inputs actually arrive. Input values are what the consumed goods would have been worth left in storage.
Pick a building and its level. The calculator follows the chain upstream and works out how much of each input it needs. It expresses that as level-units of the supplying building, where one level-unit means 1 level at tier 0; a level-L building with t tiers supplies L × 2^t of them. It then converts that into a number of suppliers at the level you choose.
The game doesn't move goods with simple rules. Every time the economy is re-planned, EconomyResolver builds a linear program over your whole network and solves it with the bundled COIN-OR CLP solver (libclp.so). Each building contributes columns (variables) and rows (constraints):
resourceLimitTable), flow preservation per route, and refinery input ratios.CreatePerResourceSurplusColumns: weights −4, −2, −2 and −1 in a minimised objective). Food, Material and Science themselves have routing value 0.The routing values form a ladder. Most distinct steps are ×1.5 (some goods tie), and the jumps get much bigger among the top-tier goods (Elixir → Ink is ×22). So when transport capacity is short, the solver serves higher-tier goods first. That's a priority order, not a price: the real worth of goods is section 1's exchange rate.
Oil has a Science value but no producer or consumer. ResourceValueSalesMods (1, 4, 3.5, 3, 0.9) wasn't traced.