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

AI: Difference between revisions

From ModEnc
Jump to navigation Jump to search
Added note about AI cheats
Appendix - Listing Applicable INI flags, fragging AIGenerals
Line 88: Line 88:
; {{TTL|PowerEmergency| }} : AI will sell buildings if it has less than this percent of power.
; {{TTL|PowerEmergency| }} : AI will sell buildings if it has less than this percent of power.
; {{TTL|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.
; {{TTL|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 {{TTL|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 {{Ini|Rules}} ==
=== Applicable INI Flags ===
{{Applicable INI Flags}}
<onlyinclude>
{{Applicable INI Flags Header|[AI]}}
|-
| {{Ini|Rules}} || [AI] || {{TTL|BuildConst}}  || vector<BuildingType> || {} || +
|-
| {{Ini|Rules}} || [AI] || {{TTL|BuildPower}}  || vector<BuildingType> || {} || +
|-
| {{Ini|Rules}} || [AI] || {{TTL|BuildRefinery}}  || vector<BuildingType> || {} || +
|-
| {{Ini|Rules}} || [AI] || {{TTL|BuildBarracks}}  || vector<BuildingType> || {} || +
|-
| {{Ini|Rules}} || [AI] || {{TTL|BuildTech}}  || vector<BuildingType> || {} || +
|-
| {{Ini|Rules}} || [AI] || {{TTL|BuildWeapons}}  || vector<BuildingType> || {} || +
|-
| {{Ini|Rules}} || [AI] || {{TTL|AlliedBaseDefenses}}  || vector<BuildingType> || {} || +
|-
| {{Ini|Rules}} || [AI] || {{TTL|SovietBaseDefenses}}  || vector<BuildingType> || {} || +
|-
| {{Ini|Rules}} || [AI] || {{TTL|ThirdBaseDefenses}}  || vector<BuildingType> || {} || +
|-
| {{Ini|Rules}} || [AI] || {{TTL|AIForcePredictionFudge}}  || vector<int> || {} ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|BuildDefense}}  || vector<BuildingType> || {} || +
|-
| {{Ini|Rules}} || [AI] || {{TTL|BuildPDefense}}  || vector<BuildingType> || {} || +
|-
| {{Ini|Rules}} || [AI] || {{TTL|BuildAA}}  || vector<BuildingType> || {} || +
|-
| {{Ini|Rules}} || [AI] || {{TTL|BuildHelipad}}  || vector<BuildingType> || {} || +
|-
| {{Ini|Rules}} || [AI] || {{TTL|BuildRadar}}  || vector<BuildingType> || {} || +
|-
| {{Ini|Rules}} || [AI] || {{TTL|ConcreteWalls}}  || vector<BuildingType> || {} || +
|-
| {{Ini|Rules}} || [AI] || {{TTL|NSGates}}  || vector<BuildingType> || {} || +
|-
| {{Ini|Rules}} || [AI] || {{TTL|EWGates}}  || vector<BuildingType> || {} || +
|-
| {{Ini|Rules}} || [AI] || {{TTL|BuildNavalYard}}  || vector<BuildingType> || {} || +
|-
| {{Ini|Rules}} || [AI] || {{TTL|BuildDummy}}  || vector<BuildingType> || {} || +
|-
| {{Ini|Rules}} || [AI] || {{TTL|NeutralTechBuildings}}  || vector<BuildingType> || {} || +
|-
| {{Ini|Rules}} || [AI] || {{TTL|AttackInterval}}  || float || 3.0 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|AttackDelay}}  || float || 5.0 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|PatrolScan}}  || float || 0.016 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|CreditReserve}}  || int || 1000 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|PathDelay}}  || float || 0.016 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|BlockagePathDelay}}  || int || 60 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|AutocreateTime}}  || float || 5.0 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|InfantryReserve}}  || int || 2000 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|InfantryBaseMult}}  || int || 2 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|PowerSurplus}}  || int || 50 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|BaseSizeAdd}}  || int || 5 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|RefineryRatio}}  || float || 0.16 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|RefineryLimit}}  || int || 4 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|BarracksRatio}}  || float || 0.16 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|BarracksLimit}}  || int || 2 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|WarRatio}}  || float || 0.1 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|WarLimit}}  || int || 2 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|DefenseRatio}}  || float || 0.5 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|DefenseLimit}}  || int || 40 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|AARatio}}  || float || 0.14 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|AALimit}}  || int || 10 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|TeslaRatio}}  || float || 0.16 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|TeslaLimit}}  || int || 10 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|HelipadRatio}}  || float || 0.12 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|HelipadLimit}}  || int || 5 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|AirstripRatio}}  || float || 0.12 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|AirstripLimit}}  || int || 5 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|CompEasyBonus}}  || boolean || 1 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|Paranoid}}  || boolean || 1 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|PowerEmergency}}  || float || 0.75 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|AIBaseSpacing}}  || int || 1 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|GDIWallDefense}}  || float || 6.0 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|GDIWallDefenseCoefficient}}  || float || 3.0 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|NodBaseDefenseCoefficient}}  || float || 1.0 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|GDIBaseDefenseCoefficient}}  || float || 1.0 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|MaximumBaseDefenseValue}}  || int || 60 ||
|-
| {{Ini|Rules}} || [AI] || {{TTL|ComputerBaseDefenseResponse}}  || 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==

Revision as of 13:12, 13 April 2008

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 and available money and are capable of recognizing cloaked units.

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.

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.

[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] Template:TTL vector<BuildingType> {} +
Rules(md).ini [AI] Template:TTL vector<BuildingType> {} +
Rules(md).ini [AI] Template:TTL vector<BuildingType> {} +
Rules(md).ini [AI] Template:TTL vector<BuildingType> {} +
Rules(md).ini [AI] Template:TTL vector<BuildingType> {} +
Rules(md).ini [AI] Template:TTL vector<BuildingType> {} +
Rules(md).ini [AI] Template:TTL vector<BuildingType> {} +
Rules(md).ini [AI] Template:TTL vector<BuildingType> {} +
Rules(md).ini [AI] Template:TTL vector<BuildingType> {} +
Rules(md).ini [AI] Template:TTL vector<int> {}
Rules(md).ini [AI] Template:TTL vector<BuildingType> {} +
Rules(md).ini [AI] Template:TTL vector<BuildingType> {} +
Rules(md).ini [AI] Template:TTL vector<BuildingType> {} +
Rules(md).ini [AI] Template:TTL vector<BuildingType> {} +
Rules(md).ini [AI] Template:TTL vector<BuildingType> {} +
Rules(md).ini [AI] Template:TTL vector<BuildingType> {} +
Rules(md).ini [AI] Template:TTL vector<BuildingType> {} +
Rules(md).ini [AI] Template:TTL vector<BuildingType> {} +
Rules(md).ini [AI] Template:TTL vector<BuildingType> {} +
Rules(md).ini [AI] Template:TTL vector<BuildingType> {} +
Rules(md).ini [AI] Template:TTL vector<BuildingType> {} +
Rules(md).ini [AI] Template:TTL float 3.0
Rules(md).ini [AI] Template:TTL float 5.0
Rules(md).ini [AI] Template:TTL float 0.016
Rules(md).ini [AI] Template:TTL int 1000
Rules(md).ini [AI] Template:TTL float 0.016
Rules(md).ini [AI] Template:TTL int 60
Rules(md).ini [AI] Template:TTL float 5.0
Rules(md).ini [AI] Template:TTL int 2000
Rules(md).ini [AI] Template:TTL int 2
Rules(md).ini [AI] Template:TTL int 50
Rules(md).ini [AI] Template:TTL int 5
Rules(md).ini [AI] Template:TTL float 0.16
Rules(md).ini [AI] Template:TTL int 4
Rules(md).ini [AI] Template:TTL float 0.16
Rules(md).ini [AI] Template:TTL int 2
Rules(md).ini [AI] Template:TTL float 0.1
Rules(md).ini [AI] Template:TTL int 2
Rules(md).ini [AI] Template:TTL float 0.5
Rules(md).ini [AI] Template:TTL int 40
Rules(md).ini [AI] Template:TTL float 0.14
Rules(md).ini [AI] Template:TTL int 10
Rules(md).ini [AI] Template:TTL float 0.16
Rules(md).ini [AI] Template:TTL int 10
Rules(md).ini [AI] Template:TTL float 0.12
Rules(md).ini [AI] Template:TTL int 5
Rules(md).ini [AI] Template:TTL float 0.12
Rules(md).ini [AI] Template:TTL int 5
Rules(md).ini [AI] Template:TTL boolean 1
Rules(md).ini [AI] Template:TTL boolean 1
Rules(md).ini [AI] Template:TTL float 0.75
Rules(md).ini [AI] Template:TTL int 1
Rules(md).ini [AI] Template:TTL float 6.0
Rules(md).ini [AI] Template:TTL float 3.0
Rules(md).ini [AI] Template:TTL float 1.0
Rules(md).ini [AI] Template:TTL float 1.0
Rules(md).ini [AI] Template:TTL int 60
Rules(md).ini [AI] Template:TTL int 3


[AIGenerals]

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