Idle Kingdom Clicker Internals

Core formulas

Upgrade costs, building costs, production and prestige, as implemented in the game's own code (Code.dll, class Code.BalanceTools) and fed by its balance data (BalanceData25, build of 20 March 2026, commit e785d5399).

Each section gives the formula, then lets you plug in values. The calculators use the game's real tables, which are embedded in this page.

1. Upgrade cost

BalanceTools.UpgradeCost(type, currentLevel, numLevels) @ 0x284D830 · BuildCostInfo.FindEntry · LevelTierBoosts

Each building has up to three cost components (Food, Material, Science). Each one is a list of bands that start at particular levels. Every level you buy is priced separately and the prices are added up:

cost(ℓ) = BaseCostband(ℓ) × LevelupPowerband(ℓ) ^ (ℓ + 1 − firstStart) × effectMult(ℓ) total = Σ cost(ℓ) for ℓ = current+1 … current+numLevels
ℓ
the level being bought.
band(ℓ)
the last band whose StartLevel ≤ ℓ (the first band if ℓ is below all of them).
firstStart
the StartLevel of the component's first band. The exponent counts from here and does not reset at a new band, so a band boundary is a one-off step in price, not a new curve.
effectMult(ℓ)
×5.4 when ℓ is an effect level (10, 25, 50, 100, 200 … 2000), the levels the game announces as "Level N Effect Acquired". ×100 for University and Academy (every 10 levels) and Village Center (every 5). Always 1 for Castle and Trading Post. Otherwise 1.

A component only adds cost once ℓ ≥ firstStart (the exponent must be ≥ 1). That's how Material appears in a Foraging Hut's price from level 101.

Try it

Price of each single level, levels 1 to

Show as a table

2. Building another copy

BalanceTools.CoreBuildCost(type, amountExisting) @ 0x284D040 · BuildCost(type, 1, 1) routes here

A new building's price depends on how many of that type you already own (n). The game first checks a hand-tuned step table. Past the end of that table it falls back to a formula:

if BuildamountCostSteptable[type] has an entry n: cost = Steptable[type][n] else, for each component whose firstStart ≤ 1 (using its first band): cost = BaseCost × AmountPower ^ n × (1 + AmountFactor × n)

The AmountPower and AmountFactor fields in the balance data are only used here, never for upgrades.

Try it
Next 25 copies

3. Production

BuildingProductionPerSecondBase · PerSecondWithLocalBoosts · BuildingProductionTime · AdjustCellProductionWithGlobalBoosts · AdjustCellProductionWithRoyalEdictsAndGovs · BuildingProductionPerCycle
effects = number of effect levels ≤ level perSecond = Base × level × 2^effects × global × local cycleTime = Timer × 0.5^effects perCycle = perSecond × cycleTime global = (1 + 0.1 × prestige) × other global boosts local = (Royal Edicts and governors on this tile)
Base
BuildingProductionBaseTable, per unit of level, per second.
Timer
ProductionTimerTable, seconds per cycle before any effect level.
2^effects
each effect level (10, 25, 50, …) doubles the rate and halves the cycle time. Per-cycle output (before boosts) is therefore Base × level × Timer at any level: effect levels make cycles come faster, not bigger.
global
all active global boosts, mostly multiplied together (one ID-prefix group is summed first). Prestige is one of them (the game's Economy Boost).
local
governor boosts on the tile add together; Royal Edict boosts multiply.
Try it

4. Prestige

BalanceTools.ComputePrestigeGainedOnReset @ 0x2851960 · ComputeTotalPrestigeResourceFactor · ComputeTotalPrestigeLandFactor · ComputePrestigeProductionBoost @ 0x28521A8

Prestige gained on reset

Total = PrestigePerLand × land × resourceFactor × landFactor resourceFactor = f_Food(collected Food) × f_Material(collected Material) × f_Science(collected Science) landFactor = PrestigeTileCountTiers[map](land)
PrestigePerLand
1.0 in this data.
collected X
total of that category collected this run (totalResourcesCollectedInRun).
f(x)
a tier lookup: the factor of the highest threshold ≤ x, or 1 below the first threshold. Food's first thresholds are 10M → ×1.2, 1.72B → ×1.4, 3.79B → ×1.6.
land
the land you've claimed on the current map, as the game shows it (castle and free tiles included).
landFactor
the same lookup on the current map's land table (map 1: 10 land → ×2.0, 15 → ×2.1, …).

What prestige gives you

Economy Boost = 1 + PrestigeProductionBoost × prestige = 1 + 0.1 × prestige

The game's reset screen puts it as "each point increases production, transport and research speed by 10%". In the code it multiplies production and transport capacity, and research speed follows from transport, because research runs on the Science that carts deliver to Universities.

Try it
Numbers use idle-game notation: K, M, B, T, then aa = 1015, ab = 1018 … az, ba …, each step ×1000. Inputs accept these suffixes (5B, 2.5aa, 40K) or plain numbers.

What's verified and what isn't