Modding AIs
Default values used as examples
General factors
max_front_ratio = 4 # 4-1 odds
This is the Maximum odds that a Front is considered to need against an enemy, which affects the number troops it receives
max_garrison_prop = 0.2 # 20% min_garrison_prop = 0.1 # 10%
These two govern the proportion of troops that is given to Garrison duty in war time
war = 50
The "war monger" value affects the propensity of a country for declaring wars
neutrality = 0 # Total neutrality at about 100 to 150
The tendency of a nation to create and accept alliances, and accept military access. The higher the value, the more "neutral" the nation. NOTE: this does not affect the tendency of a nation to start wars.
ferocity = no
If 'yes', makes a country want all or nothing in peace negotiations
combat = { }
Country tags listed here are considered our ancestral enemies and the scum of the Earth
protect = { }
Country tags listed here are considered within our 'sphere of influence'. We will strive to guarantee their independence.
befriend = { }
Country tags listed here are considered our natural allies. We will try to befriend and ally with them.
admiral = { target = { 837 = 1000 # Venezia 741 = 200 # North Adriatic Sea } }
List province ID's here that you wish the AI to defend with it's navy. Province ID's can be harbours or sea zones. Beside the province ID is a number which defines how much of a priority that harbour or seazone is to the AI. The higher the number, the more important it is.
Invasion AI factors
invasion = {
To start off this section.
base = 1.000
Relative modifier (lower = specific targets much more important).
random = 1.000
How big a random range (1.0 = 1%).
coastal = 1.000
Increase to avoid coastal forts more.
beach = 1.000
Higher to avoid worst beaches.
distance = 1.000
Higher to avoid long distance.
pocket = 1.000
Prioritise pockets, i.e. provinces with no adjacent controlled by same.
island = 1.000
Prioritise taking pure islands.
enemy = 1.000
Higher means much more variation of troops in province.
adjacentenemy = 1.000
Higher means much more variation of troops nearby
target = { 837 = 1000 # Venezia 769 = 1000 # Trieste 907 = 500 # Split }
List of target provinces with their priority given. The higher the number the greater a priority that target province is.
}
To close off this section.
Front AI factors
front = {
To start off this section
recklessness = 1
Value from 1 to 3 detemining the recklessness of the Front AI.
enemy_reinf_days = 6
Count enemy units less than X days from a target province in odds calculations
reserve_prop = 0.2 # 20%
Proportion of troops in the front held as reserves.
panic_ratio_vs_ai = 1.5
Front requests more troops if outnumbered by this factor by AI nations
panic_ratio_vs_human = 1
Front requests more troops if outnumbered by this factor by human nations
base_attack_odds = 2.5
Will attack at these odds or better
min_attack_odds = 1.000
If stalemated for a long period, may go as low as these attack odds
max_attack_odds = 3.000
Don't use more force than necessary to reach these odds
reinforce_odds = 1.000
Send more troops into embattled provinces if the attacking force is at these odds or more
withdraw_odds = 0.500
Break off attacks and withdraw at these odds
distrib_vs_ai = defensive distrib_vs_human = defensive
Distribute front forces using the 'defensive', 'even' or 'reactive' schemes:
- 'Reactive' attempts to match enemy strengths
- 'Even' ignores the enemy and tries to maintain an even distribution of troops along the front.
- 'Defensive' distributes forces according to the industrial/national value of the provinces.
enemy_handicap = { ENG = 100 FRA = 120 }
Countries we do not counter-attack for a certain number of days. NOTE: These values are ignored for human-controlled enemies. CAUTION: Values apply for _every_new_ war with a set nation.
state_multiplier = { 122 = 20 # +20 prio for all provinces in the state that contains province 122 }
Extra front priority for certain states. Only used by the 'defensive' distribution scheme. NOTE: These values are added to the normal priorities. For comparison, each POP is worth 1, each factory 4, the capital 20.
}
Remember to close the section as well
Garrison AI factors
The Garrison AI assigns a priority to each province within the domain. It then adds the priorites of all provinces and attempts to distribute a number of divisions to each province that corresponds to PROV_PRIO / TOTAL_PRIO. The Garrison AI is also responsible for balancing troops between overseas areas.
Province Priorities
garrison = {
To start off this section.
capital = 100
The priority of our capital city.
human_border = 200
The priority of provinces along borders with human players (ignored if they are allies).
war_target = 100
The priority of provinces along borders with the country we intend to attack soon.
claim_threat = 100
The priority of provinces along borders with countries that are pissed because we hold some of their national provinces.
militancy_multiplier = 5.000
Multiplier on the revolt risk in provinces. The prio of these provinces is X * revolt risk.
country_priorities = { ENG = 100 FRA = 120 }
Overrides all other border priorites and set priorities against specific countries.
province_priorities = { 1345 = 100 # Province 1345 gets prio 100 }
Override all other priorites and set for specific provinces.
Overseas Troop Allocation Factors
war_zone_odds = 2.0
In overseas warzones, we want these odds against enemy forces.
home_multiplier = 0.5
If we have overseas areas, multiply our home need by this.
overseas_multiplier = 0.33
Peace time multiplier for overseas areas.
area_multiplier = { 1345 = 0.5 # overseas_multiplier in the region containing province 1345 set to 0.5 }
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).
home_peace_cap = 10000
No more divisions than this should remain in our home area in peace time .
}
To close off this section.
Military AI factors
military = {
To start off this section.
relative_build_scheme = [yes/no]
If set to yes then the AI will strive to maintain a relative balance between unit types. If set to no then the AI will simply allocate percentages (see below) of the total production.
NOTE: The default is "yes".
desired_army_size = -1
May specify a certain number of divisions. -1 is dynamic scheme which will make the AI build as many military units as it can.
desired_navy_size = -1
May specify a certain number of ships. -1 is dynamic scheme which will make the AI build as many military units as it can.
mob_inf_perc = 75.000
Percentage of infantry divisions that should be built to the mob pool.
Force composition that the AI should strive to uphold in the military
#LAND: infantry = 40 cavalry = 20 dragoon = 5 irregular = 0 #65 #NAVY: submarine = 0 #--------- 0 # Total Submarines dreadnought = 0 battleship = 0 ironclad = 10 monitor = 0 manowar = 10 #--------- 20 # Total Ships-of-the-Line heavy_cruiser = 0 cruiser = 5 commerce_raider = 0 frigate = 0 #---------- 5 # Total Escort/Fast ships steamer_transport = 0 clipper_transport = 10 #---------- 10 # Total Transports
NOTE: For ship types that obsolete each other, the values are added together.
Brigade preferences
artillery = 25 engineer = 5 barrel = 0 cuirassier = 0 hussar = 0 hq = 0 guard = 0 regular = 0 # Sum of these should be <= 100
torpedo_boat = 0 destroyer = 0 corvette = 0 minelayer = 0 minesweeper = 0 # Sum of these should be <= 100
This section gives the percentage of eligible division types that should be built with a certain brigade type.
}
To close off this section.
Factory AI factors
factory = { [factory_tag] = 1.0 #multiplier. }
This is a multiplier to how important it is to build a certain factory. In-game it's divided by the number currently built.
NOTE: Cannot control capitalist building with the AI files in the Revolutions expansion.
Tech AI Factors
technology = {
To start off this section.
preference = { }
Tech ID's for the techs that the AI should aim to research.
army = 1.0 navy = 1.0 culture = 1.0 commerce = 1.0 industry = 1.0
The probability for selecting a tech.
}
To close off this section.
Reform AI
reform = {
To start off this section.
voting_rights= { 1.0 #none 1.0 #landed 1.0 #wealth 1.0 #suffrage }
Set the priority for the level of voting rights reform that the AI should aim to achieve. The higher the number, the higher the priority.
press_rights= { 1.0 #state press 1.0 #censorship 1.0 #free press }
Set the priority for the level of press rights reform that the AI should aim to achieve. The higher the number, the higher the priority.
political_parties= { 1.0 #none 1.0 #right-to-ban 1.0 #all allowed }
Set the priority for the level of political parties reform that the AI should aim to achieve. The higher the number, the higher the priority.
trade_unions= { 1.0 #none 1.0 #non-socialist 1.0 #socialist-only 1.0 #all }
Set the priority for the level of trade unions reform that the AI should aim to achieve. The higher the number, the higher the priority.
public_meetings= { 1.0 #NO 1.0 #YES }
Set the priority for the level of public meetings reform that the AI should aim to achieve. The higher the number, the higher the priority.
maximum_workhours= { 1.0 #NO 1.0 #14 1.0 #12 1.0 #10 1.0 #8 }
Set the priority for the level of maximum workhours reform that the AI should aim to achieve. The higher the number, the higher the priority.
minimum_wages= { 1.0 #none 1.0 #trinkets 1.0 #low 1.0 #acceptable 1.0 #good }
Set the priority for the level of minimum wages reform that the AI should aim to achieve. The higher the number, the higher the priority.
safety_regulations= { 1.0 #none 1.0 #trinkets 1.0 #low 1.0 #acceptable 1.0 #good }
Set the priority for the level of safety regulations reform that the AI should aim to achieve. The higher the number, the higher the priority.
health_care= { 1.0 #none 1.0 #trinkets 1.0 #low 1.0 #acceptable 1.0 #good }
Set the priority for the level of health care reform that the AI should aim to achieve. The higher the number, the higher the priority.
unemployment_subsidies= { 1.0 #none 1.0 #trinkets 1.0 #low 1.0 #acceptable 1.0 #good }
Set the priority for the level of unemployment subsidies reform that the AI should aim to achieve. The higher the number, the higher the priority.
pension_funds= { 1.0 #none 1.0 #trinkets 1.0 #low 1.0 #acceptable 1.0 #good }
Set the priority for the level of pension funds reform that the AI should aim to achieve. The higher the number, the higher the priority.
}
To close this section off.
Construction AI Factors
construction = {
To start this section off.
fortress_pref = x #how often to build forts railroad_pref = x #how often to build railroads colonize_pref = x #how often to build colonies. factory_pref = x #how often to build factories
List of how often certain construction types should be constructed.
countrylist = { ENG FRA ... }
List of countries to build borders against...
fortress = { #prov_id = priority 327 = 200.0 240 = 100.0 }
Provinces where fortresses should be built, with the priority of these fortresses in those provinces given.
}
To close this section off.
Railroad factors
factory = {
To start off this section.
max = x
The number of simultaneous builds. Setting to -1 would mean that the AI just keeps on building.
target = { #prov_id = priority 327 = 200.0 240 = 100.0 }
Factories will be built in the states containing these provinces. The priority of certain states is also given.
}
To close off this section.
Colony factors
colony = {
To start off this section.
size = x
The number of areas to colonise at the same time.
primary = { "Gold Coast" }
This is what we will get pissed if someone else colonises.
secondary = { "Mikronesia" }
This is what we will colonise if all primary states have already been colonised.
NOTE: The order in which the states are listed is important here. The closer to the top of the list the higher the priority that state has to getting colonised.
}
To close off this section.
Peace Negotiation Factors
peace = {
To start off this section.
quiet_factor = 1.0
Tendency to offer peace after long periods of inactivity in the war. The higher the number the more likely.
ferocity = 1.0
Reluctance to end a war no matter what. Ferocious nations will fight to the bitter end. The higher the number the more ferocious.
}
To close off this section.