1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Turns of Anarchy length formula

Discussion in 'Civ4 Strategy Articles' started by T-hawk, Nov 17, 2009.

  1. T-hawk

    T-hawk Transcend

    Joined:
    Feb 14, 2002
    Messages:
    2,579
    Location:
    Hoboken NJ / NYC
    I searched for this, but couldn't find it, so took a code dive to post it here. Here is the formula for turns of anarchy length when changing civics. The code is at getCivicAnarchyLength in CvPlayer.cpp. [] means round down to integer. This assumes anarchy is actually occurring, of course; no Spiritual trait or Golden Age or Cristo Redentor.

    [([(1* + CivicsChanged** + [Cities × MapFactor / 100]) × SpeedFactor / 100]) × StartingEraFactor / 100]

    * This is BASE_CIVIC_ANARCHY_LENGTH from GlobalDefines.xml. It is 1 in the standard unmodded game.

    ** This is defined per each civic in CIV4CivicInfos.xml. Every civic is 1 in the standard game.

    MapFactor is from iNumCitiesAnarchyPercent in CIV4WorldInfo.xml.
    11 Duel
    10 Tiny
    9 Small
    8 Standard
    7 Large
    6 Huge

    SpeedFactor is iAnarchyPercent in CIV4GameSpeedInfo.xml.
    67 Quick
    100 Normal
    150 Epic
    200 Marathon (yes another factor that favors Marathon for HOF type score play)

    StartingEraFactor is iAnarchyPercent in CIV4EraInfos.xml
    50 Ancient
    50 Classical
    40 Medieval
    40 Renaissance
    34 Industrial
    34 Future
    34 Modern

    The function also multiplies the anarchy time by 1 + m_iAnarchyModifier (by calling getAnarchyModifier()) but it seems that this is always zero in the unmodded game. So here is a short version omitting some of the rounding and divisions by 100 and assuming an ancient start:

    (1 + Civics + [Cities × MapFactor / 100]) × SpeedFactor × 0.5

    I'll elaborate a little more on that one factor of [Cities × Map factor / 100]. This is what makes civic changes take longer later. It is not due to the game date or to any previous civic changes; it is driven only by your number of cities. Every N cities counts as one additional "ghost" civic change. On a normal map, it's every 100 / 8 = 12.5 cities. So your 13th city, 25th, 38th, 50th, and so on each cause extra anarchy.

    This explains why you can change 2 civics in 1 turn on normal speed, but not epic speed (assuming no city count penalty.) On normal speed, the anarchy length comes out to (1 + 2 + 0) × 1 × 0.5, which is 1.5 rounded down to 1. On epic speed, the same operation comes to (1 + 2 + 0) × 1.5 × 0.5 = 2.25 rounded down to 2.
     
  2. Sawney Bean

    Sawney Bean Chieftain

    Joined:
    May 31, 2009
    Messages:
    43
    Thanks for this. I was considering posting a question in the strategy section on just this very point. Your explanation has saved me the bother :goodjob:
     

Share This Page