Formula for City-State tribute values?

I'd like to know what the mathematics are of the numbers seen in this screenshot. For example, how is "Overall Military Power" and "Military Near City-State" calculated? Are there upper limits?

Screencap of citystate diplomacy screen


Solution 1:

I looked up the factors, which can be found after downloading the SDK (Steam -> Tools -> Sid Meier's Civilization V SDK)

...\steamapps\common\Sid Meier's Civilization V SDK\CvGameCoreSource\CvGameCoreDLL_Expansion2\CvMinorCivAI.cpp

starting at line 7796 (function CvMinorCivAI::CalculateBullyMetric).

First off, the negatives:

  • First off is the base reluctance of -110
  • If your non-war influence is less than -30, take a -300 penalty
  • If you're trying to bully for a unit (aka worker) and the city state is less than size 4, -300
  • Otherwise if you're trying to bully for a worker take off -30
  • If you've bullied the city state within the last 10 turns, -300
  • For bullying within the last 20 turns, -40
  • If the city has an ally, -10
  • If the city has a pledge of protection, -20
  • If the city is militaristic, -10
  • If the city is hostile, -10

And the positives:

  • Overall military power of all remaining major civs is ranked, with the first place getting 100 and the remaining getting decreasing amounts of 100 / [number of civs]. For example, for 5 civs this is 100/80/60/40/20
  • Local military power in a radius of 5 (increases with larger map sizes) around the city state is compared. Depending on the ratio of the power of your units and the city state units, you get 100 / 80 / 60 / 40 / 20 for 3x / 2x / 1.5x / 1x / 0.5x the power

Note that the three -300 penalties effectively means you cannot demand tribute. All of these values are hard-coded and cannot be modified without a DLL mod, with the exception of the non-war influence < -30, which is defined as FRIENDSHIP_THRESHOLD_CAN_BULLY found in

...\steamapps\common\sid meier's civilization v\assets\DLC\Expansion2\Gameplay\XML\AI\GlobalAIDefines.xml

Solution 2:

This post dates of last year, values are no longer the same. (Updating this topic since it is well ranked on Google to avoid misleading people with old data.)

From inspecting the code, here is what changed :

  • Max value is now 75 and not 100 if you are number 1 in military.
  • Max value for military power difference bonus between you and the city state (your troops vs his) is up to 125 now instead of only a 100. In clearer terms you get 125 if your military is 3 times the power of that of the city state. Keep in mind this value is affected by policies such as gunboat diplomacy. Keep in mind also that as far as I can tell, it is also affected by the strength of the city state defense, so it won't be enough to have 3 warriors to his 1 warrior, remember to factor in the city strength as if it was an additional unit.
  • Your current influence with the city state does not give you a bonus, but it can augment the CS resistance somewhere from 0 to -999 if it's negative. (In other words don't walk inside their borders if you'r planning to demand tribute.)
  • The range to get "military near city state" bonus seems to be 7 tiles. This is not from inspecting the code, but from experience and testing. This is the same range the AI considers as "settling in territory we consider to be ours".

An interesting fact about how it is programmed :

  • Values are not recalculated on the same turn, or rather not always, so for best results move your units in range and wait for next turn to see if you can demand tribute or not. If you are experimenting with moving units on the same turn and seeing how that affects the values, results will be unstable.