Idle Kingdom Clicker Internals

Governors

Where governors spawn, which traits they can roll, how strong those traits are, what a village takeover costs, and the odds of each, as implemented in Code.dll (GovernorTools, NeutralVillageQuestTools, CreateGovernorBoostsSystem) with the game's BalanceData25 tables.

The trait-pool odds are exact. The combined odds (extra traits, degrees, price factor) come from a simulator below that runs the game's own algorithm thousands of times in your browser.

1. How a governor is made

GovernorTools.CreateGovernorEntityFromSeed @ 0x2630764 · NeutralVillageQuestTools

Each neutral village on a map is a governor slot. A slot offers one governor per window. The governor is generated from a seed (save start time, game time, map, slot), so it's fixed for that window. Two map numbers matter throughout:

current map
the map you're playing, where the village is.
furthest map
the highest map you've reached. Trait unlocks follow this, not the current map.
  1. Class. Food, Material or Science, each with probability 1/3 (NextInt mod 3).
  2. Two base traits. One pick from the class's General pool and one from its Specific pool. Every trait has weight 1, so each pick is uniform over the traits your furthest map has unlocked.
  3. Extra traits (only from map 2 on). A chance roll, which improves with the current map, adds another General + Specific pair and then removes one existing trait at random. That's a net +1 trait, up to 5 traits ("tier 3").
  4. Talent. Each trait's strength is a bell-curve roll around its median, clamped to its range. Your first two furthest maps narrow the range.
  5. Degrees. Only the first and last traits get a degree: Novice, Competent, Experienced, Masterful or Legendary (0–4). It comes from a pool of rolls that grows with how many villages you've unlocked. Degree multiplies the trait's effect ×1 / ×2 / ×4 / ×6 / ×8.
  6. Price. The takeover demands the governor's own resource (Food, Material or Science). The price scales with your prestige within the map's prestige band, and rises for high-degree governors. It's locked when you start the takeover, and the takeover must finish before the slot's window ends.
  7. Level. The governor arrives at the highest level whose level-up cost fits within the takeover price. Each 10% roll then knocks off one more level.

Villages (slots) per map

2. Which traits can spawn

GovernorTools.RollTraitsFromDropTable @ 0x2630B68 · filter: MinMap ≤ furthestMap (1-based)

Every governor rolls once from its class's General pool and once from its Specific pool. A trait is eligible when its MinMap ≤ your furthest map. With equal weights, the chance of a particular trait in the base roll is exactly 1 ÷ (number of eligible traits in that pool). Traits with MinMap 99 are switched off in this data, and the few that unlock at map 7 never appear because the game only has six maps.

Try it
General pool
Specific pool

Highlighted rows were unlocked at exactly this map. Grey rows aren't unlocked yet.

3. Talent

GovernorTools.RollTrait @ 0x2631EA4 · GovernorTrait.GetMin/GetMax · RandomExt.Gauss
lo = max(1.1, round₀.₁(Min)) hi = round₀.₁(Max) if furthest map is 1: keep the middle 1/2 of [lo, hi] if furthest map is 2: keep the middle 2/3 of [lo, hi] talent = round₀.₀₁( clamp( Normal(mean = Median, sd = (hi − lo)/4), lo, hi ) )

Talent is the game's name for a trait's rolled value. The mean is the trait's Median, which usually sits low in the range. The narrowing on maps 1–2 is centred on the middle of the range, not on the median. So early on many rolls hit the narrowed floor exactly, and the top of the range is out of reach until furthest map 3.

Try it

4. Degrees

GovernorTools.RollTraitDegrees @ 0x2631738 · GenerateTraitDegreeDropPoolNew · GetTraitDegreeFromRoll · BalanceTools.GovernorTraitDegreeToMultiplier

The game builds a pool of degree rolls, sorts it best-first, and hands two adjacent entries to the governor's first and last traits. Any traits in between keep degree 0.

poolSize = 2 × (villages on maps 1 … furthest) each roll u ∈ [0,1): u ≥ 0.9998 → 4, ≥ 0.9992 → 3, ≥ 0.99 → 2, ≥ 0.95 → 1, else 0 cap: furthest map 1 → max 1; furthest ≤ 3 or current < furthest → max 2; otherwise max 4 d = furthest − current index = clamp( round(G) + 2d, 0, poolSize − 2 ), G = clamped Normal on [−2d, ⌊d/2⌋] first/last traits get pool[index] and pool[index+1] (90%: first gets the lower one)
On your furthest map
d = 0, so index = 0 and the governor gets the two best rolls from the whole pool. A bigger pool (more villages unlocked) means better best-of-N odds.
On an earlier map
the index slides down the sorted pool by roughly 1.25 × d, so you get worse-than-best rolls. Degrees are also capped at 2.
Effect multiplier
Novice (0) ×1, Competent (1) ×2, Experienced (2) ×4, Masterful (3) ×6, Legendary (4) ×8, applied to the trait's value. The names are the game's own.
Try it
Better of the two degrees
One roll in the pool

5. Odds simulator

Runs CreateGovernorEntityFromSeed → RollTraitsFromDropTable → RollAdditionalTraitsForHigherMaps → RollTraitDegrees → GetValueAdjustFactor

Extra traits remove a trait using Keys.Skip(k − 1).First() with k uniform in [0, count). That's lopsided: the first trait is twice as likely to go and the newest one never goes. Combined with degrees going only to the first and last traits, the odds are easiest to get by running the exact procedure many times. The simulator reproduces the game's dictionary ordering too.

Try it
Number of traits
Price factor (quality surcharge)
Chance of each trait appearing

6. Takeover cost

NeutralVillageQuestTools.QuestResourceDemandForGovernor · UnscaledQuestResourceDemand · ScaleQuestSlotPrice @ 0x26B796C · GetValueAdjustFactor · GetLevelForSlot
band = [ gate(map), gate(map+1) ] log base b = PriceScale(map) Pc = clamp(prestige, band) Pmid = geometric middle of the band t = log_b(Pc / gate) ÷ log_b(gate(map+1) / gate) (0 … 1) price = Mid[slot] × (Pc / Pmid) × Spread[slot]^t × factor factor = 1 + 0.1 × ( Σ score[degree] − D ) score = 0, 1, 5, 10, 20 for degree 0…4 D = number of two independent 5% rolls that hit (0, 1 or 2)
Resource
the governor's class resource: Food, Material or Science. Mid and Spread are set separately for each.
Prestige
your current prestige when the price is worked out. The price grows in direct proportion to it within the band (plus the Spread term). Below the band it's priced as if at the gate. Once you start the takeover, the price is locked.
Level
the highest level L whose level-up cost (Food column) ≤ price, at least 1. Each 10% roll then drops one level.
Try it

Price across this map's prestige band

Log–log scale. The marker is your prestige. Outside the band the price is flat.

7. Trait power once deployed

CreateGovernorBoostsSystem.ApplyTraits @ 0x2680DD8 · VillageGovernorPowerMultiplier · CastleGovernorPowerMultiplier · GovernorTraitLevelScale
power = talent × degreeMult × strength[castle or village level] × levelScale[governorLevel] diminished placement: power = 1 + (power − 1) × 0.25

This applies to Production and Transport traits, the only effects enabled in this data. The boost covers buildings within the castle's or village's range that match the trait's building or terrain filter. Strength is what the game shows as the castle's or village's "Governor effect": it comes from VillageFxInc for a village and CstlFxInc for the castle. The castle's stays at ×1 until level 20. Overlapping governors' boosts on the same building are added together.

How far a castle governor reaches

ApplyCastleGovernors @ 0x26809F0 · BalanceTools.CastleGovernorInfluenceRangeRadius · TerrainTools flood fill · CstlRadIncL
range R = 1 + (number of entries in [20, 25, 30, … 100] that are ≤ castle level)

A castle governor's boost spreads outward from the castle step by step, through tiles you own. It doesn't measure a straight-line distance. Ocean and Desert stop it, and bridges and tunnels carry it across. Every connected building gets the boost: those within R steps get full power, and those further away get the diminished power above (a quarter of the bonus). So R is a full-power range, not a hard limit. R is 1 below castle level 20, goes up by 1 every 5 levels, and reaches 18 at level 100. Tiles next to the castle are step 1, so even a level-1 castle (R = 1) gives full power to its neighbours (confirmed in the game).

Neutral villages block it. Any building within 2 tiles of a village that's still neutral gets no castle governor boost at all, not even the diminished one. The 2 is the Village Center's collection distance, the same area it takes inputs from once you take it over. That's why buildings around a village you plan to take over are harder to supply. (UpdateNeutralVillageCollectionRangeCacheSystem → VillageToolsCache.NeutralVillageCollectionRadius, checked in ApplyCastleGovernors.)

Village governors work differently. They boost the village's own tiles (ApplyGovernorToVillage), so this range doesn't apply to them.

Try it

8. Levelling up

BalanceTools.GovernorLevelupCost(class, nextLevel) · GovernorMaxLevel

Reaching level n costs GovTraitLvlCost[n] in the class's resource (the game looks the cost up by the level you're moving to, and shows the stored level as-is). Governors start at level 1, so the level-1 row is never paid: going from level 1 to 2 costs the level-2 row. The maximum level is 99. Level is worth having because it sets the level scale in the power formula (section 7).

cost(n) = cost(n−1) × 12 most levels = cost(n−1) × 120 reaching 9, 19, 29 … 99 = cost(n−1) × 1.2 reaching 10, 20, 30 … 90

The level scale goes up by 0.1 a level and jumps by about 0.6 at 10, 20, 30 …. The expensive ×120 step comes one level before each jump, so level 9 costs about as much as level 10, and level 10 then brings the bigger scale for only 20% more. Since 99 is the cap, the ×120 step into level 99 isn't followed by a jump at all.

Try it

Cost of every level

What's verified and what isn't