Possible AI problem...

Possible AI problem...

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

Moderators: hoijui, Moderators

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

Possible AI problem...

Post by Fanger »

Ok since Final Frontier is very close to a new release and I had very few things to do, I decided to look at the AI's and try and get one to work with Final Frontier by modifying the config files, Now as far as I can tell I modified the config files correctly yet for each and every AI I tried I an unhandled exception error which asked me to contact the mod Author..

Final Frontier has no ground units, all units are some form of aircraft, and thusly all defences are AA of some sort, I dont know if this causes the AI to break or if im missing something... I tried the JCAI, and AAI both got the same exact error and would not tell me much in the AI log..

Just for reference im posting both config files for the AI's just to check that I set them up right...

JCAI Main Config
//-------------------------------------------------------------------------
// JCAI version 0.20
//
// A skirmish AI for the TA Spring engine.
// Copyright Jelmer Cnossen
//
// Released under GPL license: see LICENSE.html for more information.
//-------------------------------------------------------------------------
armccrus = file "ff_arm.cfg"
corccrus = file "ff_core.cfg"

// You can put the author name here or a general message
StartLine = "Using the Final Frontier Profile of JCAI"

//------------------------------------------------------------------------------------------
// Side info
//------------------------------------------------------------------------------------------
SideInfo =
{
// all air defence buildings
aadefense = { armemt armfury armplasma coremt corplasma corscythe armglt armhemt armion attla corgzsam corhemt corion thumper xarmflak xcorflak }
// all ground defense buildings
gddefense = { armbstat corbstat firestorm impact }
}


//------------------------------------------------------------------------------------------
// General build manager config
//------------------------------------------------------------------------------------------

// These weight determine how much resources are spend per handler type
BuildWeights =
{
Resource = 0.8
Force = 1.5
Support = 1
Recon = 1
}

MaxTasks =
{
Resource = 10
Force = 10
Support = 10
Recon = 1
}
JCAI Arm Config
//-------------------------------------------------------------------------
// JCAI version 0.21
//
// A skirmish AI for the TA Spring engine.
// Copyright Jelmer Cnossen
//
// Released under GPL license: see LICENSE.html for more information.
//-------------------------------------------------------------------------

// the "build speed" used here is calculated from the actual build speed, the move speed, and the health
BuildSpeedPerMetalIncome = 0.05

//------------------------------------------------------------------------------------------
// Recon handler config
//------------------------------------------------------------------------------------------
ReconInfo =
{
UpdateInterval = 6 // Can be used to set frequency of recon updates, to reduce CPU use.
MaxForce = 5

Scouts = buildoptions
{
stil*2 sil
}

SearchHeuristic =
{
// Higher score is better
TimeFactor = 0.015
DistanceFactor = -2
ThreatFactor = -0.5
SpreadFactor = 200
}
}

//------------------------------------------------------------------------------------------
// Support handler config
//------------------------------------------------------------------------------------------
// The support handler can be used to create tasks for things like defenses or radar
SupportInfo =
{

groups = {
llt = {
units=buildoptions { armfury }
minmetal = 4
}

hlt = {
units=buildoptions { armplasma armfury*2 }
minmetal = 8
}
}
}

//------------------------------------------------------------------------------------------
// Resource unit handler config
//------------------------------------------------------------------------------------------
ResourceInfo =
{
// These factors determine the calculation of the 'cost' divisor in the energy production heuristic
// It's used to decide which energy producer to build (fusion/wind/solar)
EnergyBuildHeuristic =
{
// TODO: Fix this,it's unbalanced
BuildTime = 0
MetalCost = 1
EnergyCost = 0

// New energy making units have to fulfill this condition:
// 1.0f + (UnitEnergyProduction / CurrentTotalEnergyProduction) < MaxUpscale
// This makes sure the AI doesn't think "Hey, let's build a fusion right away!"
MaxUpscale = 2
}

// This applies to both metal makers and metal extractors
MetalBuildHeuristic =
{
/* score calculation:
Threat value for metal makers build spots is assumed to be 0, since they can be placed anywhere

PaybackTime = (MetalCost + MetalSpotThreatValue * ThreatConversionFactor) / MetalMake
score = PaybackTimeFactor * PaybackTime +
(ResourceUnitUsage) * EnergyFactor
*/
PaybackTimeFactor = -10
EnergyUsageFactor = -100
ThreatConversionFactor = 1
PrefUpscale = 2
UpscaleOvershootFactor = -50
}
// To optimize building the beginning of the base - this has to be a buildoptions node
InitialBuildOrders = buildoptions
{
armadvsol*2 armemex*2
}

MetalExtracters =
{
armemex
xarmmoho
}

MetalMakers =
{
armomkr
xarmmmkr
}

EnergyMakers =
{
armadvsol
armpfus
xarmfus
}

EnablePolicy =
{
MinUnitEnergyUsage=60
MinEnergy=0.1
MaxEnergy=0.85 // it's best to keep this below Storage.MaxRatio
}

Storage =
{
MetalStorage = xarmmstor
EnergyStorage = xarmestor
MaxRatio = 0.9 // The resource handler will build storage when Resource > ResourceStorage * MaxRatio
MinMetalIncome = 4 // minimum metal income before it builds storage
MinEnergyIncome = 80

// These maximums define the point where no more storage is build (so resources are spilled)
// They have to be multiplied by the energy income to get the real maximum:
// Max = Income * MaxStorageFactor
MaxEnergyStorageFactor = 500
MaxMetalStorageFactor = 1000
}
}

//------------------------------------------------------------------------------------------
// Force handler config
//------------------------------------------------------------------------------------------
ForceInfo =
{
DefaultSpread = 600

RushForce =
{
task = attackdefend
// the units fields always has to be a buildoptions value
units = buildoptions { stil }
batchsize=6
category=4
level=1
minmetal=6
}

BasicForce1 =
{
task = attackdefend
// the units fields always has to be a buildoptions value
units = buildoptions { wildcat*2 stil*3 }
batchsize=4
category=4
level=2
minmetal=14
}

}
JCAI Core Config
//-------------------------------------------------------------------------
// JCAI version 0.21
//
// A skirmish AI for the TA Spring engine.
// Copyright Jelmer Cnossen
//
// Released under GPL license: see LICENSE.html for more information.
//-------------------------------------------------------------------------

// the "build speed" used here is calculated from the actual build speed, the move speed, and the health
BuildSpeedPerMetalIncome = 0.05

//------------------------------------------------------------------------------------------
// Recon handler config
//------------------------------------------------------------------------------------------
ReconInfo =
{
UpdateInterval = 6 // Can be used to set frequency of recon updates, to reduce CPU use.
MaxForce = 5

Scouts = buildoptions
{
wisp*2 wraith
}

SearchHeuristic =
{
// Higher score is better
TimeFactor = 0.015
DistanceFactor = -2
ThreatFactor = -0.5
SpreadFactor = 200
}
}

//------------------------------------------------------------------------------------------
// Support handler config
//------------------------------------------------------------------------------------------
// The support handler can be used to create tasks for things like defenses or radar
SupportInfo =
{

groups = {
llt = {
units=buildoptions{corscythe}
minmetal = 4
}

hlt = {
units=buildoptions { corplasma corscythe*2 }
minmetal = 8
}
}
}

//------------------------------------------------------------------------------------------
// Resource unit handler config
//------------------------------------------------------------------------------------------
ResourceInfo =
{
// These factors determine the calculation of the 'cost' divisor in the energy production heuristic
// It's used to decide which energy producer to build (fusion/wind/solar)
EnergyBuildHeuristic =
{
// TODO: Fix this,it's unbalanced
BuildTime = 0
MetalCost = 1
EnergyCost = 0

// New energy making units have to fulfill this condition:
// 1.0f + (UnitEnergyProduction / CurrentTotalEnergyProduction) < MaxUpscale
// This makes sure the AI doesn't think "Hey, let's build a fusion right away!"
MaxUpscale = 2
}

// This applies to both metal makers and metal extractors
MetalBuildHeuristic =
{
/* score calculation:
Threat value for metal makers build spots is assumed to be 0, since they can be placed anywhere

PaybackTime = (MetalCost + MetalSpotThreatValue * ThreatConversionFactor) / MetalMake
score = PaybackTimeFactor * PaybackTime +
(ResourceUnitUsage) * EnergyFactor
*/
PaybackTimeFactor = -10
EnergyUsageFactor = -100
ThreatConversionFactor = 1
PrefUpscale = 2
UpscaleOvershootFactor = -50
}
// To optimize building the beginning of the base - this has to be a buildoptions node
InitialBuildOrders = buildoptions
{
coradvsol*2 coremex*2
}

MetalExtracters =
{
coremex
xcormoho
}

MetalMakers =
{
armomkr
xarmmmkr
}

EnergyMakers =
{
coradvsol
corpfus
xcorfus
}

EnablePolicy =
{
MinUnitEnergyUsage=60
MinEnergy=0.1
MaxEnergy=0.85 // it's best to keep this below Storage.MaxRatio
}

Storage =
{
MetalStorage = xcormstor
EnergyStorage = xcorestor
MaxRatio = 0.9 // The resource handler will build storage when Resource > ResourceStorage * MaxRatio
MinMetalIncome = 4 // minimum metal income before it builds storage
MinEnergyIncome = 80

// These maximums define the point where no more storage is build (so resources are spilled)
// They have to be multiplied by the energy income to get the real maximum:
// Max = Income * MaxStorageFactor
MaxEnergyStorageFactor = 500
MaxMetalStorageFactor = 1000
}
}

//------------------------------------------------------------------------------------------
// Force handler config
//------------------------------------------------------------------------------------------
ForceInfo =
{
DefaultSpread = 600

RushForce =
{
task = attackdefend
// the units fields always has to be a buildoptions value
units = buildoptions { wisp }
batchsize=6
category=4
level=1
minmetal=6
}

BasicForce1 =
{
task = attackdefend
// the units fields always has to be a buildoptions value
units = buildoptions { ironangel*2 wisp*3 }
batchsize=4
category=4
level=2
minmetal=14
}

}
And the AAI config file
START_UNIT1 ARMCCRUS
START_UNIT2 CORCCRUS
SIDE_NAME1 Arm
SIDE_NAME2 Core
MAX_UNITS 10000
MAX_SCOUTS 3
MAX_BUILDERS 15
MAX_BUILDERS_PER_TYPE 5
MAX_GROUP_SIZE 16
MIN_EFFICIENCY 0.1
MAX_XROW 8
MAX_YROW 8
X_SPACE 12
Y_SPACE 12
SECTOR_SIZE 100.0
MAX_SECTOR_IMPORTANCE 6
MAX_BASE_SIZE 4
SCOUT_SPEED 50.0
ARTY_RANGE 900.0
MIN_ENERGY 18
LEARN_RATE 4
AIR_DEFENCE 2
Both these AI's gave me an unhandled exception error upon startup.. and crashed out spring.. I stopped trying other AI's since I assumed that I had set up the config files right and that perhaps there is something wrong with all AI.dll in that they dont like Air craft being the only type of units..
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

It's probably because of a unit def that couldn't be read correctly. Without AI, FBI files are loaded when needed (when the first unit of it is created), but the AI's cause spring to load all FBI's at start and then it crashes (in your case then)
User avatar
Fanger
Expand & Exterminate Developer
Posts: 1509
Joined: 22 Nov 2005, 22:58

Post by Fanger »

So how can I fix that...
submarine
AI Developer
Posts: 834
Joined: 31 Jan 2005, 20:04

Post by submarine »

ok i'll have a look at it, but right now aai doesnt support air units, therefore i dont exspect aai to do anything...
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Finally, now I have the information toa dd this to NTAI, and why si it that i ahve to ask for these thgisn voer and voer again then get them when you try to add it to another AI?
Liam
Posts: 93
Joined: 02 Nov 2004, 22:43

Post by Liam »

maybe it's because no one can understand what the fuck you're saying
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

lol true
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

What I asked for was as simple as this.

Give em a list fo what the commander builds
Give me a list fo what all the factories build
Give em a list fo what all the buidlers in the mod build

That's it.

Core Commander builds:
mex then mex then solar then mex then veh plant then radar then solar etc...

for example would ahve been enough for me to write additions ot the build tree for a core commander. Heck you could even convert that to the build tree using a set fo rules such as replace the word then with "); uz->AddTask(" then add new lines so it isnt all one big block...

Or better yet take an existing block and change all the unit names, not too hard?
User avatar
krogothe
AI Developer
Posts: 1050
Joined: 14 Nov 2005, 17:07

Post by krogothe »

Liam wrote:maybe it's because no one can understand what the fuck you're saying
This can be helped however:

look at what i found:

Aoccdrnig to a rscheearch at an Elingsh uinervtisy,
it deosn't mttaer in waht oredr the ltteers in a
wrod are, the olny iprmoetnt tihng is taht frist
and lsat ltteer is at the rghit pclae. The rset
can be a toatl mses and you can sitll raed it
wouthit porbelm. Tihs is bcuseae we do not raed
ervey lteter by it slef but the wrod as a wlohe. ceehiro

That'll fcuk the splelchekcer


If you guys are not retards, you should be able to read that pretty much as fast as if it was spelt normally, which is suprising considering the mess! If AF simply sticks just the first and last letters of each word in the correct places everyone will understand him 8)
Its all about selective misspeling!

(ok sorry about the hijack but i thought that was cool)
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Ahem, have you not seen the program zenka wrote to decipher words I've misspelt? And if you dont understand something I say ask for it to be rewritten, dont wait till some random time to complain.

Besides my errors all follow a set fo patterns

thigns instead of things soem instead of some teh instead of the, you should have learnt by now what the words mean, otherwise I doubt your intelligence greatly
Liam
Posts: 93
Joined: 02 Nov 2004, 22:43

Post by Liam »

hah i was just kidding, but jesus christ that last sentence his hilarious...
"you should've learned how to decipher my fucked up text by now, god... some people... can't even be arsed to learn my specific typing, LAZY."
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

So everyone has to learn reading your text, because you are to lazy to learn spelling normally? Wouldn't it be easier if you just learned to spell?

Really when you keep spelling words wrong, you get a habit of spelling words wrong. I've always corrected my spelling mistakes and rarely make a spelling errors anymore, without any effort.
User avatar
FizWizz
Posts: 1998
Joined: 17 Aug 2005, 11:42

Post by FizWizz »

...
maybe I'm a little slow, but... "ceehiro"?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

I've said why ym spellign is bad, and I am not sayign people ahve to learn, I'm sayign people should know by now what teh and soem mean, and if they dont after the first 2 or 3 posts it's obvious by context.

In future make note: a joke about alantais spellign will not make alantai happy.
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

Yes but know that I consequently skip your big posts, just because it takes too much effort to read through all your spelling mistakes... and I'm probably not the only one that does that.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Then you're the one at a loss. Evidently you dont even look at the first sentence. If you did you'd realize that i write huge posts offline in MSWord and spellcheck them. There are rarely spelling mistakes in them. Unless it's a rant I got carried away with. When I'm angry I get careless and type a lot faster thus more mistakes.
User avatar
Zenka
Posts: 1235
Joined: 05 Oct 2005, 15:29

Post by Zenka »

Well, I once made a solution to Alantai's babbeling

AD: Finally, down I have the information ota dd this to Ntai, and why is it that i have to ask for these things over and over again then get them when you try to add it to another Ai? (Note "toa dd" is suppose to be "to add" instead of "ota dd". Space correction isn't included yet).

http://spring.clan-sy.com/phpbb/viewtopic.php?t=3066

And Alantai, please give me that MSN+ correction list? AD will be much better if I include that.

[Edit] Maybe I should Work on a FireFox/Opera Plugin. That would be helping the user-frendlyness[/Edit]
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

okies, Also before you even try any of the other etsts, the vast majority fo errors can be filtered out by searching for a phrase and correcting it against a matchign pair of bad+good phrases.

dammit fileunvierse has gone haywire uploading..... I'll edit this post within the hour with the link
User avatar
Fanger
Expand & Exterminate Developer
Posts: 1509
Joined: 22 Nov 2005, 22:58

Post by Fanger »

HEY!!! can we get off Alantai's spelling and answer my questions.. talk about going way off topic.. im not even sure what the hell you guys were going on about.. is there something wrong with aircraft in your AI's how do I make the AI's work, do you need a list of what builds what or something.. spelling is not the issue here its coherent statements..

Note if you needed a list of what builds what.. here is the arm:
Arm Commander (armccrus)
1. armemex (metal extractor)
2. armadvsol (solar collector)
3. armfury (Fury light turret)
4. sport (lvl 1 arm plant)
5. armomkr (metal maker)

LVL 1 Plant (sport)
1. armcsc (lvl 1 constructor)
2. stil (stiletto fighter)
3. sil (silhouette stealth fighter)
4. wildcat (Wildcat medium fighter)
5. metalion (Metalion missile fighter)
6. armods2 (Pulsar Light Orbital defense system)
7. armprobe ( Light scout probe)
8. collator (ECM craft)

LVL 1 constructor (armcsc)
1. ltyard (lvl 2 plant)
2. sport (lvl 1 plant)
3. armemex (metal extractor)
4. armadvsol (solar collector)
5. armomkr (metal maker)
6. xarmmstor (metal storage)
7. xarmestor (energy storage)
8. armpfus (pocket fusion reactor)
9. armfury (Fury light turret)
10. armplasma (Slugger medium turret)
11. armemt (emp turret)
12. armntow (nanolathe turret)

LVL 2 Plant (ltyard)
1. armacss (lvl 2 constructor)
2. armrd (repair drone)
3. armelfig (Bearcat heavy fighter)
4. warhawk (Warhawk assault fighter)
5. armhhawk (Hell Hawk Bomber)
6. icarus (Icarus corvette)
7. phobos (Phobos EMP corvette)
8. mstar (Morning Star frigate)
9. armods (Sidearm Medium Orbital defense system)

LVL 2 Constructor (armacss)
1. syard (lvl 3 plant)
2. sport (lvl 1 plant)
3. xarmfus (Fusion Reactor)
4. xarmmmkr (moho metal maker)
5. xarmmoho (moho metal extractor)
6. xarmflak (flak turret)
7. thumper (ion bolt turret)
8. armglt (Cutter gatling turret)
9. armsen (radar tower)
10. armrjt (radar jamming tower)
11. impact (medium battlestation)
12. armbstat (heavy battlestation)
13. armhemt (heavy EMP turret)
14. armspylab (covert plant)

Covert Plant (armspylab)
1. armpod (cloakable spy probe)
2. sil (silhouette stealth fighter)
3. armbop2 (Bird of Prey elite fighter)
4. armnhawk (Night Hawk stealth bomber)
5. icarus (Icarus corvette)
6. eclipse (stealth frigate)
7. armcsc (lvl 1 constructor)
8. armacss (lvl 2 constructor)
9. armrd (repair drone)
10. armprobe ( Light scout probe)
11. armods2 (Pulsar Light Orbital defense system)
12. armods (Sidearm Medium Orbital defense system)

LVL 3 Plant (syard)
1. armrss (salvage corvette)
2. dronfrig (Drone Frigate)
3. eclipse (stealth frigate)
4. resilient (Resilient Destroyer)
5. warcat (Majestic Escourt Destroyer)
6. eldritch (Eldritch EMP Destroyer)
7. warlock (Warlock Light Cruiser)
8. repulse (Exeter Heavy Cruiser)
9. armmslcrus (Longbow Missile Cruiser)
10. arclight (Arclight Battlecruiser)
11. armbb (Thunderlance Battleship)
12. armbs (Broadside Dreadnought)
13. armflag (Flagship AA cruiser)
14. armhods (Glaive Heavy Orbital Defence System)
15. armprobe ( Light scout probe)
User avatar
Veylon
AI Developer
Posts: 174
Joined: 21 Sep 2005, 19:45

Post by Veylon »

Mine's never had any trouble with buildtrees. OTAI simply doesn't have any. It looks to me like buildtrees are unnecessary unless there's something down the line that isn't available NOW, but requires something else. How about a buildtree class? Something like this:

Code: Select all

struct BuildTreeNode
{
  int UnitID;
  BuildTreeNode **Builds;
  int NumBuilds;
  BuildTreeNode **BuiltBy
  int NumBuiltBy;

  BuildTreeNode *NextNodeTo(int UnitID);
  BuildTreeNode **AllNextNodesTo(int UnitID);
  int ListNodesTo(int UnitID, BuildTreeNode **List); // Returns number of nodes in list
  int AllListsTo(int UnitID, BuildTreeNode ***Lists, int *ListSizes, int MaxLists); // Returns number of Lists
}
class BuildTreeOrganizer
{
  int NumNodes;
  BuildTreeNode *NodeList;
  BuildTreeNode *FindNodeForUnit(int UnitID);
}
Then, you could find out which node(s) represent your current situation, and which order to build things to get a particular unit.

Code: Select all

int DesiredUnit = callback->GetUnitDef("UnitX")->id;
const UnitDef *pud = callback->GetUnitDef(unit);
int NextUnit = BTO->FindNodeForUnit(pud->id)->NextNodeTo(DesiredUnit)->UnitID;
Of course, you'd have to check to see that there is such a unit and such a node, but otherwise, once filled, such a structure ought to work just fine.
Post Reply

Return to “AI”