Author Topic: Gathering AI Type Information From XML Files  (Read 926 times)

Offline amethyst

  • Newbie Mark III
  • *
  • Posts: 36
Gathering AI Type Information From XML Files
« on: June 28, 2014, 04:16:26 pm »
Since I've considered playing around with a little tool to manage your DisabledAITypes.txt, I'm looking at a way to get the names, descriptions and special unit types of the various AI types. This seems straightforward at first, since they're all listed in the various XML files in RuntimeData\Languages\en. However, it seems there may be some hardcoded things not visible from that data alone; a few comments in main.xml suggest that some AI types don't have their extra/unique ships listed in the actual XML data, e.g.:

<!-- EAITShadow = EAITStealth -->

My question to Keith or anyone else with knowledge of the source: Are all these hardcoded relations documented as comments, or should I be aware of a couple more? If it's the former, I can just add a workaround looking for comments like above. Otherwise I'm going to need a list. :)

Offline amethyst

  • Newbie Mark III
  • *
  • Posts: 36
Re: Gathering AI Type Information From XML Files
« Reply #1 on: June 28, 2014, 04:47:16 pm »
Additionally, it seems not all the entries in the XML files are named consistently. For example, you have:

<ln id="The_Tank">The Tank</ln>

in aitypes.xml, but main.xml just knows it by "Tank":

<ln id="TAITTank">The Tank</ln>
<ln id="NAITTank">Sends slightly heavier waves slightly smaller defensive reinforcements.</ln>
<ln id="EAITTank">Has tanks and armor ships from the start, as well as whatever other ships they might unlock.</ln>

Should I simply try to match these up based on their titles, i.e. deduce that I want *AITTank because TAITTank matches the value of The_Tank in aitypes.xml? And are the identifiers in aitypes.xml the right ones to use in DisabledAITypes.txt?

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Gathering AI Type Information From XML Files
« Reply #2 on: June 30, 2014, 11:14:53 am »
Those xml files are just localized strings, and won't give you very consistent data on such things.  Though in this particular case I think the id's in aitypes.xml (and 1aitypes.xml, 2aitypes.xml, etc) are what you want.

So:

The_Tank


Underscores instead of spaces are a convention that was not continued with later expansions, which generally just use camel case.
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline amethyst

  • Newbie Mark III
  • *
  • Posts: 36
Re: Gathering AI Type Information From XML Files
« Reply #3 on: June 30, 2014, 05:01:52 pm »
Those xml files are just localized strings, and won't give you very consistent data on such things.  Though in this particular case I think the id's in aitypes.xml (and 1aitypes.xml, 2aitypes.xml, etc) are what you want.

Alright, thanks!

One more question: Is it possible to tell the difficulty of a given AI type from any external file, or do I need to fire up the game and take notes manually?

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Gathering AI Type Information From XML Files
« Reply #4 on: June 30, 2014, 05:06:18 pm »
Those xml files are just localized strings, and won't give you very consistent data on such things.  Though in this particular case I think the id's in aitypes.xml (and 1aitypes.xml, 2aitypes.xml, etc) are what you want.

Alright, thanks!

One more question: Is it possible to tell the difficulty of a given AI type from any external file, or do I need to fire up the game and take notes manually?
That's not in the files, no.

Though this bit adapted from the code is a currently-accurate reference:

Code: [Select]
            case AIType.Technologist_Raider:
            case AIType.Technologist_Homeworlder:
            case AIType.Technologist_Parasite:
            case AIType.Technologist_Turtle:
            case AIType.Technologist_Sledge_Hammer:
            case AIType.The_Core:
            case AIType.Raid_Engine:
            case AIType.CraftySpire:
            case AIType.Heroic:
            case AIType.ViciousExotic:
            case AIType.Brutal:
                this.IsTechnologist = true;

            case AIType.Entrenched_Homeworlder:
            case AIType.Fortress_Baron:
            case AIType.Sledge_Hammer:
            case AIType.Turtle:
            case AIType.Train_Master:
            case AIType.Mine_Enthusiast:
            case AIType.The_Tank:
            case AIType.ShieldNinny:
            case AIType.GravDriller:
            case AIType.NeinzulViralEnthusiast:
            case AIType.SupportCorps:
            case AIType.Vanilla:
            case AIType.Chivalric:
            case AIType.Bouncer:
            case AIType.Cowardly:
                this.IsEasier = true;

            case AIType.Assassin:
            case AIType.Backdoor_Hacker:
            case AIType.Bully:
            case AIType.Counter_Spy:
            case AIType.Feeding_Parasite:
            case AIType.Mad_Bomber:
            case AIType.Teleporter_Turtle:
            case AIType.Vicious_Raider:
            case AIType.Stealth_Master:
            case AIType.Camouflager:
            case AIType.Experimentalist:
            case AIType.SpeedRacer:
            case AIType.Peacemaker:
            case AIType.TagTeamer:
            case AIType.NeinzulClusterBomber:
            case AIType.NeinzulYoungster:
            case AIType.Spireling:
            case AIType.Thief:
            case AIType.ZenithDescendant:
            case AIType.OneWayDoormaster:
            case AIType.Artillerist:
            case AIType.Exotic:
            case AIType.Reservist:
            case AIType.KiteFlier:
                this.IsModerate = true;

            case AIType.Attritioner:
            case AIType.Scorched_Earth:
            case AIType.Shadow_Master:
            case AIType.Special_Forces_Captain:
            case AIType.Technologist_Raider:
            case AIType.Technologist_Homeworlder:
            case AIType.Technologist_Parasite:
            case AIType.Technologist_Turtle:
            case AIType.Technologist_Sledge_Hammer:
            case AIType.The_Core:
            case AIType.Alarmist:
            case AIType.Raid_Engine:
            case AIType.Golemite:
            case AIType.RadarJammer:
            case AIType.NeinzulNester:
            case AIType.WarpJumper:
            case AIType.Everything:
            case AIType.Retaliatory:
            case AIType.CraftySpire:
            case AIType.ExtremeRaider:
            case AIType.SpireHammer:
            case AIType.Heroic:
            case AIType.FortressKing:
            case AIType.Vorpal:
            case AIType.Vengeful:
            case AIType.ViciousExotic:
            case AIType.StarfleetCommander:
            case AIType.Vanguard:
            case AIType.StarshipFanatic:
            case AIType.Quadratic:
            case AIType.Overreactive:
            case AIType.Brutal:
            case AIType.Mime:
                this.IsHarder = true;

Note that the "red  hard" ones are listed in both the technologist list and the harder list (the flags are set in separate switches)
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline amethyst

  • Newbie Mark III
  • *
  • Posts: 36
Re: Gathering AI Type Information From XML Files
« Reply #5 on: July 01, 2014, 10:13:42 am »
Thank you very much, that will do perfectly!

 

SMF spam blocked by CleanTalk