AI File Variables

Defaults are given in bold.

# Inter-Agent distribution variables

flags - these can be used by Events to communicate the state of the game

Examples:

  flags = {
    testflag = yes
    invade_albania = no
    assist_finland = no
  }

max_front_ratio = 4.0 # The max wanted friendly-enemy division ratio along the front
Note: Disregarded if there is only one front in the area. "max_front_ratio" is the maximum ratio of your forces to the enemy's forces for a single front. To put it another way: max_front_ratio is a limit on the ratio of how many divisions the country will deploy via the front AI (not the garrison AI) vs any enemies.

So if you have a max front ratio of 2 and you have a front against 15 enemy divisions the front AI will attempt to deploy no more than 30 divisions vs that enemy front. Garrison divisions do NOT count toward the max_front_ratio.

Once a province becomes part of the front line then the AI ignores it's garrison values for that province. (the Front AI takes over completely for that province)

v1.05c many smaller nations have a value of 3; most are 4; Arg, Bel, Yug 5; USA 6; Sov 8

max_garrison_prop = 0.20 [0.0-1.0] # The war-time desired proportion of troops allocated to garrison duty; v1.05c ranges from 0.2 to 1.0
min_garrison_prop = 0.10 [0.0-1.0] # The war-time minimum proportion of troops allocated to garrison duty; v1.05c ranges from 0.1 to 1.0
# NOTE: In areas without fronts, _all_ land units are controlled by the Garrison AI (except forces preparing for an invasion.)

war = 50 - how aggressive the country is at declaring war?

ferocity = no [yes/no] - unknown? All are "no"

strat_redeploy_threshold = 20 [days] # The ETA at which the AI uses strat. redeploy. In other words if it would take more days than this to make a normal move the unit will be strategically redeployed. v1.05c ranges from 15 to 20; CHC 25; Japan 30; Spain 60; Sinkiang 120

combat = { GER ITA } # declare war on these countries if possible.

influence = { BEL HOL FRA } # influence these nations ahead of others.

#Factors controlling the naval AI
admiral = { # specific provinces can be targetted to get special bonuses..

  target = {
    592 = 200 # patrolling the south north sea have a big priority.
  }

}

#Factors regarding amphibious invasions by ai.
invasion = {
  base = 1.0 # Relative modifier. (lower = specific targets much more important.); v1.05c England and Italy 0.1,
  random = 1.0 # How big a random range. (1.0 = 1%); v1.05c all are 1.0 except Arg 2.0, UK & Italy 8.0, Japan at 50.0
  coastal = 1.0 # increase to avoid coastal forts more. v1.05c UK & Italy are 0, Argentina 5
  beach = 1.0 # higher, avoid worst beaches. v1.05c UK & Italy 0, Arg 2
  distance = 1.0 # higher = avoid long distance. v1.05c UK & Italy 0, Arg 10
  pocket = 1.0 # prioritise pockets, ie provinces with no adjacent controlled by same. This should help eliminate a beach that is an enemy "pocket". v1.05c everyone is 1.0 except Italy at 0.2
  island = 1.0 # prioritise taking pure islands. v1.05c everyone is 1.0 except Eng 2.0, Italy 3.0, Arg 5.0
  enemy = 1.0 # higher = much more wary of troops in province. v1.05c everyone 1.0 except Japan 10.0
  adjacentenemy = 1.0 # higher = much more wary of troops nearby. v1.05 everyone 1.0 except Argentina 4.0

  # specific provinces can be targetted to get higher priority.
  target = {
    898 = 1000 # Invasion of South Sicily (898) has super high priority.
  }
}

# Factors guiding the use of fighters and strategic bombers.
bomber = {

#defensive fighter ai factors
  defensiveIC = 1.0
  recentlyBombed = 2.0 #protect anything bombed.
  protectOil = 1.0
  protectCoal = 1.0
  protectSteel = 1.0
  protectRubber = 1.0

#Evaluation factors for determening which landarea to be strategically bombarded.
  areaSize = 5.0 #size of area.
  areaDistance = 1.0 #distance
  adjacency = 10.0 #if its neighbor to us.

#Evaluate which province to get a bombing mission.
  targetIC = 1.0 #How important are IC to target..
  avoidAA = 1.0 #how bad AA are.
  targetCoal = 1.0
  targetSteel = 1.0
  targetOil = 1.0
  targetRubber = 1.0
  occupied = 25.0 #Subtract for provinces which are occupied, ie bomb germany ahead of france as UK.
  fighter = 1.0 #how important it is to avoid enemy fighters

}

garrison = {

  defend_overseas_beaches = no [yes/no] v1.05c most are no
  key_point_prio_mult = 0 [Value] # Value * key point value in a province = prio for that province; v1.05c all are 0

  beach_1 = 50 # Beach level 1
  beach_2 = 55 # Beach level 2
  beach_3 = 60 # Beach level 3
  capital = 100 # Our capital
  human_border = 210 # Ignored for allied human players - this can be very disruptive and fatal to the AI, this value should always be very low or zero!
  war_target = 100 # The next country targeted for attack by this AI

  opposing_alliance = 100 # For neutrals, all alliances are "opposing"
  claim_threat = 100 # If we are neutral, countries with claims on us get this
  unstable_border = 50 # Bordering countries at war with someone else get this

  war_zone_odds = 2.0 # Default: 2.0 (strive to transport in 2x enemy nr of divisions) (rumor is that this greatly influences invasions); v1.05c all are 2.0

# Basic need is X divisions per area where X is: number of provinces - attrition provinces
  home_multiplier = 0.5 # In home area, multiply basic need by X. Default: 0.5; v1.05c all are 0.5 except Italy at 0.9 and France at 1.0
  overseas_multiplier = 0.333 # In other area, multiply basic need by X. Default: 0.3333; v1.05c all are 0.333 except England at 2.0
  home_peace_cap = 10000 # sets the maximum number of units kept at home during peace; all are 10,000 except England at 25, USA at 10, Japan at 6

# Borders with specific countries
  country_priorities = {
    ENG = 30
    FRA = -1 # Override "opposing_alliance", "claim_threat" and "unstable_border" values and set to 0.
    ...
  }

# Specific provinces
  province_priorities = {
    527 = 50 # Province 527 has prio 50
    ...
  }

  area_multiplier = { # If an area contains a specific province, multiply the basic need by value (overrides overseas_multiplier, but if it is the home area it is ignored.)
    155 = 1.5
    ....
  }

}

military = {

  relative_build_scheme = yes [yes/no] # Should the AI strive to maintain a relative balance between unit types [yes] or simply allocate percentages (see below) of the total production [no]. Default: yes

Relative production seems to be very close to a straight percentage of unit counts (not cost). If a particular type of unit can't be built (like mechanized) the percentage for that type is added to infantry.

# Default Build scheme:
  infantry = 72
  cavalry = 10
  motorized = 5
  mechanized = 0
  panzer = 0
  paratrooper = 0
  marine = 0
  bergsjaeger = 0
  # 87 %

  fighter = 5
  strategic_bomber = 0
  tactical_bomber = 0
  naval_bomber = 0
  dive_bomber = 0
  transport_plane = 0
  torpedo_plane = 0
  # 5 %

  battleship = 0
  carrier = 0
  destroyer = 3
  cruiser = 1
  submarine = 1
  transports = 3
  # 8 %

  # NOTE: The sum _must_ be exactly 100%!
}

front = {
#Unit strength estimation... 1.0 is default.. increase to put more emphasis on value etc..
  strength = 1.0
  organisation = 1.0 # raise this to make the AI more intelligent handling inf vs armor
  dig_in = 1.0 # only applied for defender.
  soft_attack = 1.0
  hard_attack = 1.0
  ground_defense = 1.0

# the following is to reduce odds-strength for attacker. Reduce these values to discourage this type of attack.
  river
= 0.5 Warning: v1.06 bug - the withdraw_odds variable is saved as the river variable
  frozen_attack = 0.7 # <1.0 to discourage 1.0 = no difference.
  snow_attack = 0.6
  blizzard_attack = 0.4
  storm_attack = 0.6
  muddy_attack = 0.6

# the following modifies the odds-strength for defender. (1.0 = no difference.)
  largefort = 1.0 #for forts above level 6.
  smallfort = 1.0 #for forts 6 and below
  occupied = 0.8 #for surrounded pocket at enemy territory
  owned = 0.5 #for surrounded pocket at own territory (v1.05c everyone is 0.5)

#reduces the size of odds in total.. (1.0 = no difference, 0.5 = halved.
  jungle_attack = 0.5
  mountain_attack
= 0.5
  swamp_attack = 0.66
  forest_attack = 0.75
  hill_attack = 0.80

  recklessness = 1 [0-3] (v1.05c Italy and Russia (3) are most reckless, Japan, UK, Belgium, Afg next at 2.
  enemy_reinf_days = 6 # Count enemy units less than X days from a target province in odds calculations. v1.05c almost everyone at 6 except Turkey 12 (Australia, Canada, New Zealand, South Africa at 7)
  reserve_prop = 0.20 [0.0-1.0] # Proportion of front troops that should behave as reserves. v1.05c everyone 0.2 except Turkey at 0.3

  panic_ratio_vs_ai = 1.5 # Front requests more troops if outnumbered by this factor. v1.05c Germany and Soviet 2.0, Australia, Canada, NZ, SAF 1.0
  panic_ratio_vs_human = 1.0 # Front requests more troops if outnumbered by this factor. v1.05c basically as above relative to vs_ai except Germany is 1.0

  base_attack_odds = 2.5 # Will attack at X odds or better. v1.05c everyone 2.5 except Australia, Canada, New Zealand, South Africa, Germany, Soviet Union
  min_attack_odds = 1.0 # If stalemated for a long period, may go as low as these attack odds. v1.05c all at 1.0
  max_attack_odds = 3.0 # Don't use more force than necessary to reach these odds. v1.05c Soviet is 4.0
  reinforce_odds = 1.0 # Send in more troops if the attacking force is at these odds. v1.05c all at 1.0
  withdraw_odds = 0.5 # Break off attacks and withdraw at these odds (v1.05c all at 0.5)
Warning: v1.06 bug - the withdraw_odds variable is saved as the river variable
# NOTE: the calculations for retreating from _defensive_ positions are too complex to condense to a few variables
# NOTE: will _also_ retreat if the average organization is too low

  distrib_vs_ai = reactive [even/reactive]
  distrib_vs_human = reactive [even/reactive]

# Countries we do not counter-attack for a certain number of days
  enemy_handicap = {
# NOTE: These values are ignored for human-controlled enemies.
# CAUTION: Values apply for _every_new_ war with a set nation.
    ENG = 100
    FRA = 120
    ...
  }

  passivity = { # Against specified enemies.
# Valid values: 0-100 (%)
    ENG = 0
    FRA = 50
    ...
  }

}

construction = {
  max_factor = 0.10 [0.0-1.0] # Proportion of all _national_ provinces that may construct improvements at the same time

  max_AA = 4 # Max number of provinces that may construct AA batteries at the same time

  AA_batteries = no [yes/no/atwar/not_atwar] # yes = all the time, no = none, atwar = build during wars, not_atwar = build during peace
  max_AA_level = 10 # Don't improve AA beyond this level.

  coastal_fort = no [yes/no/atwar/not_atwar]
  max_coastal_level
= 5 # Don't improve coastal forts beyond this level.

  fort_borders = { # Build land forts along these borders
    GER
    ITA
    ...
  }
  max_land_level = 5 # Don't improve land forts beyond this level.

  ic_at_war = no [yes/no] # Normally, we always build IC if there is a large resource surplus. The exception could be during wars.

  force_ic_until = 1900 # Ignore presence of a resource surplus and build IC anyway, until year X. (Useful for countries anticipating expansion.)

  ic_end_year = 1939 # Stop building IC at the end of year X.
}

#factors to modify for technological development.

technology = {
#list of endgoals to achieve.
  endgoal = { ... } # these don't seem to be very useful

#list of techs to give bonus priority too.
  preference = { ... } # extremely valuable to make the AI research more intelligently
The assumption is that techs listed in the preference section will be researched ahead of other techs in the same field. For instance: if 15 ICs are being allocated to Electronics it will use those to research the techs listed (in order) in the preference section. If all "possible" techs in the preference section are already researched for the current level and the AI is waiting on researching the next level then it'll start filling in with non-preference techs.

"Level" techs will not be researched unless they specified as a priority or all other techs in lower levels are already researched!

Note: if the R&D priority is great enough to call for additional research and a "level" tech is being researched, lower level apps will be researched even though they are not specified as a preference!

#preference to weight importance of research in these fields - note only the integer value is really used
Basically what happens here is the number of techs already known is divided by this number to get a ratio, the lowest ratio gets the highest priority for research.
  electronics = 1
  armor = 0
  infantry = 3
  industry = 1
  rocket = 0
  nuclear = 0
  heavy_aircraft = 0
  light_aircraft = 0
  naval = 0
  submarine = 0
  artillery = 1
  naval_doctrine = 0
  land_doctrine = 1
  air_doctrine = 0
}