Posted: Fri May 26, 2023 8:28 pm Post subject:
AICHECK - a script for extensively analyzing rules/art/ai.ini
Subject description: (it does most everything to keep a modder sane)
AICHECK has been designed to do comprehensive comparisons of objects, and their interdependencies across multiple inis. The resulting information is collected in check.log, where errors in/from each TechnoType and object class will be visually divided, making pinpointing the offending code very simple.
The script has two modes of operating, the normal way is to just scan the mod (ini files) and the second is to batch scan maps by the filetype specified, for which several batchfiles are provided. The former being the most useful, and should be run after any change to the mod, to make sure nothing was forgotten or no additions left incomplete. The latter doesn't do any exhaustive map checking, it merely looks for placed objects that don't exist in the mod, so it's use is more of a quick glance at map compatibility. For thorough map testing use MISTEST.
In the process of cross-checking the ini files of the mod, it will have a good understanding of whether a building used in a prerequisite is valid, or that an attack mission within the ai is correctly targeting the right building index. It will look to make sure a weapon has a valid warhead, then in turn check the warhead has a valid 'verses' tag, and that the animation used by the explosion is both correctly defined and available in art.ini, for example. Also it's worth pointing out that AICHECK is case-sensitive when it comes to most object references, so if the warhead is named 'MyNewWH', then referencing 'MYNEWWH' or 'mynewwh' will be considered an error. The purpose behind this is to enforce consistency, which in turn will help prevent future errors. A general rule of thumb is that art should always be capitalized, and virtual objects like weapons should have sentence-like capitalization for the name.
The script has way too many of such checks to list them all, but the point is to paint a very complete picture of errors and potential errors in the mod. Now there are cases where false-positives will be shown, such as when it complains the artwork for a given object or animation doesn't exist, which can be rectified by simply creating a matching [heading] in art.ini with no additional code. As long as it finds that it exists, it can't be considered an oversight, and it doesn't matter if it uses defaults or distinct code.
AICHECK also extensively checks that the ai.ini performs the way it should, by making sure triggers use teams, weighting, sides and other requirements properly. It does some magic to determine possible unintentional errors, such as when units are used in a team not belonging to the country creating the team, or in cases like trying to capture a building with an engineer that can't be captured. The ai is notorious for being opaque to error discovery during game play, sometimes it will just get stuck doing nothing, or sometimes the game will crash, neither really exposing the point of failure, and thoroughly scanning the ai (in context with the rest of the mod inis) is really the only way to solve it.
As always the aicheck.tcl will have to be edited to set the important options and filenames for it to work.
First, fixed a missing animation-is-declared check on weapons (Anim=), so that has been corrected.
Secondly, all units and buildings have their TechLevels tracked, and subsequently compared against each other, and that in turn sets the level of the TaskForces they are used within, which is compared to the AITrigger's level. Units with TechLevel=-1 are ignored. One small annoyance is that due to the parsing order, unit class TechLevel warnings will appear under the buildings section of the log. This can't be helped without doing a pre-pass on the entire rules.ini just to have the data ready before the units are parsed.
The latter change will result in quite the spam of log messages, as I don't think anyone was really paying close attention to any such level discrepancies. I have known I had a few mistakes in this regard, but I decided a proper test regime was in order.
When adding the TechLevel checks, I overlooked one more use case, the actual conditional object within the trigger when using the condition type 1 (building owned/exists), so that has been added.
It's not a particularly important case, but it could mean the trigger is polluting the firing queue when it doesn't need to.
As per previous notes, the TechLevel loading has been moved to the pre-pass stage, so the errors are displayed in their appropriate sections. In addition to this, the generic prerequisites have been included in the array used to track this, made possible by the aforementioned changes.
This re-examination of generic prerequisites has resulted in altering how they are loaded, and no longer need to be predefined in a variable, they are loaded as the game loads them. A feature originally designed to bypass the lack of handling for Ares' [GenericPrerequisites], it then made more sense to just add the Ares support. Having done this, the variable was removed from the header.
One note about how the generics are handled for the error-checking, I had intended to resolve them into actual building names, but the problem with this is the potentially wide range of TechLevels of the buildings that would satisfy that prerequisite, when only the lowest value should be required. As such, that approach was discarded, and the generics are treated as their own objects, which means TechLevel errors will show the generic names, like FACTORY or PROC, expecting the author to understand.
- Added a toggle to disable the '100 Unit Bug' checking for Ares users
- Included [ImmunityTypes], [RadiationTypes] and [ShieldTypes] to generic list handling
Now properly considers Trainable=yes/no for all technotypes in relation to elite weapons, including for elite turret changer weapons.
This release also adds Crit.Warhead and SW.Warhead values to the list of used warheads to prevent logging them as unused. Do note that Crit.Warhead will be checked against the [Warheads] list, while SW.Warhead will not.
- split error messages for invalid TechLevel into two
- reset the list ordering counter for every heading, even unknown ones
- small fix regarding multiple weapon error message
- fixed typo screwing up SW.Warhead check
This release adds Ares' [WeaponTypes] support, so that it no longer complains if weapons aren't attached to units. However it will still consider weapons unused when not used by units, or as airburst/cluster.
This update allows the removal of Prerequisite= lines from anything with TechLevel=-1 without complaining.
This change was made to allow the FA2sp updated ui option to more properly categorize units, since the vanilla rules.ini gives all civilian units Prerequisite=NAWEAP confusing it. Being that if you can't build a thing, it has no such requirement, they can now just be safely removed.
To my knowledge, Tech Level isn't used by the AI to determine wich team to trigger - so the comparison between Tech Levels in the AI Section of the log is of no use - can you make this so that you have the option to switch it off.
Tech Level is used for Cameo sorting...
Quote Deezire:
TechLevel=
This is obsolete in Red Alert 2 and is unused. In previous C&C games, this was used as a method of restricting AI auto production by determining the lowest TechLevel= at which this team could be employed by the AI, however the TechLevel= setting in Red Alert 2 has become all but obsolete as this can no longer be determined by players. Leave this set to its default of 0 (see the AITriggerTypes section for a further explanation of how the TechLevel= setting is used by the AI as a result of a change in the game engine code for Red Alert 2) .
D = TechLevel
Determines the TechLevel= setting which is required in order for this trigger to be used. Although the TechLevel= setting is partly useless to human players in Red Alert 2, this is used by the AI when it assembles TaskForces. The trigger will only be used when the AI has reached this TechLevel= setting through construction of the required structures in its tech tree. QUICK_EDIT
Hi Ich, I actually added that for the purposes of mission scripting where limiting techlevel does matter, and I thought it would make sense to have deliberate values instead of random nonsense. I was also curious how bad it would be....
Really as annoying as it is, there's absolutely no reason it can't be fixed. Mine only has a couple techlevel warnings and those are deliberate to control cameo order. _________________ http://www.moddb.com/mods/scorched-earth-ra2-mod-with-smart-ai QUICK_EDIT
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum