ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.

Difference between revisions of "AI"

From ModEnc
Jump to: navigation, search
m (Reverted edits by CnCVK (Talk); changed back to last version by 58.7.157.48)
(General Information about RA2/YR's AI: AI respects money rules; it just usually always has more than players ever will!)
 
(8 intermediate revisions by 7 users not shown)
Line 9: Line 9:
  
 
By the way: YR's {{ai}} is 136 KB big - {{ts}}'s weights a whopping 275 KB. If you just calculate straight through it, that works out to 13,600 characters of AI code for each playable house in YR, against 137,500 characters for each playable side in TS. Although that's far from reality (doesn't take into account shared scripts), it shows how very underdeveloped the default AI in {{yr}} is.
 
By the way: YR's {{ai}} is 136 KB big - {{ts}}'s weights a whopping 275 KB. If you just calculate straight through it, that works out to 13,600 characters of AI code for each playable house in YR, against 137,500 characters for each playable side in TS. Although that's far from reality (doesn't take into account shared scripts), it shows how very underdeveloped the default AI in {{yr}} is.
 +
 +
Also the AI 'cheats' with several conditions - AI controlled players are capable of building every unit regardless of [[Owner]], [[Prerequisite]], are able to "see" through Shroud/unexplored terrain and are capable of recognizing cloaked units.
  
 
==AI-related Flags in {{yr}}==
 
==AI-related Flags in {{yr}}==
Line 14: Line 16:
  
 
===Team related Flags===
 
===Team related Flags===
; {{TTL|CloseEnough| }} : If your big taskforces get stuck, increase this.
+
; {{f|CloseEnough| |link}} : If your big taskforces get stuck, increase this.
; {{TTL|Stray| }} : If you want to use bigger TaskForces, increase this. Recommended: 4-5.
+
; {{f|Stray| |link}} : If you want to use bigger TaskForces, increase this. Recommended: 4-5.
; {{TTL|RelaxedStray| }} : Increasing this prevens big TaskForces to get stuck at regroup and gather command. Recommended: 5-7.
+
; {{f|RelaxedStray| |link}} : Increasing this prevens big TaskForces to get stuck at regroup and gather command. Recommended: 5-7.
; {{TTL|GuardModeStray| }} : Again, if you want to use bigger TaskForces, increase this. Recommended: 3-4.
+
; {{f|GuardModeStray| |link}} : Again, if you want to use bigger TaskForces, increase this. Recommended: 3-4.
; {{TTL|TeamDelays|&#160;}} : This number says how often the AI checks for creating a TeamType in frames. Decreasing it is maybe the best thing you can ever do for the AI. Brutal, Medium, Easy. Recommended: <100.
+
; {{f|TeamDelays|&#160;|link}} : This number says how often the AI checks for creating a TeamType in frames. Decreasing it is maybe the best thing you can ever do for the AI. Brutal, Medium, Easy. Recommended: <100.
; {{TTL|AIHateDelays|&#160;}} : Delay in frames before AI chooses an enemy. Keep it low.
+
; {{f|AIHateDelays|&#160;|link}} : Delay in frames before AI chooses an enemy. Keep it low.
; {{TTL|MultiplayerAICM|&#160;}} : Percent of addition money for AI. If you want your AI to have plenty of money, increase, but have more dogs guarding AI bases becouse if player's spy gets into an AI refinery, he gets a LOT of money. Brutal, Medium, Easy.
+
; {{f|MultiplayerAICM|&#160;|link}} : Percent of addition money for AI. If you want your AI to have plenty of money, increase, but have more dogs guarding AI bases becouse if player's spy gets into an AI refinery, he gets a LOT of money. Brutal, Medium, Easy.
; {{TTL|AIVirtualPurifiers|&#160;}} : Same as above. 1 gives 25% bonus to money. Brutal, Medium, Easy.
+
; {{f|AIVirtualPurifiers|&#160;|link}} : Same as above. 1 gives 25% bonus to money. Brutal, Medium, Easy.
; {{TTL|HarvestersPerRefinery|&#160;}} : Do not edit this. Only one AI will build additional harvesters and others will get stuck.
+
; {{f|HarvestersPerRefinery|&#160;|link}} : Do not edit this. Only one AI will build additional harvesters and others will get stuck.
; {{TTL|AIExtraRefineries|&#160;}} : Same as above, but decreasing this can give AI more free space in base, and AI can replace a refinery fast. (but it also has less harvesters then, and less money) If you have big TaskForces and need space in base, decrease to 0,0,0 and increase AICM or VirtualPurifiers.
+
; {{f|AIExtraRefineries|&#160;|link}} : Same as above, but decreasing this can give AI more free space in base, and AI can replace a refinery fast. (but it also has less harvesters then, and less money) If you have big TaskForces and need space in base, decrease to 0,0,0 and increase AICM or VirtualPurifiers.
; {{TTL|MinimumAIDefensiveTeams|&#160;}} : Recommended:3-5.
+
; {{f|MinimumAIDefensiveTeams|&#160;|link}} : Recommended:3-5.
; {{TTL|MaximumAIDefensiveTeams|&#160;}} : Maximum number of {{TTL|IsBaseDefense|yes}} TeamTypes the AI will build. Should be higher than minimum. Recomennded:5-7.
+
; {{f|MaximumAIDefensiveTeams|&#160;|link}} : Maximum number of {{f|IsBaseDefense|yes|link}} TeamTypes the AI will build. Should be higher than minimum. Recomennded:5-7.
; {{TTL|TotalAITeamCap|&#160;}} : Maximum of teams used by AI. Good idea to increase, but not too much if you haven't done something to give the AI more free space.
+
; {{f|TotalAITeamCap|&#160;|link}} : Maximum of teams used by AI. Good idea to increase, but not too much if you haven't done something to give the AI more free space.
  
 
===Super Weapon related Flags===
 
===Super Weapon related Flags===
 
The following flags control how likely a certain category of buildings is to be chosen as a target when an AI fires a Weather Storm or Nuclear Missile.  
 
The following flags control how likely a certain category of buildings is to be chosen as a target when an AI fires a Weather Storm or Nuclear Missile.  
; {{TTL|AIIonCannonConYardValue|&#160;}} : Value of buildings with {{TTL|ConstructionYard|yes}}
+
; {{f|AIIonCannonConYardValue|&#160;|link}} : Value of buildings with {{f|ConstructionYard|yes|link}}
; {{TTL|AIIonCannonWarFactoryValue|&#160;}} : Value of buildings with {{TTL|WeaponsFactory|yes}}
+
; {{f|AIIonCannonWarFactoryValue|&#160;|link}} : Value of buildings with {{f|WeaponsFactory|yes|link}}
; {{TTL|AIIonCannonPowerValue|&#160;}} : Value of buildings with {{TTL|Power|&#160;}}>0
+
; {{f|AIIonCannonPowerValue|&#160;|link}} : Value of buildings with {{f|Power|&#160;|link}}>0
; {{TTL|AIIonCannonTechCenterValue|&#160;}} : Value of BattleLabs
+
; {{f|AIIonCannonTechCenterValue|&#160;|link}} : Value of BattleLabs
; {{TTL|AIIonCannonEngineerValue|&#160;}} : Value of Engineers
+
; {{f|AIIonCannonEngineerValue|&#160;|link}} : Value of Engineers
; {{TTL|AIIonCannonThiefValue|&#160;}} : Value of Thieves (Logic still present in RA2)
+
; {{f|AIIonCannonThiefValue|&#160;|link}} : Value of Thieves (Logic still present in RA2)
; {{TTL|AIIonCannonHarvesterValue|&#160;}} : Value of Harvesters
+
; {{f|AIIonCannonHarvesterValue|&#160;|link}} : Value of Harvesters
; {{TTL|AIIonCannonMCVValue|&#160;}} : Value of MCVs
+
; {{f|AIIonCannonMCVValue|&#160;|link}} : Value of MCVs
; {{TTL|AIIonCannonAPCValue|&#160;}} : Value of Transports
+
; {{f|AIIonCannonAPCValue|&#160;|link}} : Value of Transports
; {{TTL|AIIonCannonBaseDefenseValue|&#160;}} : Value of buildings with {{TTL|IsBaseDefense|yes}}
+
; {{f|AIIonCannonBaseDefenseValue|&#160;|link}} : Value of buildings with {{f|IsBaseDefense|yes|link}}
; {{TTL|AIIonCannonPlugValue|&#160;}} : Value of buildings with {{TTL|IsPlug|yes}}-if you give {{TTL|IsPlug|yes}} to for example, SWs,this is their value. Of course, you must delete the comment first, or you get an IE.  
+
; {{f|AIIonCannonPlugValue|&#160;|link}} : Value of buildings with {{f|IsPlug|yes|link}}-if you give {{f|IsPlug|yes|link}} to for example, SWs,this is their value. Of course, you must delete the comment first, or you get an IE.  
; {{TTL|AIIonCannonHelipadValue|&#160;}} : Value of buildings with {{TTL|HoverPad|yes}}. Deleting the comment fixes HoverPad SW targeting IE.
+
; {{f|AIIonCannonHelipadValue|&#160;|link}} : Value of buildings with {{f|HoverPad|yes|link}}. Deleting the comment fixes HoverPad SW targeting IE.
; {{TTL|AIIonCannonTempleValue|&#160;}} : Value of buildings with {{TTL|IsTemple|yes}}. Same as with Plug. Tip- use for SWs,refineries or with Purifiers/Vats/Plants
+
; {{f|AIIonCannonTempleValue|&#160;|link}} : Value of buildings with {{f|IsTemple|yes|link}}. Same as with Plug. Tip- use for SWs,refineries or with Purifiers/Vats/Plants
  
 
===Base &amp; Building related Flags===
 
===Base &amp; Building related Flags===
; {{TTL|AISafeDistance|&#160;}} : Distance from enemy/own base at which AI will execute the gather/regroup command. If your AI builds large bases, increase.       
+
; {{f|AISafeDistance|&#160;|link}} : Distance from enemy/own base at which AI will execute the gather/regroup command. If your AI builds large bases, increase.       
; {{TTL|AIMinorSuperReadyPercent|&#160;}} : If Iron Curtain or Chronosphere is this charged, AI will start preparing teams which make use of it. Decrease if you have long-building Chrono or Curtain teams.  
+
; {{f|AIMinorSuperReadyPercent|&#160;|link}} : If Iron Curtain or Chronosphere is this charged, AI will start preparing teams which make use of it. Decrease if you have long-building Chrono or Curtain teams.  
; {{TTL|AlliedBaseDefenseCounts|&#160;}}  
+
; {{f|AlliedBaseDefenseCounts|&#160;|link}}  
; {{TTL|SovietBaseDefenseCounts|&#160;}}  
+
; {{f|SovietBaseDefenseCounts|&#160;|link}}  
; {{TTL|ThirdBaseDefenseCounts|&#160;}}  
+
; {{f|ThirdBaseDefenseCounts|&#160;|link}}  
 
: Numbers are ordered Brutal, Medium, Easy. These are the number of defense buildings the AI will build for each side. If these are too high, AI just builds defenses and somehow forgets other buildings, also it then  builds defense "chains". If you get total control of what AI builds when, then set defenses to be build later, increase this number to a very high number like 100, and you have nice ring of defenses around the AI base. If you want AI to have many defenses, but it always builds those chains, you can simply disable defenses and use tons of cloned buildings, that allows you to control when AI builds each building including defenses and things like sending SHK to all TESLA thanks to different building IDs.   
 
: Numbers are ordered Brutal, Medium, Easy. These are the number of defense buildings the AI will build for each side. If these are too high, AI just builds defenses and somehow forgets other buildings, also it then  builds defense "chains". If you get total control of what AI builds when, then set defenses to be build later, increase this number to a very high number like 100, and you have nice ring of defenses around the AI base. If you want AI to have many defenses, but it always builds those chains, you can simply disable defenses and use tons of cloned buildings, that allows you to control when AI builds each building including defenses and things like sending SHK to all TESLA thanks to different building IDs.   
; {{TTL|AISuperDefenseProbability|&#160;}} : Probability that AI will use the Force Shield when attacked by major SWs. Recommended:99
+
; {{f|AISuperDefenseProbability|&#160;|link}} : Probability that AI will use the Force Shield when attacked by major SWs. Recommended:99
; {{TTL|AISuperDefenseFrames|&#160;}} : If the Force Shield is not ready when AI is attacked by major SWs, it can wait maximally this long or it will not fire. Set to as high as is the shortest delay before nuke hits, storm starts etc.  
+
; {{f|AISuperDefenseFrames|&#160;|link}} : If the Force Shield is not ready when AI is attacked by major SWs, it can wait maximally this long or it will not fire. Set to as high as is the shortest delay before nuke hits, storm starts etc.  
; {{TTL|NodRegularPower|&#160;}}  
+
; {{f|NodRegularPower|&#160;|link}}  
; {{TTL|GDIPowerPlant|&#160;}}
+
; {{f|GDIPowerPlant|&#160;|link}}
; {{TTL|ThirdPowerPlant|&#160;}}  
+
; {{f|ThirdPowerPlant|&#160;|link}}  
: These list the power plants that are built by the AI when it needs more power (All powerplants AI builds are this, except first one). It is a good idea to set this to the powerplant with highest {{TTL|Power|&#160;}} your mod has for that side, even for the Soviets (having NANRCT is risky, but it saves much space) If you want AI to have more space, make high output powerplant for every side and set this to it.
+
: These list the power plants that are built by the AI when it needs more power (All powerplants AI builds are this, except first one). It is a good idea to set this to the powerplant with highest {{f|Power|&#160;|link}} your mod has for that side, even for the Soviets (having NANRCT is risky, but it saves much space) If you want AI to have more space, make high output powerplant for every side and set this to it.
 
====Build*====
 
====Build*====
 
Each of these Flags accepts only '''one''' building for its value.
 
Each of these Flags accepts only '''one''' building for its value.
; {{TTL|BuildConst|&#160;}} : Have all your Construction Yards here.
+
; {{f|BuildConst|&#160;|link}} : Have all your Construction Yards here.
; {{TTL|BuildPower|&#160;}} : This is the first powerplant AI builds. You can have NANRCT (the Nuclear Reactor) here if you want, but it will look strange. Also, this reads only one power plant per side so having here both NAPOWR (regular Tesla Reactor) and NANRCT just builds NAPOWR.
+
; {{f|BuildPower|&#160;|link}} : This is the first powerplant AI builds. You can have NANRCT (the Nuclear Reactor) here if you want, but it will look strange. Also, this reads only one power plant per side so having here both NAPOWR (regular Tesla Reactor) and NANRCT just builds NAPOWR.
; {{TTL|BuildRefinery|&#160;}} : Have all your refineries here, even if they use Slave Miner logic.
+
; {{f|BuildRefinery|&#160;|link}} : Have all your refineries here, even if they use Slave Miner logic.
; {{TTL|BuildBarracks|&#160;}} : Have all your barracks here.
+
; {{f|BuildBarracks|&#160;|link}} : Have all your barracks here.
; {{TTL|BuildTech|&#160;}} : Have all your Battle Labs here.
+
; {{f|BuildTech|&#160;|link}} : Have all your Battle Labs here.
; {{TTL|BuildWeapons|&#160;}} : Have all your War Factories here
+
; {{f|BuildWeapons|&#160;|link}} : Have all your War Factories here
; {{TTL|BuildRadar|&#160;}} : Have all your Radars here
+
; {{f|BuildRadar|&#160;|link}} : Have all your Radars here
; {{TTL|ConcreteWalls|&#160;}} : Have all your walls here. These will be built around ProtectWithWall buildings, so if you replace GAWALL (Allied Walls) with GAPILL (Allied Pillbox, it will build pillboxes around those buildings and the AI will be slower than ever before.
+
; {{f|BuildHelipad|&#160;|link}} : Have all your "Helipad=yes" buildings here.
; {{TTL|BuildNavalYard|&#160;}} : Have all your Naval Yards here.
+
; {{f|ConcreteWalls|&#160;|link}} : Have all your walls here. These will be built around ProtectWithWall buildings, so if you replace GAWALL (Allied Walls) with GAPILL (Allied Pillbox, it will build pillboxes around those buildings and the AI will be slower than ever before.
; {{TTL|BuildDefense|&#160;}} : Used for standard defenses, but obsolete in YR
+
; {{f|BuildNavalYard|&#160;|link}} : Have all your Naval Yards here.
; {{TTL|BuildPDefense|&#160;}} : Used for power consuming defenses, obsolete in YR
+
; {{f|BuildDefense|&#160;|link}} : Used for standard defenses, but obsolete in YR
; {{TTL|BuildAA|&#160;}} : Used for AA defenses, obsolete in YR
+
; {{f|BuildPDefense|&#160;|link}} : Used for power consuming defenses, obsolete in YR
 +
; {{f|BuildAA|&#160;|link}} : Used for AA defenses, obsolete in YR
  
 
====Defenses====
 
====Defenses====
; {{TTL|AlliedBaseDefenses|&#160;}}  
+
; {{f|AlliedBaseDefenses|&#160;|link}}  
; {{TTL|SovietBaseDefenses|&#160;}}
+
; {{f|SovietBaseDefenses|&#160;|link}}
; {{TTL|ThirdBaseDefenses|&#160;}}
+
; {{f|ThirdBaseDefenses|&#160;|link}}
: Have your defense buildings listed here. This can take unlimited number of these buildings, buildings listed here ignore BuildLimit and if you set it for country specific buildings like GTGCAN (French Grand Cannnon), it will build them for the whole side, that is why some modders prefer to clone Grand Cannon. Maximum of these buildings built is specified by XXXBaseDefenseCounts=, numbers of specific buildings built change with {{TTL|AIForcePredictionFudge}} and their AntiXXXValue.
+
: Have your defense buildings listed here. This can take unlimited number of these buildings, buildings listed here ignore BuildLimit and if you set it for country specific buildings like GTGCAN (French Grand Cannnon), it will build them for the whole side, that is why some modders prefer to clone Grand Cannon. Maximum of these buildings built is specified by XXXBaseDefenseCounts=, numbers of specific buildings built change with {{f|AIForcePredictionFudge|link}} and their AntiXXXValue.
  
 
===Resource related Flags===
 
===Resource related Flags===
; {{TTL|AIForcePredictionFudge|&#160;}} : AI chooses its defenses by analyzing units of player it chose as its enemy, and make weighted distribution of defense based on their AntiXXXValue. It is good to try to experiment with this value, sometimes lower can be better than higher, and combine this with extreme changes in defenses AntiXXXValues.
+
; {{f|AIForcePredictionFudge|&#160;|link}} : AI chooses its defenses by analyzing units of player it chose as its enemy, and make weighted distribution of defense based on their AntiXXXValue. It is good to try to experiment with this value, sometimes lower can be better than higher, and combine this with extreme changes in defenses AntiXXXValues.
; {{TTL|MaximumBaseDefenseValue|&#160;}} : Comments in Rulesmd say it is obsolete, but changing this to very high values (like 4000) can have interesting results, but it will make AI concentrate on building defenses only and so you need again more control of what AI builds when.
+
; {{f|MaximumBaseDefenseValue|&#160;|link}} : Comments in Rulesmd say it is obsolete, but changing this to very high values (like 4000) can have interesting results, but it will make AI concentrate on building defenses only and so you need again more control of what AI builds when.
; {{TTL|CreditReserve|&#160;}} : AI will repair buildings only if it has more than this amount of credits.
+
; {{f|CreditReserve|&#160;|link}} : AI will repair buildings only if it has more than this amount of credits.
; {{TTL|PowerSurplus|&#160;}} : AI will build power plants until it has this amount of surplus power.
+
; {{f|PowerSurplus|&#160;|link}} : AI will build power plants until it has this amount of surplus power.
; {{TTL|BaseSizeAdd|&#160;}} : Increasing this to very high numbers can make AI build huge bases, but only increases number of power plants and defenses as it cannot build more factories or refineries. You should increase it if you increased XXXBaseDefenseCounts=.
+
; {{f|BaseSizeAdd|&#160;|link}} : Increasing this to very high numbers can make AI build huge bases, but only increases number of power plants and defenses as it cannot build more factories or refineries. You should increase it if you increased XXXBaseDefenseCounts=.
; {{TTL|PowerEmergency|&#160;}} : AI will sell buildings if it has less than this percent of power.
+
; {{f|PowerEmergency|&#160;|link}} : AI will sell buildings if it has less than this percent of power.
; {{TTL|AIBaseSpacing|&#160;}} : This is average space AI will leave between its buildings. Increase only if you have only few buildings or replaced maps with some that have more space for bases or in map files.
+
; {{f|AIBaseSpacing|&#160;|link}} : This is average space AI will leave between its buildings. Increase only if you have only few buildings or replaced maps with some that have more space for bases or in map files.
 +
 
 +
'''Final tip:''' By increasing {{f|RepairPercent|&#160;|link}}you'll get faster but more costly structure repair, with cost that is propably still no harm for AI and it makes AI much more annoying as it repairs everything under attack if it has enough money.
 +
 
 +
== [AI] in {{Ini|Rules}} ==
 +
 
 +
=== Applicable INI Flags ===
 +
 
 +
{{Applicable INI Flags}}
 +
 
 +
<onlyinclude>
 +
{{Applicable INI Flags Header|[AI]}}
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|BuildConst|link}}  || vector<BuildingType> || {} || +
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|BuildPower|link}}  || vector<BuildingType> || {} || +
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|BuildRefinery|link}}  || vector<BuildingType> || {} || +
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|BuildBarracks|link}}  || vector<BuildingType> || {} || +
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|BuildTech|link}}  || vector<BuildingType> || {} || +
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|BuildWeapons|link}}  || vector<BuildingType> || {} || +
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|AlliedBaseDefenses|link}}  || vector<BuildingType> || {} || +
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|SovietBaseDefenses|link}}  || vector<BuildingType> || {} || +
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|ThirdBaseDefenses|link}}  || vector<BuildingType> || {} || +
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|AIForcePredictionFudge|link}}  || vector<int> || {} ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|BuildDefense|link}}  || vector<BuildingType> || {} || +
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|BuildPDefense|link}}  || vector<BuildingType> || {} || +
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|BuildAA|link}}  || vector<BuildingType> || {} || +
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|BuildHelipad|link}}  || vector<BuildingType> || {} || +
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|BuildRadar|link}}  || vector<BuildingType> || {} || +
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|ConcreteWalls|link}}  || vector<BuildingType> || {} || +
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|NSGates|link}}  || vector<BuildingType> || {} || +
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|EWGates|link}}  || vector<BuildingType> || {} || +
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|BuildNavalYard|link}}  || vector<BuildingType> || {} || +
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|BuildDummy|link}}  || vector<BuildingType> || {} || +
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|NeutralTechBuildings|link}}  || vector<BuildingType> || {} || +
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|AttackInterval|link}}  || float || 3.0 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|AttackDelay|link}}  || float || 5.0 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|PatrolScan|link}}  || float || 0.016 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|CreditReserve|link}}  || int || 1000 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|PathDelay|link}}  || float || 0.016 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|BlockagePathDelay|link}}  || int || 60 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|AutocreateTime|link}}  || float || 5.0 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|InfantryReserve|link}}  || int || 2000 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|InfantryBaseMult|link}}  || int || 2 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|PowerSurplus|link}}  || int || 50 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|BaseSizeAdd|link}}  || int || 5 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|RefineryRatio|link}}  || float || 0.16 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|RefineryLimit|link}}  || int || 4 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|BarracksRatio|link}}  || float || 0.16 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|BarracksLimit|link}}  || int || 2 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|WarRatio|link}}  || float || 0.1 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|WarLimit|link}}  || int || 2 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|DefenseRatio|link}}  || float || 0.5 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|DefenseLimit|link}}  || int || 40 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|AARatio|link}}  || float || 0.14 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|AALimit|link}}  || int || 10 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|TeslaRatio|link}}  || float || 0.16 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|TeslaLimit|link}}  || int || 10 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|HelipadRatio|link}}  || float || 0.12 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|HelipadLimit|link}}  || int || 5 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|AirstripRatio|link}}  || float || 0.12 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|AirstripLimit|link}}  || int || 5 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|CompEasyBonus|link}}  || boolean || 1 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|Paranoid|link}}  || boolean || 1 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|PowerEmergency|link}}  || float || 0.75 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|AIBaseSpacing|link}}  || int || 1 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|GDIWallDefense|link}}  || float || 6.0 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|GDIWallDefenseCoefficient|link}}  || float || 3.0 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|NodBaseDefenseCoefficient|link}}  || float || 1.0 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|GDIBaseDefenseCoefficient|link}}  || float || 1.0 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|MaximumBaseDefenseValue|link}}  || int || 60 ||
 +
|-
 +
| {{Ini|Rules}} || [AI] || {{f|ComputerBaseDefenseResponse|link}}  || int || 3 ||
 +
|}
 +
</onlyinclude>
  
 
=='''{{sl|AIGenerals}}'''==
 
=='''{{sl|AIGenerals}}'''==
 +
{{HorizontalBar|[[Image:Warning.png|left]]Recent investigation of the executable code has shown that this section is not actually parsed by the game. The text below is therefore best considered speculation from the older days, unless someone manages to actually demonstrate a noticeable effect.}}
 +
 
This section was meant to be used in TS, but was never finished. To make use of it, you must get the AI.TLB file from TS and if you are modding YR, rename it to AIMD.TLB. You must place it into RA2 directory and then you can uncomment it with no IE. These CLSID tags are actually 5 Generals, different behaviours AI can have, something like bots. You need to use TriggerTypes (I'm not talking about TeamTypes here) IsBaseDefense and then you will find a new problem. Allies are attacking Soviets and vice versa, but Allies vs Allies is one really boring match, as they are doing almost nothing. To fix this bug, you must write MANY triggers attacking specific sides (not Attack Factories, but Attack Enemy NACNST for Soviets  etc.) an if you do this, you can have better and more unpredictable AI, but Yuri is unchanged, as this was meant for GDI and Nod in TS, which are still the references for the Allies and Soviets in rules(md).ini. This section could maybe also have something with an unknown part of TriggerTypes, where Deezire says, that you could specify which General uses this Trigger. Anyway, this section is really hard work and you need to be really sure you want to do this.  Still, if you think you are an AI expert, you can try. (Deezire used this section in his modification.)
 
This section was meant to be used in TS, but was never finished. To make use of it, you must get the AI.TLB file from TS and if you are modding YR, rename it to AIMD.TLB. You must place it into RA2 directory and then you can uncomment it with no IE. These CLSID tags are actually 5 Generals, different behaviours AI can have, something like bots. You need to use TriggerTypes (I'm not talking about TeamTypes here) IsBaseDefense and then you will find a new problem. Allies are attacking Soviets and vice versa, but Allies vs Allies is one really boring match, as they are doing almost nothing. To fix this bug, you must write MANY triggers attacking specific sides (not Attack Factories, but Attack Enemy NACNST for Soviets  etc.) an if you do this, you can have better and more unpredictable AI, but Yuri is unchanged, as this was meant for GDI and Nod in TS, which are still the references for the Allies and Soviets in rules(md).ini. This section could maybe also have something with an unknown part of TriggerTypes, where Deezire says, that you could specify which General uses this Trigger. Anyway, this section is really hard work and you need to be really sure you want to do this.  Still, if you think you are an AI expert, you can try. (Deezire used this section in his modification.)
 
'''Final tip:''' By increasing {{TTL|RepairPercent|&#160;}}you'll get faster but more costly structure repair, with cost that is propably still no harm for AI and it makes AI much more annoying as it repairs everything under attack if it has enough money.
 
  
 
==See also==
 
==See also==

Latest revision as of 11:37, 25 December 2020

This page should correctly be named "[AI]"; it is wrong due to technical restrictions.


In this section of Rules(md).ini, the game's Artificial Intelligence settings are located. Note that the game's AI relies on more than just these flags, and, at least for some of us, only the slightest modification of them has sent the AI into a coma.

General Information about RA2/YR's AI

The RA2/YR AI Engine is based upon the AI engine used in TS. While theoretically an Artificial Intelligence, in reality, its behavior mostly doesn't appear very smart, mainly due to being limited to predetermined "scripts" and "events", and its default settings making it build teams and attack slowly, and construct bases that can't handle large armies.

However, the implementation of pool teams, the usage of [AIGenerals] (at least in RA2) and a significant amount of modfication to taskforces and teamtypes can deliver an impressive AI - as seen in Deezire's RA2 modification.

By the way: YR's Ai(md).ini is 136 KB big - Tiberian Sun's weights a whopping 275 KB. If you just calculate straight through it, that works out to 13,600 characters of AI code for each playable house in YR, against 137,500 characters for each playable side in TS. Although that's far from reality (doesn't take into account shared scripts), it shows how very underdeveloped the default AI in Yuri's Revenge is.

Also the AI 'cheats' with several conditions - AI controlled players are capable of building every unit regardless of Owner, Prerequisite, are able to "see" through Shroud/unexplored terrain and are capable of recognizing cloaked units.

AI-related Flags in Yuri's Revenge

In order of appearence.

Team related Flags

CloseEnough=  
If your big taskforces get stuck, increase this.
Stray=  
If you want to use bigger TaskForces, increase this. Recommended: 4-5.
RelaxedStray=  
Increasing this prevens big TaskForces to get stuck at regroup and gather command. Recommended: 5-7.
GuardModeStray=  
Again, if you want to use bigger TaskForces, increase this. Recommended: 3-4.
TeamDelays=  
This number says how often the AI checks for creating a TeamType in frames. Decreasing it is maybe the best thing you can ever do for the AI. Brutal, Medium, Easy. Recommended: <100.
AIHateDelays=  
Delay in frames before AI chooses an enemy. Keep it low.
MultiplayerAICM=  
Percent of addition money for AI. If you want your AI to have plenty of money, increase, but have more dogs guarding AI bases becouse if player's spy gets into an AI refinery, he gets a LOT of money. Brutal, Medium, Easy.
AIVirtualPurifiers=  
Same as above. 1 gives 25% bonus to money. Brutal, Medium, Easy.
HarvestersPerRefinery=  
Do not edit this. Only one AI will build additional harvesters and others will get stuck.
AIExtraRefineries=  
Same as above, but decreasing this can give AI more free space in base, and AI can replace a refinery fast. (but it also has less harvesters then, and less money) If you have big TaskForces and need space in base, decrease to 0,0,0 and increase AICM or VirtualPurifiers.
MinimumAIDefensiveTeams=  
Recommended:3-5.
MaximumAIDefensiveTeams=  
Maximum number of IsBaseDefense=yes TeamTypes the AI will build. Should be higher than minimum. Recomennded:5-7.
TotalAITeamCap=  
Maximum of teams used by AI. Good idea to increase, but not too much if you haven't done something to give the AI more free space.

Super Weapon related Flags

The following flags control how likely a certain category of buildings is to be chosen as a target when an AI fires a Weather Storm or Nuclear Missile.

AIIonCannonConYardValue=  
Value of buildings with ConstructionYard=yes
AIIonCannonWarFactoryValue=  
Value of buildings with WeaponsFactory=yes
AIIonCannonPowerValue=  
Value of buildings with Power= >0
AIIonCannonTechCenterValue=  
Value of BattleLabs
AIIonCannonEngineerValue=  
Value of Engineers
AIIonCannonThiefValue=  
Value of Thieves (Logic still present in RA2)
AIIonCannonHarvesterValue=  
Value of Harvesters
AIIonCannonMCVValue=  
Value of MCVs
AIIonCannonAPCValue=  
Value of Transports
AIIonCannonBaseDefenseValue=  
Value of buildings with IsBaseDefense=yes
AIIonCannonPlugValue=  
Value of buildings with IsPlug=yes-if you give IsPlug=yes to for example, SWs,this is their value. Of course, you must delete the comment first, or you get an IE.
AIIonCannonHelipadValue=  
Value of buildings with HoverPad=yes. Deleting the comment fixes HoverPad SW targeting IE.
AIIonCannonTempleValue=  
Value of buildings with IsTemple=yes. Same as with Plug. Tip- use for SWs,refineries or with Purifiers/Vats/Plants

Base & Building related Flags

AISafeDistance=  
Distance from enemy/own base at which AI will execute the gather/regroup command. If your AI builds large bases, increase.
AIMinorSuperReadyPercent=  
If Iron Curtain or Chronosphere is this charged, AI will start preparing teams which make use of it. Decrease if you have long-building Chrono or Curtain teams.
AlliedBaseDefenseCounts= 
SovietBaseDefenseCounts= 
ThirdBaseDefenseCounts= 
Numbers are ordered Brutal, Medium, Easy. These are the number of defense buildings the AI will build for each side. If these are too high, AI just builds defenses and somehow forgets other buildings, also it then builds defense "chains". If you get total control of what AI builds when, then set defenses to be build later, increase this number to a very high number like 100, and you have nice ring of defenses around the AI base. If you want AI to have many defenses, but it always builds those chains, you can simply disable defenses and use tons of cloned buildings, that allows you to control when AI builds each building including defenses and things like sending SHK to all TESLA thanks to different building IDs.
AISuperDefenseProbability=  
Probability that AI will use the Force Shield when attacked by major SWs. Recommended:99
AISuperDefenseFrames=  
If the Force Shield is not ready when AI is attacked by major SWs, it can wait maximally this long or it will not fire. Set to as high as is the shortest delay before nuke hits, storm starts etc.
NodRegularPower= 
GDIPowerPlant= 
ThirdPowerPlant= 
These list the power plants that are built by the AI when it needs more power (All powerplants AI builds are this, except first one). It is a good idea to set this to the powerplant with highest Power=  your mod has for that side, even for the Soviets (having NANRCT is risky, but it saves much space) If you want AI to have more space, make high output powerplant for every side and set this to it.

Build*

Each of these Flags accepts only one building for its value.

BuildConst=  
Have all your Construction Yards here.
BuildPower=  
This is the first powerplant AI builds. You can have NANRCT (the Nuclear Reactor) here if you want, but it will look strange. Also, this reads only one power plant per side so having here both NAPOWR (regular Tesla Reactor) and NANRCT just builds NAPOWR.
BuildRefinery=  
Have all your refineries here, even if they use Slave Miner logic.
BuildBarracks=  
Have all your barracks here.
BuildTech=  
Have all your Battle Labs here.
BuildWeapons=  
Have all your War Factories here
BuildRadar=  
Have all your Radars here
BuildHelipad=  
Have all your "Helipad=yes" buildings here.
ConcreteWalls=  
Have all your walls here. These will be built around ProtectWithWall buildings, so if you replace GAWALL (Allied Walls) with GAPILL (Allied Pillbox, it will build pillboxes around those buildings and the AI will be slower than ever before.
BuildNavalYard=  
Have all your Naval Yards here.
BuildDefense=  
Used for standard defenses, but obsolete in YR
BuildPDefense=  
Used for power consuming defenses, obsolete in YR
BuildAA=  
Used for AA defenses, obsolete in YR

Defenses

AlliedBaseDefenses= 
SovietBaseDefenses= 
ThirdBaseDefenses= 
Have your defense buildings listed here. This can take unlimited number of these buildings, buildings listed here ignore BuildLimit and if you set it for country specific buildings like GTGCAN (French Grand Cannnon), it will build them for the whole side, that is why some modders prefer to clone Grand Cannon. Maximum of these buildings built is specified by XXXBaseDefenseCounts=, numbers of specific buildings built change with AIForcePredictionFudge and their AntiXXXValue.

Resource related Flags

AIForcePredictionFudge=  
AI chooses its defenses by analyzing units of player it chose as its enemy, and make weighted distribution of defense based on their AntiXXXValue. It is good to try to experiment with this value, sometimes lower can be better than higher, and combine this with extreme changes in defenses AntiXXXValues.
MaximumBaseDefenseValue=  
Comments in Rulesmd say it is obsolete, but changing this to very high values (like 4000) can have interesting results, but it will make AI concentrate on building defenses only and so you need again more control of what AI builds when.
CreditReserve=  
AI will repair buildings only if it has more than this amount of credits.
PowerSurplus=  
AI will build power plants until it has this amount of surplus power.
BaseSizeAdd=  
Increasing this to very high numbers can make AI build huge bases, but only increases number of power plants and defenses as it cannot build more factories or refineries. You should increase it if you increased XXXBaseDefenseCounts=.
PowerEmergency=  
AI will sell buildings if it has less than this percent of power.
AIBaseSpacing=  
This is average space AI will leave between its buildings. Increase only if you have only few buildings or replaced maps with some that have more space for bases or in map files.

Final tip: By increasing RepairPercent= you'll get faster but more costly structure repair, with cost that is propably still no harm for AI and it makes AI much more annoying as it repairs everything under attack if it has enough money.

[AI] in Rules(md).ini

Applicable INI Flags

These tables show all INI flags applicable1 to AI. The flags are grouped by the internal classes the flags are inherited from, and then listed in the order they are read in by the game. You can re-sort the rows by column values by clicking the arrow icons in the column headings. Each flag can be clicked to visit its page for detailed information.

Please note that this section is accurate only for Yuri's Revenge. All other C&C games use different sets of flags.

1 "Applicable" in this context means "read from the INI files". Certain flags listed here don't have any effect ingame , but they are read and in certain cases cause a crash if not present. Again, refer to each flag's individual page for detailed information.


[AI]
INI File Section Key Value Type Default Value Adds to list
Rules(md).ini [AI] BuildConst vector<BuildingType> {} +
Rules(md).ini [AI] BuildPower vector<BuildingType> {} +
Rules(md).ini [AI] BuildRefinery vector<BuildingType> {} +
Rules(md).ini [AI] BuildBarracks vector<BuildingType> {} +
Rules(md).ini [AI] BuildTech vector<BuildingType> {} +
Rules(md).ini [AI] BuildWeapons vector<BuildingType> {} +
Rules(md).ini [AI] AlliedBaseDefenses vector<BuildingType> {} +
Rules(md).ini [AI] SovietBaseDefenses vector<BuildingType> {} +
Rules(md).ini [AI] ThirdBaseDefenses vector<BuildingType> {} +
Rules(md).ini [AI] AIForcePredictionFudge vector<int> {}
Rules(md).ini [AI] BuildDefense vector<BuildingType> {} +
Rules(md).ini [AI] BuildPDefense vector<BuildingType> {} +
Rules(md).ini [AI] BuildAA vector<BuildingType> {} +
Rules(md).ini [AI] BuildHelipad vector<BuildingType> {} +
Rules(md).ini [AI] BuildRadar vector<BuildingType> {} +
Rules(md).ini [AI] ConcreteWalls vector<BuildingType> {} +
Rules(md).ini [AI] NSGates vector<BuildingType> {} +
Rules(md).ini [AI] EWGates vector<BuildingType> {} +
Rules(md).ini [AI] BuildNavalYard vector<BuildingType> {} +
Rules(md).ini [AI] BuildDummy vector<BuildingType> {} +
Rules(md).ini [AI] NeutralTechBuildings vector<BuildingType> {} +
Rules(md).ini [AI] AttackInterval float 3.0
Rules(md).ini [AI] AttackDelay float 5.0
Rules(md).ini [AI] PatrolScan float 0.016
Rules(md).ini [AI] CreditReserve int 1000
Rules(md).ini [AI] PathDelay float 0.016
Rules(md).ini [AI] BlockagePathDelay int 60
Rules(md).ini [AI] AutocreateTime float 5.0
Rules(md).ini [AI] InfantryReserve int 2000
Rules(md).ini [AI] InfantryBaseMult int 2
Rules(md).ini [AI] PowerSurplus int 50
Rules(md).ini [AI] BaseSizeAdd int 5
Rules(md).ini [AI] RefineryRatio float 0.16
Rules(md).ini [AI] RefineryLimit int 4
Rules(md).ini [AI] BarracksRatio float 0.16
Rules(md).ini [AI] BarracksLimit int 2
Rules(md).ini [AI] WarRatio float 0.1
Rules(md).ini [AI] WarLimit int 2
Rules(md).ini [AI] DefenseRatio float 0.5
Rules(md).ini [AI] DefenseLimit int 40
Rules(md).ini [AI] AARatio float 0.14
Rules(md).ini [AI] AALimit int 10
Rules(md).ini [AI] TeslaRatio float 0.16
Rules(md).ini [AI] TeslaLimit int 10
Rules(md).ini [AI] HelipadRatio float 0.12
Rules(md).ini [AI] HelipadLimit int 5
Rules(md).ini [AI] AirstripRatio float 0.12
Rules(md).ini [AI] AirstripLimit int 5
Rules(md).ini [AI] CompEasyBonus boolean 1
Rules(md).ini [AI] Paranoid boolean 1
Rules(md).ini [AI] PowerEmergency float 0.75
Rules(md).ini [AI] AIBaseSpacing int 1
Rules(md).ini [AI] GDIWallDefense float 6.0
Rules(md).ini [AI] GDIWallDefenseCoefficient float 3.0
Rules(md).ini [AI] NodBaseDefenseCoefficient float 1.0
Rules(md).ini [AI] GDIBaseDefenseCoefficient float 1.0
Rules(md).ini [AI] MaximumBaseDefenseValue int 60
Rules(md).ini [AI] ComputerBaseDefenseResponse int 3


[AIGenerals]

Warning.png
Recent investigation of the executable code has shown that this section is not actually parsed by the game. The text below is therefore best considered speculation from the older days, unless someone manages to actually demonstrate a noticeable effect.

This section was meant to be used in TS, but was never finished. To make use of it, you must get the AI.TLB file from TS and if you are modding YR, rename it to AIMD.TLB. You must place it into RA2 directory and then you can uncomment it with no IE. These CLSID tags are actually 5 Generals, different behaviours AI can have, something like bots. You need to use TriggerTypes (I'm not talking about TeamTypes here) IsBaseDefense and then you will find a new problem. Allies are attacking Soviets and vice versa, but Allies vs Allies is one really boring match, as they are doing almost nothing. To fix this bug, you must write MANY triggers attacking specific sides (not Attack Factories, but Attack Enemy NACNST for Soviets etc.) an if you do this, you can have better and more unpredictable AI, but Yuri is unchanged, as this was meant for GDI and Nod in TS, which are still the references for the Allies and Soviets in rules(md).ini. This section could maybe also have something with an unknown part of TriggerTypes, where Deezire says, that you could specify which General uses this Trigger. Anyway, this section is really hard work and you need to be really sure you want to do this. Still, if you think you are an AI expert, you can try. (Deezire used this section in his modification.)

See also