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
(Major reworking of page using the Styleguide)
(I suggest reading the styleguide next time ;) ...it's still not pretty, but at least organized and not ''against'' the styleguide.)
Line 1: Line 1:
 
{{WrongTitle|[{{PAGENAME}}]}}
 
{{WrongTitle|[{{PAGENAME}}]}}
  
In this section of [[Rules|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.
+
In this section of {{rules}}, 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.
  
==See also==
+
==General Information about RA2/YR's AI==
*[[:Category:{{PAGENAME}} Flags]]
+
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.
*[[IQ|<tt>[IQ]</tt>]]
 
*[[ai.ini|ai(md).ini]]
 
  
[[Category:{{PAGENAME}} Flags| ]]
+
However, the implementation of pool teams, the usage of {{sl|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.
[[Category:Rules(md).ini Sections]]
 
[[Category:General Editing Information]]
 
  
 +
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.
  
=General information about RA2/YR's Artificial Intelligence=
+
==AI-related Flags in {{yr}}==
 +
In order of appearence.
  
'''Allied General's information on the AI'''
+
===Team related Flags===
 +
; {{TTL|CloseEnough|&#160;}} : If your big taskforces get stuck, increase this.
 +
; {{TTL|Stray|&#160;}} : If you want to use bigger TaskForces, increase this. Recommended: 4-5.
 +
; {{TTL|RelaxedStray|&#160;}} : Increasing this prevens big TaskForces to get stuck at regroup and gather command. Recommended: 5-7.
 +
; {{TTL|GuardModeStray|&#160;}} : 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.
 +
; {{TTL|AIHateDelays|&#160;}} : 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.
 +
; {{TTL|AIVirtualPurifiers|&#160;}} : 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.
 +
; {{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.
 +
; {{TTL|MinimumAIDefensiveTeams|&#160;}} : 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.
 +
; {{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.
  
RA2/YR AI Engine is based upon the AI engine used in TS.
+
===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.
 +
; {{TTL|AIIonCannonConYardValue|&#160;}} : Value of buildings with {{TTL|ConstructionYard|yes}}
 +
; {{TTL|AIIonCannonWarFactoryValue|&#160;}} : Value of buildings with {{TTL|WeaponsFactory|yes}}
 +
; {{TTL|AIIonCannonPowerValue|&#160;}} : Value of buildings with {{TTL|Power|&#160;}}>0
 +
; {{TTL|AIIonCannonTechCenterValue|&#160;}} : Value of BattleLabs
 +
; {{TTL|AIIonCannonEngineerValue|&#160;}} : Value of Engineers
 +
; {{TTL|AIIonCannonThiefValue|&#160;}} : Value of Thieves (Logic still present in RA2)
 +
; {{TTL|AIIonCannonHarvesterValue|&#160;}} : Value of Harvesters
 +
; {{TTL|AIIonCannonMCVValue|&#160;}} : Value of MCVs
 +
; {{TTL|AIIonCannonAPCValue|&#160;}} : Value of Transports
 +
; {{TTL|AIIonCannonBaseDefenseValue|&#160;}} : Value of buildings with {{TTL|IsBaseDefense|yes}}
 +
; {{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.
 +
; {{TTL|AIIonCannonHelipadValue|&#160;}} : Value of buildings with {{TTL|HoverPad|yes}}. 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
  
The AI in RA2/YR is very dumb for the following reasons.
+
===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.     
 +
; {{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.
 +
; {{TTL|AlliedBaseDefenseCounts|&#160;}}
 +
; {{TTL|SovietBaseDefenseCounts|&#160;}}
 +
; {{TTL|ThirdBaseDefenseCounts|&#160;}}
 +
: 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
 +
; {{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.
 +
; {{TTL|NodRegularPower|&#160;}}
 +
; {{TTL|GDIPowerPlant|&#160;}}
 +
; {{TTL|ThirdPowerPlant|&#160;}}
 +
: 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.
 +
====Build*====
 +
Each of these Flags accepts only '''one''' building for its value.
 +
; {{TTL|BuildConst|&#160;}} : 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.
 +
; {{TTL|BuildRefinery|&#160;}} : Have all your refineries here, even if they use Slave Miner logic.
 +
; {{TTL|BuildBarracks|&#160;}} : Have all your barracks here.
 +
; {{TTL|BuildTech|&#160;}} : Have all your Battle Labs here.
 +
; {{TTL|BuildWeapons|&#160;}} : Have all your War Factories here
 +
; {{TTL|BuildRadar|&#160;}} : 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.
 +
; {{TTL|BuildNavalYard|&#160;}} : Have all your Naval Yards here.
 +
; {{TTL|BuildDefense|&#160;}} : Used for standard defenses, but obsolete in YR
 +
; {{TTL|BuildPDefense|&#160;}} : Used for power consuming defenses, obsolete in YR
 +
; {{TTL|BuildAA|&#160;}} : Used for AA defenses, obsolete in YR
  
* it takes ages to assemble teams
+
====Defenses====
* it builds tiny bases
+
; {{TTL|AlliedBaseDefenses|&#160;}}
* it attacks infrequently and in small numbers
+
; {{TTL|SovietBaseDefenses|&#160;}}
* it actions are based upon predetermined "scripts" and "events"
+
; {{TTL|ThirdBaseDefenses|&#160;}}
 +
: 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.
  
However implementation of pool teams, <tt>[[AIGenerals|[AIGenerals]]]</tt> (mainly for RA2) and a significant amount of modfication to taskforces and teamtypes can deliver an impressive AI as seen in Deezire's RA2 modification.
+
===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.
 +
; {{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.
 +
; {{TTL|CreditReserve|&#160;}} : 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.
 +
; {{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=.
 +
; {{TTL|PowerEmergency|&#160;}} : 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.
  
 +
=='''{{sl|AIGenerals}}'''==
 +
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. I think Deezire used it in his mod, but I'm not sure.
  
'''Kiith-Sa's information on the rulesmd.ini AI tags'''
+
'''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==
 +
*[[:Category:{{PAGENAME}} Flags]]
 +
*{{sl|IQ}}
 +
*{{ai}}
  
* <tt>[[CloseEnough|CloseEnough=]]</tt> - If your big taskforces get stuck, increase this.
+
[[Category:{{PAGENAME}} Flags| ]]
 
+
[[Category:Rules(md).ini Sections]]
* <tt>[[Stray|Stray=]]</tt>          - If you want to use bigger TaskForces, increase this. Recommended: 4-5.
+
[[Category:General Editing Information]]
 
 
* <tt>[[RelaxedStray|RelaxedStray=]]</tt>  - Increasing this prevens big TaskForces to get stuck at regroup and gather command. Recommended: 5-7.
 
 
 
* <tt>[[GuardModeStray|GuardModeStray=]]</tt> - Again, if you want to use bigger TaskForces, increase this. Recommended: 3-4.
 
 
 
* <tt>[[TeamDelays|TeamDelays=]]</tt>        - 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.
 
 
 
* <tt>[[AIHateDelays|AIHateDelays=]]</tt>      - Delay in frames before AI chooses an enemy. Keep it low.
 
 
 
* <tt>[[MultiplayerAICM|MultiplayerAICM=]]</tt>    - 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.
 
 
 
* <tt>[[AIVirtualPurifiers|AIVirtualPurifiers=]]</tt> - Same as above. 1 gives 25% bonus to money. Brutal, Medium, Easy.
 
 
 
* <tt>[[HarvestersPerRefinery|HarvestersPerRefinery=]]</tt> - Do not edit this. Only one AI will build additional harvesters and others will get stuck.
 
 
 
* <tt>[[AIExtraRefineries|AIExtraRefineries=]]</tt> - 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.
 
 
 
* <tt>[[MinimumAIDefensiveTeams|MinimumAIDefensiveTeams=]]</tt> - Minimum number of <tt>[[IsBaseDefense|IsBaseDefense=yes]]</tt> TeamTypes AI will build. If it is higher than max number of <tt>[[IsBaseDefense|IsBaseDefense=yes]]</tt> TeamTypes AI can build, it will get stuck causing Soviet (But if high enough, also Allied and Yuri) dead AI issue. To prevent this, just make more <tt>[[IsBaseDefense|IsBaseDefense=yes]]</tt> Teamtypes or increase their <tt>[[Max|Max=]]</tt>. Recommended:3-5.
 
 
 
* <tt>[[MaximumAIDefensiveTeams|MaximumAIDefensiveTeams=]]</tt> - Maximum number of <tt>[[IsBaseDefense|IsBaseDefense=yes]]</tt> TeamTypes the AI will build. Should be higher than minimum. Recomennded:5-7.
 
 
 
* <tt>[[TotalAITeamCap|TotalAITeamCap=]]</tt> - 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.
 
 
 
The following tags are the absolute ordering of targets when AI fires a Weather Storm or Nuclear Missile.<br>
 
Basic tag description:
 
 
 
* <tt>[[AIIonCannonConYardValue|AIIonCannonConYardValue=]]</tt>  - Value of buildings with <tt>[[ConstructionYard|ConstructionYard=yes]]</tt>
 
* <tt>[[AIIonCannonWarFactoryValue|AIIonCannonWarFactoryValue=]]</tt> - Value of buildings with <tt>[[WeaponsFactory|WeaponsFactory=yes]]</tt>
 
* <tt>[[AIIonCannonPowerValue|AIIonCannonPowerValue=]]</tt>      - Value of buildings with <tt>[[Power|Power=]]</tt> above 0
 
* <tt>[[AIIonCannonTechCenterValue|AIIonCannonTechCenterValue=]]</tt> - Value of BattleLabs
 
* <tt>[[AIIonCannonEngineerValue|AIIonCannonEngineerValue=]]</tt>  - Value of Engineers
 
* <tt>[[AIIonCannonThiefValue|AIIonCannonThiefValue=]]</tt>      - Value of Thieves (Logic still present in RA2)
 
* <tt>[[AIIonCannonHarvesterValue|AIIonCannonHarvesterValue=]]</tt>  - Value of Harvesters
 
* <tt>[[AIIonCannonMCVValue|AIIonCannonMCVValue=]]</tt>        - Value of MCVs
 
* <tt>[[AIIonCannonAPCValue|AIIonCannonAPCValue=]]</tt>        - Value of Transports
 
* <tt>[[AIIonCannonBaseDefenseValue|AIIonCannonBaseDefenseValue=]]</tt> - Value of buildings with <tt>[[IsBaseDefense|IsBaseDefense=yes]]</tt>
 
* <tt>[[AIIonCannonPlugValue|AIIonCannonPlugValue=]]</tt>      - Value of buildings with <tt>[[IsPlug|IsPlug=yes]]</tt>-if you give <tt>[[IsPlug|IsPlug=yes]]</tt> to for example, SWs,this is their value. Of course, you must delete the comment first, or you get an IE.
 
* <tt>[[AIIonCannonHelipadValue|AIIonCannonHelipadValue=]]</tt>  - Value of buildings with <tt>[[HoverPad|HoverPad=yes]]</tt>. Deleting the comment fixes HoverPad SW targeting IE.
 
* <tt>[[AIIonCannonTempleValue|AIIonCannonTempleValue=]]</tt>    - Value of buildings with <tt>[[IsTemple|IsTemple=yes]]</tt>. Same as with Plug. Tip- use for SWs,refineries or with Purifiers/Vats/Plants
 
 
 
* <tt>[[AISafeDistance|AISafeDistance=]]</tt> - Distance from enemy/own base at which AI will execute the gather/regroup command. If your AI builds large bases, increase.     
 
 
 
* <tt>[[AIMinorSuperReadyPercent|AIMinorSuperReadyPercent=]]</tt>  - 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.
 
 
 
* <tt>[[AlliedBaseDefenseCounts|AlliedBaseDefenseCounts=]]</tt>
 
* <tt>[[SovietBaseDefenseCounts|SovietBaseDefenseCounts=]]</tt>
 
* <tt>[[ThirdBaseDefenseCounts|ThirdBaseDefenseCounts=]]</tt>
 
* Notes on BaseDefenseCounts tags:  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. 
 
 
 
* <tt>[[AISuperDefenseProbability|AISuperDefenseProbability=]]</tt> - Probability that AI will use the Force Shield when attacked by major SWs. Recommended:99
 
 
 
* <tt>[[AISuperDefenseFrames|AISuperDefenseFrames=]]</tt> - 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.
 
 
 
* <tt>[[NodRegularPower|NodRegularPower=]]</tt>
 
* <tt>[[GDIPowerPlant|GDIPowerPlant=]]</tt>
 
* <tt>[[ThirdPowerPlant|ThirdPowerPlant=]]</tt>
 
* Notes on the PowerPlant tags: 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 <tt>[[Power|Power=]]</tt> 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.
 
 
 
 
 
* A note on <tt>[[BuildingTypes|[BuildingTypes]]]</tt>:
 
As jkraska discovered, AI goes down trough the building type list building buildings as they
 
are listed here. If it can't build next building, it starts again checking for its
 
<tt>[[Prerequisite|Prerequisites=]]</tt>. This means, that if you have GAWEAT higher in list than GACSPH, like:
 
 
 
<tt><pre>17=GAWEAT
 
...
 
22=GACSPH</pre></tt>
 
 
 
it will build Weather Conrol first and Chronosphere later.
 
Of course it builds only buildings with <tt>[[AIBuildThis|AIBuildThis=yes]]</tt>.
 
Through playing with building clones, changing positions of buildings in this list,
 
and Prerequisites, you can get pretty good control of what AI builds when,
 
but you will mess up <tt>[[ScriptTypes|ScriptTypes]]</tt> and have to fix them.
 
 
 
 
 
* <tt>BuildXXX</tt> - All of these read only 1 building per side including <tt>[[ConcreteWalls]]</tt>.
 
 
 
* <tt>[[BuildConst|BuildConst=]]</tt> - Have all your Construction Yards here.
 
* <tt>[[BuildPower|BuildPower=]]</tt> - 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.
 
* <tt>[[BuildRefinery|BuildRefinery=]]</tt> - Have all your refineries here, even if they use Slave Miner logic.
 
* <tt>[[BuildBarracks|BuildBarracks=]]</tt> - Have all your barracks here.
 
* <tt>[[BuildTech|BuildTech=]]</tt>    - Have all your Battle Labs here.
 
* <tt>[[BuildWeapons|BuildWeapons=]]</tt>  - Have all your War Factories here
 
* <tt>[[BuildRadar|BuildRadar=]]</tt>    - Have all your Radars here
 
* <tt>[[ConcreteWalls|ConcreteWalls=]]</tt> - 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.
 
* <tt>[[BuildNavalYard|BuildNavalYard=]]</tt> - Have all your Naval Yards here.
 
 
 
* <tt>[[BuildDefense|BuildDefense=]]</tt>  - Used for standard defenses, but obsolete in YR
 
* <tt>[[BuildPDefense|BuildPDefense=]]</tt> - Used for power consuming defenses, obsolete in YR
 
* <tt>[[BuildAA|BuildAA=]]</tt>      - Used for AA defenses, obsolete in YR
 
 
 
* <tt>[[AlliedBaseDefenses|AlliedBaseDefenses=]]</tt>
 
* <tt>[[SovietBaseDefenses|SovietBaseDefenses=]]</tt>
 
* <tt>[[ThirdBaseDefenses|ThirdBaseDefenses=]]</tt>
 
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 <tt>[[AIForcePredictionFudge]]</tt> and their AntiXXXValue.
 
 
 
* <tt>[[AIForcePredictionFudge|AIForcePredictionFudge=]]</tt> - 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.
 
 
 
* <tt>[[MaximumBaseDefenseValue|MaximumBaseDefenseValue=]]</tt> - 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.
 
 
 
* <tt>[[CreditReserve|CreditReserve=]]</tt> - AI will repair buildings only if it has more than this amount of credits.
 
 
 
* <tt>[[PowerSurplus|PowerSurplus=]]</tt> - AI will build power plants until it has this amount of surplus power.
 
 
 
* <tt>[[BaseSizeAdd|BaseSizeAdd=]]</tt>  - 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=.
 
 
 
* <tt>[[PowerEmergency|PowerEmergency=]]</tt> - AI will sell buildings if it has less than this percent of power.
 
 
 
* <tt>[[AIBaseSpacing|AIBaseSpacing=]]</tt> - 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.
 
 
 
* <tt>[[AIGenerals|[AIGenerals]]]</tt> - 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 thik you are an AI expert, you can try. I think Deezire used it in his mod, but I'm not sure.
 
 
 
 
 
* AI Tips: By increasing <tt>[[RepairPercent|RepairPercent=]]</tt> and lowering <tt>[[RepairRate|RepairRate=]]</tt> 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(MD).INI TIPS:
 
1: AI wont deploy the Siege Chopper.
 
If you want to make the AI use it, you must make it fire from air and use normal attacking script.
 
 
 
2: If you have a transport in your TaskForce, you can have ONLY 1 with transporting scripts.
 
If you have more, the AI will get stuck with it. Also, other units must exactly fit to the transport, so:<br>
 
0 = 1 , HTK<br>
 
1 = 4 , IVAN  -or 6<br>
 
doesnt work.<br>
 
but 5 does as IVAN has <tt>[[Size|Size=1]]</tt> and HTK has <tt>[[Passengers|Passengers=5]]</tt>
 
You can have max of 2 transports by using TeamType 2 in the trigger.
 
 
 
3 :If you use both teamtypes 1+2 to double your TaskForce, check the <tt>[[Max|Max=]]</tt> of them if AI builds only one.
 

Revision as of 18:42, 27 October 2006

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.

AI-related Flags in Yuri's Revenge

In order of appearence.

Team related Flags

Template:TTL 
If your big taskforces get stuck, increase this.
Template:TTL 
If you want to use bigger TaskForces, increase this. Recommended: 4-5.
Template:TTL 
Increasing this prevens big TaskForces to get stuck at regroup and gather command. Recommended: 5-7.
Template:TTL 
Again, if you want to use bigger TaskForces, increase this. Recommended: 3-4.
Template:TTL 
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.
Template:TTL 
Delay in frames before AI chooses an enemy. Keep it low.
Template:TTL 
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.
Template:TTL 
Same as above. 1 gives 25% bonus to money. Brutal, Medium, Easy.
Template:TTL 
Do not edit this. Only one AI will build additional harvesters and others will get stuck.
Template:TTL 
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.
Template:TTL 
Recommended:3-5.
Template:TTL 
Maximum number of Template:TTL TeamTypes the AI will build. Should be higher than minimum. Recomennded:5-7.
Template:TTL 
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.

Template:TTL 
Value of buildings with Template:TTL
Template:TTL 
Value of buildings with Template:TTL
Template:TTL 
Value of buildings with Template:TTL>0
Template:TTL 
Value of BattleLabs
Template:TTL 
Value of Engineers
Template:TTL 
Value of Thieves (Logic still present in RA2)
Template:TTL 
Value of Harvesters
Template:TTL 
Value of MCVs
Template:TTL 
Value of Transports
Template:TTL 
Value of buildings with Template:TTL
Template:TTL 
Value of buildings with Template:TTL-if you give Template:TTL to for example, SWs,this is their value. Of course, you must delete the comment first, or you get an IE.
Template:TTL 
Value of buildings with Template:TTL. Deleting the comment fixes HoverPad SW targeting IE.
Template:TTL 
Value of buildings with Template:TTL. Same as with Plug. Tip- use for SWs,refineries or with Purifiers/Vats/Plants

Base & Building related Flags

Template:TTL 
Distance from enemy/own base at which AI will execute the gather/regroup command. If your AI builds large bases, increase.
Template:TTL 
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.
Template:TTL
Template:TTL
Template:TTL
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.
Template:TTL 
Probability that AI will use the Force Shield when attacked by major SWs. Recommended:99
Template:TTL 
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.
Template:TTL
Template:TTL
Template:TTL
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 Template:TTL 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.

Template:TTL 
Have all your Construction Yards here.
Template:TTL 
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.
Template:TTL 
Have all your refineries here, even if they use Slave Miner logic.
Template:TTL 
Have all your barracks here.
Template:TTL 
Have all your Battle Labs here.
Template:TTL 
Have all your War Factories here
Template:TTL 
Have all your Radars here
Template:TTL 
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.
Template:TTL 
Have all your Naval Yards here.
Template:TTL 
Used for standard defenses, but obsolete in YR
Template:TTL 
Used for power consuming defenses, obsolete in YR
Template:TTL 
Used for AA defenses, obsolete in YR

Defenses

Template:TTL
Template:TTL
Template:TTL
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 Template:TTL and their AntiXXXValue.

Resource related Flags

Template:TTL 
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.
Template:TTL 
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.
Template:TTL 
AI will repair buildings only if it has more than this amount of credits.
Template:TTL 
AI will build power plants until it has this amount of surplus power.
Template:TTL 
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=.
Template:TTL 
AI will sell buildings if it has less than this percent of power.
Template:TTL 
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.

[AIGenerals]

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. I think Deezire used it in his mod, but I'm not sure.

Final tip: By increasing Template:TTLyou'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