Project Perfect Mod Forums
:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Privacy Policy :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::


The time now is Fri Dec 06, 2024 1:30 pm
All times are UTC + 0
AICHECK - a script for extensively analyzing rules/art/ai.ini
Moderators: Community Tools Developpers
Post new topic   Reply to topic Page 1 of 1 [13 Posts] Mark the topic unread ::  View previous topic :: View next topic
Author Message
G-E
Defense Minister


Joined: 09 Feb 2015

PostPosted: 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)
Reply with quote  Mark this post and the followings unread

This script requires TCL runtimes, you can get it here: https://www.moddb.com/mods/scorched-earth-ra2-mod-with-smart-ai/downloads/activetcl-8612-for-windows

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.

Current version: 8.4



check.jpg
 Description:
 Filesize:  256.29 KB
 Viewed:  28770 Time(s)

check.jpg



aicheck8.rar
 Description:

Download
 Filename:  aicheck8.rar
 Filesize:  17.69 KB
 Downloaded:  160 Time(s)


_________________
http://www.moddb.com/mods/scorched-earth-ra2-mod-with-smart-ai

Last edited by G-E on Sun Jul 23, 2023 8:43 am; edited 1 time in total

Back to top
View user's profile Send private message
G-E
Defense Minister


Joined: 09 Feb 2015

PostPosted: Sun Jun 04, 2023 7:29 am    Post subject: Reply with quote  Mark this post and the followings unread

Update AICHECK 8.5...

This one is a little obnoxious Smile

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.



aicheck8.rar
 Description:

Download
 Filename:  aicheck8.rar
 Filesize:  17.96 KB
 Downloaded:  141 Time(s)


_________________
http://www.moddb.com/mods/scorched-earth-ra2-mod-with-smart-ai

Back to top
View user's profile Send private message
G-E
Defense Minister


Joined: 09 Feb 2015

PostPosted: Sun Jun 11, 2023 4:57 am    Post subject: Reply with quote  Mark this post and the followings unread

AICHECK 8.5b...

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.



aicheck8.rar
 Description:

Download
 Filename:  aicheck8.rar
 Filesize:  18.05 KB
 Downloaded:  158 Time(s)


_________________
http://www.moddb.com/mods/scorched-earth-ra2-mod-with-smart-ai

Back to top
View user's profile Send private message
G-E
Defense Minister


Joined: 09 Feb 2015

PostPosted: Tue Jun 13, 2023 2:00 am    Post subject: Reply with quote  Mark this post and the followings unread

AICHECK 8.6...

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.



aicheck8.rar
 Description:

Download
 Filename:  aicheck8.rar
 Filesize:  18.17 KB
 Downloaded:  159 Time(s)


_________________
http://www.moddb.com/mods/scorched-earth-ra2-mod-with-smart-ai

Back to top
View user's profile Send private message
G-E
Defense Minister


Joined: 09 Feb 2015

PostPosted: Sat Jul 08, 2023 12:04 am    Post subject: Reply with quote  Mark this post and the followings unread

AICHECK 8.6b... more Ares/Phobos friendly.

- Added a toggle to disable the '100 Unit Bug' checking for Ares users
- Included [ImmunityTypes], [RadiationTypes] and [ShieldTypes] to generic list handling



aicheck8.rar
 Description:

Download
 Filename:  aicheck8.rar
 Filesize:  18.34 KB
 Downloaded:  134 Time(s)


_________________
http://www.moddb.com/mods/scorched-earth-ra2-mod-with-smart-ai

Back to top
View user's profile Send private message
G-E
Defense Minister


Joined: 09 Feb 2015

PostPosted: Sun Jul 09, 2023 3:51 am    Post subject: Reply with quote  Mark this post and the followings unread

AICHECK 8.7... with more Ares/Phobos stuff.

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.



aicheck8.rar
 Description:

Download
 Filename:  aicheck8.rar
 Filesize:  18.6 KB
 Downloaded:  154 Time(s)


_________________
http://www.moddb.com/mods/scorched-earth-ra2-mod-with-smart-ai

Back to top
View user's profile Send private message
G-E
Defense Minister


Joined: 09 Feb 2015

PostPosted: Sun Jul 23, 2023 9:57 am    Post subject: Reply with quote  Mark this post and the followings unread

AICHECK 8.7c...

- 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



aicheck8.rar
 Description:

Download
 Filename:  aicheck8.rar
 Filesize:  18.6 KB
 Downloaded:  140 Time(s)


_________________
http://www.moddb.com/mods/scorched-earth-ra2-mod-with-smart-ai

Back to top
View user's profile Send private message
G-E
Defense Minister


Joined: 09 Feb 2015

PostPosted: Fri Jul 28, 2023 6:29 pm    Post subject: Reply with quote  Mark this post and the followings unread

AICHECK 8.8...

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.



aicheck8.rar
 Description:

Download
 Filename:  aicheck8.rar
 Filesize:  18.65 KB
 Downloaded:  154 Time(s)


_________________
http://www.moddb.com/mods/scorched-earth-ra2-mod-with-smart-ai

Back to top
View user's profile Send private message
G-E
Defense Minister


Joined: 09 Feb 2015

PostPosted: Sat Nov 18, 2023 10:13 pm    Post subject: Reply with quote  Mark this post and the followings unread

AICHECK 8.9...

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.



aicheck8.rar
 Description:

Download
 Filename:  aicheck8.rar
 Filesize:  18.79 KB
 Downloaded:  158 Time(s)


_________________
http://www.moddb.com/mods/scorched-earth-ra2-mod-with-smart-ai

Back to top
View user's profile Send private message
G-E
Defense Minister


Joined: 09 Feb 2015

PostPosted: Wed Dec 27, 2023 11:54 am    Post subject: Reply with quote  Mark this post and the followings unread

AICHECK 8.9d...

- added a distinct error message for blank animation values on weapons
- exempted sides from showing up as re-classified infantry objects



aicheck8.rar
 Description:

Download
 Filename:  aicheck8.rar
 Filesize:  18.81 KB
 Downloaded:  169 Time(s)


_________________
http://www.moddb.com/mods/scorched-earth-ra2-mod-with-smart-ai

Back to top
View user's profile Send private message
Guest





PostPosted: Mon Mar 25, 2024 3:09 pm    Post subject:   Reply with quote  Mark this post and the followings unread

Great work, thank you!

Back to top
Ich-Henker_Guest
Guest




PostPosted: Mon Mar 25, 2024 6:01 pm    Post subject:   Reply with quote  Mark this post and the followings unread

Greetings!,

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.

Back to top
G-E
Defense Minister


Joined: 09 Feb 2015

PostPosted: Sat Mar 30, 2024 8:45 pm    Post subject: Reply with quote  Mark this post and the followings unread

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

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [13 Posts] Mark the topic unread ::  View previous topic :: View next topic
 
Share on TwitterShare on FacebookShare on Google+Share on DiggShare on RedditShare on PInterestShare on Del.icio.usShare on Stumble Upon
Quick Reply
Username:


If you are visually impaired or cannot otherwise answer the challenges below please contact the Administrator for help.


Write only two of the following words separated by a sharp: Brotherhood, unity, peace! 

 
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


Powered by phpBB © phpBB Group

[ Time: 0.2288s ][ Queries: 14 (0.0119s) ][ Debug on ]