XE8 data documentation and notes

XE8 data documentation and notes

Here is where ideas can be collected for the skirmish AI in development

Moderators: hoijui, Moderators

Post Reply
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

XE8 data documentation and notes

Post by AF »

First of all post notes thigns I miss out as this isnt everythign at all but it's a start:



XE8 BUILDTREE DOCUMENTATION


AI.TDF

[AI]
{
datapath=AI;
}

AI.tdf is located in the main spring directory, and controls how NTai loads its data. The default folder to load from is "AI". Be careful as if the folder specified does not exist then NTai will not do anything, also make sure it is case sensitive, especially on non-microsoft operating systems.

The AI folder

The AI fodler holds a lot of information that is used by NTai. I'll start off by listing the folders NTai uses.

Learn

In the learn folder, NTai write learning data in TDF files. These can be of use as they contain the unit name, the human unit name seen in game and the tool tip within the comments.
XE8 comes with a batch of pre-created learning files for numerous mods.

Log/Logs

In the logs folder NTai outputs any logs it may need in text file format. Html output is an option but it's disabled internally and leads to large log files. Every instance fo NTai will have its own log file whose filename includes the mod, date, and the team NTai was part of.
It's important to read logs should NTai crash or you're in the process of constructing a build tree.

Mexdata

This folder holds cached data from the mex placement algorithm. This data is identical in format to any output from OTAI, and both can be interchanged freely.
As many as 30 maps have pre-calculated caches bundled witht eh NTai download to rpevent slowdown.

Default

This is the default build tree. It is composed entirely of universal build tags such as B_MEX or B_GLOBAL, and is the data loaded if the mod being played doesnt have custom data of its own. This folder takes the same formata s other mod data fodlers.

DTBuildData

This folder contains more cached data for DT rings. This data is identical to that generated by OTAI too

MexDebug

NTai will output debug data so that the mex algorithms efficiency can be determined (and I have something to prove to krogothe that his algorithm isn't working).

ThreatDebug

When you type .threat in game NTai will output it's threat matrixes as a set of TGA images. They will be outputted to this directory.

Output

NTai will not directly use this directory, however the UnitDef output GroupAI will output data to this folder in the format output//modname// etc

Mod data folders

The name of these folders is by default the name of the mod archive loaded. Thus when loading a copy of AA it will load from the name of the variant and not the main data file because that is the file where mod_info.tdf is contained.

However, there is an override. A mod may have the following in their mod_inf.tdf

[NTAI]
{
tdfpath=xxxx;
}

which will force NTai to laod from the folder xxxx instead of the modname. This convention is used in EE/AA/XTA/Nanoblobz.

What's stored inside Mod Data folders?

Mod data folders contain 2 things. The first is a file called mod.tdf, the second is a set of text files which are the task queues of every builder/factory unit in that mod. All these text files have lowercase filenames in order to keep better Linux compatibility. However this shouldn't affect windows, as the file loading in windows is case insensitive.

Data text files

These take the following forms depending on what is contained within mod.tdf.

commander.txt
builder.txt
factory.txt
global.txt
*unitname*.txt

Which files are loaded depends on settings in mod.tdf., however this section is more about what's contained within those files.

Data within these files consists of values separated by commas. These represent the task list the unit will follow. For example if in XTA the file armcom.txt (the unit name of the Am Commander is ARMCOM)contains "ARMMEX, ARMMEX, ARMSOLAR, ARMLAB" then when NTai starts a game of XTA as Arm, then it will order the Arm commander to build 2mex, a solar, and a kbot lab.

So Starting from the beginning it is a list of what NTai will build, but it's not just that, you can also tell it what it will do. There are keywords that extend and modify this queue. For example B_RESURECT/B_RESSURECT will make the unit issue an area resurrect command if there are wreckages nearby, and B_RANDMOVE will make a unit move away in a random direction. There are also modifiers that change how the list is treated. For example once the list has been executed, by default it's reloaded, however you can specify that it doesn't get reloaded.

Also it is possible to take advantage of unit learning and universal build routines using keywords. for example you could replace ARMMEX in the above example with B_MEX and NTai will auto detect and pick the correct build option.

Should NTai come across a value while loading that isn't a unit name or a keyword, then it'll skip over it and display a message in the logs.

universal build routines are as follows:

B_MEX
B_POWER_
B_ESTORE
B_MSTORE
B_SILO
B_DEFENCE
B_DEFENSE
B_PLASMA_REPULSOR
B_PLASMA_REPULSER
B_FORTIFICATION
B_SONAR
B_RADAR
B_TARG
B_MINE
B_FACTORY
B_FACTORY_CHEAP
B_ASSAULT
B_RANDASSAULT
B_RANDOM
B_MISSILE_UNIT
B_BOMBER
B_CARRIER
B_SCOUT
B_RESSURECT/B_RESURECT
B_RANDMOVE

There may be more that I cant exactly remember off of the top of my head

There're also keywords such as repeat and no_repeat and is_factory that change how a units task list is handled, there're also keywords that affect how the AI works, such as turning on and off GAIA mode or affecting the attack agent.

Global.txt

This file is always loaded, and is loaded into a global task list that gets reloaded when it's empty. When a unit comes across a B_GLOBAL task it will start at the beginning of this list and continue until ti finds the first task it is capable of doing.

It is to be noted that you should not use faction specific words in this file otherwise the list will never get emptied and B_GLOBAL will become useless in the middle o the game. Use unit names of building available to all factions, universal build routines, or use meta tags. You can see an example of meta tags for this in lindirs XTA build tree in XE8.

B_GLOBAL will only work in XE8


XE8 specific mod.tdf tags

singlebuild=;
solobuild=;
energyIncome=;
metalIncome=;
energyStorage=; // might be Stored not Storage
metalStorage=; // might be Stored not Storage

Tags that've changed in XE8

random_efficiency=;
No longer used in XE8!!!!!! Use only if you wish to support XE7/7.5 All meta tag stuff is now based on efficiency

Scouters=;
Attackers=;
If dynamic selection is turned on, the routines will first search through these tags then apply the detection algorithms. This means you can adjust for where the algorithms fail to detect scouts and attackers correctly, or if you wish to override.

Other mod.tdf tags

dynamic_selection=;
hardtarget=;
cheap_multiplier=;
metatags=;
abstract=;
message=;
author=;
version=;

MetaTags

I'll do an example on how to define a meta tag. For more examples see lindirs XTA build tree which defines a several.

[AI]
{
metatags=B_LVL1LAB,B_NEWTAGS2;
}
[TAGS]
{
B_LVL1LAB=armlab,corlab;
B_NEWTAG2=unitname,unitname;
}

And the metatag can then be used just like any other unitname or universal build routine tag in task list
User avatar
Lindir The Green
Posts: 815
Joined: 04 May 2005, 15:09

Re: XE8 data documentation and notes

Post by Lindir The Green »

AF wrote:singlebuild=;
solobuild=;
energyIncome=;
metalIncome=;
energyStorage=; // might be Stored not Storage
metalStorage=; // might be Stored not Storage
What exactly is the difference between singlebuild and solobuild?

And what do energyIncome, metalIncome, energyStorage, and metalStorage do? Are they to guide the anti-staller :-)
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

They're multipliers, in the code it'll say like cb->getmetal()*a; where a is one fo the multipliers.

In effect it'll multiply the metal stored by the multiplier specified here. The point is to predict the growth of the AI's economy and allow some leeway for the AI to stall for a second or two if it can handle it.

You know what singlebuildand solobuild do, you used them in the XTA buildtree

Solobuild=unit1,unit2;

here NTai is told toonly build one at a time of these units, such as if you want to build a fusion reactor and ones udner cosntruction, go help with ti instead of starting a new one.

Singlebuildis where you're onyl allowed one of these. For example dont build a second targetting facility......
User avatar
Targ Collective
Posts: 202
Joined: 12 Nov 2005, 14:16

Post by Targ Collective »

Great! This ought to come in very useful.
User avatar
Lindir The Green
Posts: 815
Joined: 04 May 2005, 15:09

Post by Lindir The Green »

AF wrote:here NTai is told toonly build one at a time of these units, such as if you want to build a fusion reactor and ones udner cosntruction, go help with ti instead of starting a new one.
But it doesn't actually go help; it just skips the construction of it, right?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

No, a repair command is issued with the half finished building as the target.
User avatar
Lindir The Green
Posts: 815
Joined: 04 May 2005, 15:09

Post by Lindir The Green »

Cool!
User avatar
Fanger
Expand & Exterminate Developer
Posts: 1509
Joined: 22 Nov 2005, 22:58

Post by Fanger »

I have a question can i set metatags to be used for unit construction via a factory.. Ie can I do this:

metatags=URC_ATTACK;

[TAGS]
{
URC_ATTACK=URCSPIDERP, URCSPIDERR, URCTIGERP, URCTIGERR, URCJAGUARP, URCJAGUARM;
}

then in the unit file URCSPIDERCON, URCSPIDERS, URC_ATTACK, repeat

note the factory might not be able to build all those units but could i set that up so it randomly decides to build one of hte ones it can I have it like this right now and it doesn nothing..
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Currently

If I define the meta tag as above and put it through then NTai will do the following for each entry in that meta tag

can this unit be built by this builder/factory?
if so its efficiency the highest?
If so put it in the temp
repeat process

Return the temp value

temp value goes along construction process pretending that you wrote the temp value in the file and not the meta tag.

Also I dunno but are you sure your capitalisation is correct?

And are you getting error messages where NTai is spewing out errors about unitnames?


However i think it would be a lot better to put in B_ASSAULT and the odd B_RANDASSAULT (I think that's how it's spelled), in order to take advantage of unit learning algorithms and help teach NTai, since what NTai learns doesn't just affect what's chosen when you get B_ASSAUTL in a build tree, it affects how it targets units and how it perceives the enemy, thus where it attacks.
User avatar
Lindir The Green
Posts: 815
Joined: 04 May 2005, 15:09

Post by Lindir The Green »

It's B_RAND_ASSAULT
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

http://www.darkstars.co.uk

bug reports or suggestions in the forum there

I also added the old mod data documentation for NTai everyones been asking about
Post Reply

Return to “AI”