Welcome to the TWC Wiki! You are not logged in. Please log in to the Wiki to vote in polls, change skin preferences, or edit pages. See HERE for details of how to LOG IN.

Difference between revisions of "AI Personalities"

From TWC Wiki
Jump to navigationJump to search
m (Removed category "Modding" (using HotCat))
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
'''Characteristics'''
+
{{RTW M2TW Modding Logo}}<br>
 +
==General==
  
These control a set of AI production personalities, which contribute a bias towards building and training (but not retraining or repairing). This bias is fairly small compared to game-generated factors such as "the enemy is attacking me with lots of cavalry, build me some spearmen". Explaining the weighting system which drives the production AI in full is beyond the scope of this document as it would take several days to write.
+
This article is based on research of Medieval II Total War. It has not been confirmed whether or not Rome Total War uses the exact same system.
 +
The data in the following tables is hardcoded and can not be modified (without the use of external programs).
  
So in short, the building construction personalities are these: (ranked highest to lowest - therother)
+
The faction header in descr_strat.txt contains what we will refer to as an "AI Personality". It can look like this:
  
 +
faction england, '''balanced smith'''
  
*balanced - biases towards growth, taxable income, trade level bonuses (roads), walls and xp bonus buildings.
+
*The first name (balanced) controls a set of AI building preferences (no impact on repairing).<br>
  
*religious - biases towards growth, loyalty, taxable income, farming, walls and law.
+
*The second name (smith) controls a set of AI recruitment preferences (no impact on retraining).<br>
  
*trader - biases towards growth, trade level, trade base, weapon upgrades, games, races and xp bonus buildings.
+
*Any first name can be combined with any second name, so fortified caesar is just as valid as bureaucrat napoleon.<br>
  
*comfort - biases towards growth, farming, games, races, xp bonus and happiness.
+
*AI personalities do not influence aggression at all, merely the decisions on what to build and recruit.<br>
  
*bureaucrat - biases towards taxable income, growth, pop health, trade, walls, improved bodyguards and law.
+
*All decisions contain a random element, so biases are a statistical matter.
  
*craftsman - biases towards walls, races, taxable income, weapon upgrades, xp bonuses, mines, health and growth.
 
  
*sailor - biases towards sea trade, taxable income, walls, growth, trade.
+
==AI Building Preferences==
  
*fortified - biases towards walls, taxable income, growth, loyalty, defenses, bodyguards and law.
+
These biases are towards building properties, rather than buildings themselves. The game does not know what a "Blacksmith" is, for example, it only knows that it is a building which provides a weapon upgrade, and hence a craftsman AI would be more likely to build it than most other AI personality types.<br>
 +
The available first names are:
  
 +
  balanced
 +
  religious
 +
  trader
 +
  comfortable
 +
  bureaucrat
 +
  craftsman
 +
  sailor
 +
  fortified
  
These biases are towards building properties, rather than buildings themselves. The game does not know what a "Blacksmith" is, for example, it only knows that it is a building which provides a weapon upgrade, and hence a Craftsman AI would be more likely to build it than another AI personality type.
+
[[File:AIPersonalityTypes.png|300px]]
  
These are then combined with a troop production personality, as follows:
 
  
 +
The following list of building properties have a weight of 0 in all 8 first names and have been excluded from the above table:<br>
  
*smith - exactly level.
+
weapon_melee_simple<br>
 +
construction_cost_bonus_military<br>
 +
construction_cost_bonus_religious<br>
 +
construction_cost_bonus_defensive<br>
 +
construction_cost_bonus_other<br>
 +
construction_time_bonus_military<br>
 +
construction_time_bonus_religious<br>
 +
construction_time_bonus_defensive<br>
 +
construction_time_bonus_other<br>
 +
construction_cost_bonus_wooden<br>
 +
construction_cost_bonus_stone<br>
 +
construction_time_bonus_wooden<br>
 +
construction_time_bonus_stone<br>
 +
free_upkeep<br>
 +
pope_approval<br>
 +
pope_disapproval<br>
 +
archer_bonus<br>
 +
cavalry_bonus<br>
 +
heavy_cavalry_bonus<br>
 +
gun_bonus<br>
 +
navy_bonus<br>
 +
recruitment_cost_bonus_naval<br>
 +
retrain_cost_bonus<br>
 +
weapon_projectile<br>
 +
income_bonus<br>
 +
recruitment_slots<br>
  
*mao - biased towards mass troops, light infantry.
 
  
*genghis - biased towards missile cavalry and light cavalry.
+
Note:
 +
*Bigger bonuses get preferred over smaller ones. This is why the AI really loves buildings with income_bonus in many mods.<br>
  
*stalin - biased towards heavy infantry, mass troops and artillery.
+
*recruit_pool, agent & agent_limit are missing from both lists. It seems recruit_pool always has the highest priority, but this needs further investigation.<br>
  
*napoleon - biased towards a mix of light and heavy infantry, light cavalry.
+
*The properties have been listed disregarding their ingame functionality. Some of them are dummy effects (e.g. trade_fleet) or do not provide any bonuses (e.g. taxable_income_bonus), but they still influence the AI's preference to construct any buildings containing them.<br>
  
*henry - biased towards heavy and light cavalry, missile infantry.
+
*The order of the properties in the EDB does NOT matter, despite previous claims. This has been confirmed by memory editing the preference weights.
  
*Caesar - biased towards heavy infantry, light cavalry, siege artillery.
 
  
 +
==AI Recruitment Preferences==
  
The same system as for the buildings applies. Troop category and class are combined at the time the unit database is loaded to give a unit production type, and the likelihood of the AI choosing to produce a given unit type which can be produced is then modified by the unit type weighting. There is also a random element in the choosing of which building or troop type to produce next, so the effect of the bias is a statistical thing. Another factor that is applied over the top which may obscure the bias is a tendency towards producing troop mixtures (according to what is already in the garrison) and a weighting according to unit strength.
+
This one is a bit more complex, so read carefully.<br>
  
The two sets of types can be freely combined; for example, although Fortified Caesar does not appear in the list of options currently used by the vanilla [[RTW]] game, it is a valid combination.
+
When the unit database (EDU) is loaded, the game combines unit category and class to know which weight to apply. It also calculates a value for the unit that is based on a unit's stats. Note that I say value, it has nothing to do with cost or upkeep (!). This value can not be seen anywhere in the game without the use of external programs. Soldier count has the biggest impact on a unit's value. That is why large units tend to get recruited more often than small ones, which can be amended by using recruit_priority_offset in Medieval II Total War: Kingdoms.
 +
It has to be stressed that this unit value is far more influential than the preferences set by the AI personality. For example a stalin personality will still prefer a very good light infantry unit over a bad heavy infantry one. These biases only come into full effect when units are of equal or similar value.<br>
 +
The available second names are:
  
[[Category:RTW Modding]]
+
 
 +
Available in both Rome: Total War and Medieval II: Total War
 +
  smith
 +
  mao
 +
  genghis
 +
  stalin
 +
  napoleon
 +
  henry
 +
  caesar
 +
 
 +
 
 +
Available in Medieval II: Total War only
 +
  richard
 +
  heinrich
 +
  subotai
 +
  knud
 +
  guy
 +
  doge
 +
  robert
 +
  wyvadslaw
 +
  vlad
 +
  roger
 +
  alfonso
 +
  arslan
 +
  tahar
 +
  saladin
 +
  tzar
 +
 
 +
[[File:AIPersonalityNames.png|300px]]
 +
 
 +
4 of the recruitment personalities also contribute to the '''building''' preferences, namely:
 +
*caesar: weapon_artillery_mechanical + 100
 +
*napoleon: weapon_melee_blade, weapon_missile_gunpowder + 100
 +
*stalin: armour, weapon_missile_gunpowder, weapon_artillery_gunpowder + 100
 +
*genghis: weapon_missile_mechanical + 100
 +
 
 +
 
 +
Note:
 +
*There is a tendency towards producing troop mixtures (according to what is already in the garrison) that might obscure the bias.<br>
 +
 
 +
*No evidence has been found to suggest that AI factions respond to troop compositions of their neighbours or enemies.<br>
 +
 
 +
*Weapon attributes do not matter for categorizing, so a heavy infantry unit with the spear attribute is still considered to be heavy infantry.<br>
 +
 
 +
*skirmish infantry (the unit class skirmish, not what the unit does!) is grouped into light infantry<br>
 +
 
 +
*skirmish cavalry & spearmen cavalry are grouped into light cavalry<br>
 +
 
 +
*weights for non_combatants and handlers have been excluded from the table<br>
 +
 
 +
*ships have a value of 0 in all profiles
 +
 
 +
 
 +
 
 +
[[Category:RTW Text Editing & Scripting]]
 
[[Category:M2TW Modding]]
 
[[Category:M2TW Modding]]

Latest revision as of 08:10, 23 October 2023

Rome:Total War & Remastered - Modding Index

M2TW Modding Index



General

This article is based on research of Medieval II Total War. It has not been confirmed whether or not Rome Total War uses the exact same system. The data in the following tables is hardcoded and can not be modified (without the use of external programs).

The faction header in descr_strat.txt contains what we will refer to as an "AI Personality". It can look like this:

faction	england, balanced smith
  • The first name (balanced) controls a set of AI building preferences (no impact on repairing).
  • The second name (smith) controls a set of AI recruitment preferences (no impact on retraining).
  • Any first name can be combined with any second name, so fortified caesar is just as valid as bureaucrat napoleon.
  • AI personalities do not influence aggression at all, merely the decisions on what to build and recruit.
  • All decisions contain a random element, so biases are a statistical matter.


AI Building Preferences

These biases are towards building properties, rather than buildings themselves. The game does not know what a "Blacksmith" is, for example, it only knows that it is a building which provides a weapon upgrade, and hence a craftsman AI would be more likely to build it than most other AI personality types.
The available first names are:

 balanced
 religious
 trader
 comfortable
 bureaucrat
 craftsman
 sailor
 fortified

AIPersonalityTypes.png


The following list of building properties have a weight of 0 in all 8 first names and have been excluded from the above table:

weapon_melee_simple
construction_cost_bonus_military
construction_cost_bonus_religious
construction_cost_bonus_defensive
construction_cost_bonus_other
construction_time_bonus_military
construction_time_bonus_religious
construction_time_bonus_defensive
construction_time_bonus_other
construction_cost_bonus_wooden
construction_cost_bonus_stone
construction_time_bonus_wooden
construction_time_bonus_stone
free_upkeep
pope_approval
pope_disapproval
archer_bonus
cavalry_bonus
heavy_cavalry_bonus
gun_bonus
navy_bonus
recruitment_cost_bonus_naval
retrain_cost_bonus
weapon_projectile
income_bonus
recruitment_slots


Note:

  • Bigger bonuses get preferred over smaller ones. This is why the AI really loves buildings with income_bonus in many mods.
  • recruit_pool, agent & agent_limit are missing from both lists. It seems recruit_pool always has the highest priority, but this needs further investigation.
  • The properties have been listed disregarding their ingame functionality. Some of them are dummy effects (e.g. trade_fleet) or do not provide any bonuses (e.g. taxable_income_bonus), but they still influence the AI's preference to construct any buildings containing them.
  • The order of the properties in the EDB does NOT matter, despite previous claims. This has been confirmed by memory editing the preference weights.


AI Recruitment Preferences

This one is a bit more complex, so read carefully.

When the unit database (EDU) is loaded, the game combines unit category and class to know which weight to apply. It also calculates a value for the unit that is based on a unit's stats. Note that I say value, it has nothing to do with cost or upkeep (!). This value can not be seen anywhere in the game without the use of external programs. Soldier count has the biggest impact on a unit's value. That is why large units tend to get recruited more often than small ones, which can be amended by using recruit_priority_offset in Medieval II Total War: Kingdoms. It has to be stressed that this unit value is far more influential than the preferences set by the AI personality. For example a stalin personality will still prefer a very good light infantry unit over a bad heavy infantry one. These biases only come into full effect when units are of equal or similar value.
The available second names are:


Available in both Rome: Total War and Medieval II: Total War

 smith
 mao 
 genghis
 stalin
 napoleon
 henry
 caesar


Available in Medieval II: Total War only

 richard
 heinrich
 subotai
 knud
 guy
 doge
 robert
 wyvadslaw
 vlad
 roger
 alfonso
 arslan
 tahar
 saladin
 tzar

AIPersonalityNames.png

4 of the recruitment personalities also contribute to the building preferences, namely:

  • caesar: weapon_artillery_mechanical + 100
  • napoleon: weapon_melee_blade, weapon_missile_gunpowder + 100
  • stalin: armour, weapon_missile_gunpowder, weapon_artillery_gunpowder + 100
  • genghis: weapon_missile_mechanical + 100


Note:

  • There is a tendency towards producing troop mixtures (according to what is already in the garrison) that might obscure the bias.
  • No evidence has been found to suggest that AI factions respond to troop compositions of their neighbours or enemies.
  • Weapon attributes do not matter for categorizing, so a heavy infantry unit with the spear attribute is still considered to be heavy infantry.
  • skirmish infantry (the unit class skirmish, not what the unit does!) is grouped into light infantry
  • skirmish cavalry & spearmen cavalry are grouped into light cavalry
  • weights for non_combatants and handlers have been excluded from the table
  • ships have a value of 0 in all profiles