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

AIGenerals

From ModEnc
Revision as of 23:08, 16 March 2008 by Blade (talk | contribs) (Removed DeeZire template as it is nolonger just DeeZires work. Do we really want to keep the misleading tlb stuff in here?)
Jump to navigation Jump to search
Tiberian Dawn The Covert Operations Red Alert Counterstrike Aftermath Tiberian Sun Firestorm HyperPatch Red Alert 2 Yuri's Revenge Ares Generals Zero Hour Tiberium Wars Kane's Wrath
Flag: AIGenerals
File(s): Rules(md).ini
Values: CLSID in string format, see below
Special Values: None



This section would theoretically offer perhaps one of the most useful tweaks that can be made to the games AI. In a standard RULES.INI file this entire section is commented out. Its presumed effect is to place some pre-determined strategies (or combat behavioural characteristics) into the AI, in order that it adopts one of them depending on the state of the battle. Each strategy is based on that of a military General. In other words, it would at times rush the human player(s) or play very heavily on defense, instead of simply continuing to play the game blindly in the same scripted manner at all times irrespective of how it was doing. This would make the AI a little more of a challenge and, at worst, more unpredictable (and theoretically more 'human').

The section takes the form of a list, numbered starting at '1'. Each entry in the list is a COM object within the game code that defines a General (i.e. a strategy). This works exactly like the Locomotor= statement which details a section of the code dealing with it (you will see that the hex numbers representing each General take exactly the same format as those used by the Locomotor= as they point to the game code in the same way). To get the AI to adopt the behaviour of these Generals, you in theory have to delete the comments and re-include the section.1

NOTE: once you have re-enabled this section, you may encounter random/sporadic/frequent Internal Errors in games played against AI armies. This is because those CLSIDs point to COM objects that are not present in Red Alert 2's code. However, they do exist in Tiberian Sun (even though they don't get used) and can all be found in the AI.TLB file (an OLE Type Library) in Tiberian Sun, so by copying that file and placing it directly in the Red Alert 2 directory you can enable this section and point to those COM objects in Red Alert 2 as well (you will also have to distribute that file with your mod if you plan on making use of this section).1

its worth noting 2 important points however;-

(i) significant changes to the AI strategy will hardly be noticed in Red Alert 2 because of the comparative lack of AI teams defined in the AI.INI file (less than half of those present in Tiberian Sun) - it stands to reason that the more AI triggers and teams that can be employed by the computer, the more apparent that the different strategies will become.

(ii) because AI.TLB comes from Tiberian Sun, it is designed for GDI vs Nod battles - thankfully, Allied and Soviet are still referred to as GDI and Nod in Red Alert 2 so it still works but you get best results in games where Soviets are playing against Allies and vice versa. Use of the Generals becomes much less apparent in games where Soviets play against Soviets or Allies play against Allies.

It may originally have been removed from Tiberian Sun because when using GDI vs Nod logic, the AI would be very ineffective if it was the only Nod player facing all Nod enemies (or vice versa, GDI vs GDI). You can get around that shortcoming by adding more AI Triggers and scripts to AI.INI that specifically tell Soviet armies to target other Soviets and vice versa (see the AI.INI Guide).

Hence its well worth enabling this section only after you have finished all other AI editing and added considerable amounts to the AI's pool of TeamTypes and AITriggerTypes (see the AI.INI Guide for more information). In short, the more teams and scripts available to the AI, the harder it will become to beat as each General will make his presence more apparent.

When using this section, the AI tends to employ the strategy of one of the Generals by comparing the significance of the Category= of objects possessed by itself and its enemy as well as the total of the ThreatPosed= values of its enemy verses the total Strength= of its own army. This suggests that the use of this section relates closely to the Default Threat Evaluation Controls and that they are used to assess the total threat posed by its enemy rather than the threat posed by a single unit or group of units. The net result is that a factor is applied to the Priority= of the TeamType and the weighting of each AI Trigger to make it more appropriate for a specific General.

For information, here's a list of all of the valid Generals and what their behaviours are (including their names where known);-

{F706E6E0-86DA-11D1-B706-00A024DDAFD1}
General BrainDead - has no pre-defined behaviour. This is the default setting for the AI and explains a lot about how weak it can be.

{9E0F6120-87C1-11D1-B707-00A024DDAFD1}
General Meade - the computer concentrates on strong defense and weak attack, prioritizing the building of TeamTypes and structures that have IsBaseDefense=yes set and attacking only in response to incursions into, or attacks on, its base. In short, it defends heavily and only retaliates rather than initiating attack.

{C6004D80-87D1-11D1-B707-00A024DDAFD1}
General Jackson - the computer prioritizes TeamTypes that have Aggressive=yes set and also structures that have IsBaseDefense=yes set. The result is that the computer attacks and defends strongly.

{FBE6D4A0-87D1-11D1-B707-00A024DDAFD1}
General Grant - the computer defends weakly and attacks frequently.

{FBE6D4A1-87D1-11D1-B707-00A024DDAFD1}
General Hooker - the computer is unpredictable and attacks/defends almost at random. Adopted when it has all Prerequisite= requirements met.

{4A582740-9839-11D1-B709-00A024DDAFD1}
General ? - It is unknown what this CLSID was planned for.

Each house (computer controlled or otherwise) is given an IQ rating that is used to determine what the computer is allowed to automatically control. This is distinct from the difficulty setting. The higher the IQ setting, the more autonomous and intelligent the side will behave. Each ability is given a rating that indicates the IQ level (or above) that the ability will be granted. Because such abilities are automatically performed by the computer, giving a human controlled country a high IQ is not recommended. Otherwise the player's units will start to automatically "do their own thing"! A human controlled country is presumed to have an IQ rating of zero. A computer controlled country has an IQ of 1 or higher. When in skirmish mode or when multiplayer AIs are active, the computer IQ is set to the maximum. The IQ setting can be independently set for any house through its definition in a map file with the IQ= statement in that house's entry.

Footnotes

1 Neather Tiberian Sun or Red Alert 2 / Yuri's Revenge loads the AIGenerals, although Tiberian Sun has the option of writing them to a random map scenario. This still does not mean the game uses them. It is unlikely that the .tlb file would have any effect on this fact due to the nature of .tlb files. This is considered a controversial topic in the editing community