Skirmish AI progress report
Moderators: hoijui, Moderators
Skirmish AI progress report
Here is a screenshot of the skirmish AI I'm working on, called JCAI.
The AI is totally configurable with a building script that controls what's being build. The script currently only contains level1 kbots and vehicles as you can see. It currently searches for mining spots and builds a base and forces, nothing more, but this is already close to a real skirmish AI. I will release it when I've added recon and actually using the created forces :), I'm just showing it so you can see I'm actually working on it.
The AI is totally configurable with a building script that controls what's being build. The script currently only contains level1 kbots and vehicles as you can see. It currently searches for mining spots and builds a base and forces, nothing more, but this is already close to a real skirmish AI. I will release it when I've added recon and actually using the created forces :), I'm just showing it so you can see I'm actually working on it.
- arm scripts
Once I release the first version I'm basically hoping other people can help me with building scripts for other races and other mods. I will at least maintain an xta core script. These scripts are really simple too and I think it's somewhat fun to make your own scripts. It's not just a list of weights like the original TA AI had. You can define base "cells" that have a few buildings, a metal extractor, forces and child base cells.
- race selection menu
this is something spring related. my AI will just see what kind of commander it gets and handle according to that.
- minispring
I'm not actively going to support minispring, though it might just work fine with the right script.
this is what the current script looks like (the one from the screenshot)
Once I release the first version I'm basically hoping other people can help me with building scripts for other races and other mods. I will at least maintain an xta core script. These scripts are really simple too and I think it's somewhat fun to make your own scripts. It's not just a list of weights like the original TA AI had. You can define base "cells" that have a few buildings, a metal extractor, forces and child base cells.
- race selection menu
this is something spring related. my AI will just see what kind of commander it gets and handle according to that.
- minispring
I'm not actively going to support minispring, though it might just work fine with the right script.
this is what the current script looks like (the one from the screenshot)
Code: Select all
info {
cellsize=32
defaultmindist=5
}
root {
mine=cormex
factory=corvp
support="corsolar*2 corrl*2"
builder=corcv
force="corfav cormist"
childs="mine*2 klab*2"
}
klab
{
mine=cormex
builder=corck
factory=corlab
support="corsolar*2"
force="corak*2 corstorm corthud corcrash"
childs="klab*2 mine*2"
}
mine {
mine=cormex
support="corrl*2"
}
Last edited by jcnossen on 14 Jul 2005, 01:18, edited 1 time in total.
Right now the AI reads an ai.cfg script (which is just a text file), which has to contain all information. I'm going to improve that with an "include <file>" statement and add some balancing control to the config. This will take a few days max, or maybe it all works straight away and I will release it tomorrow.
- GrOuNd_ZeRo
- Posts: 1370
- Joined: 30 Apr 2005, 01:10
Stupid question:
How do you get the name of the unit?
I know it's in a std::string, but everything I try to access it, the game crashes.
I've tried streams (to a log file) with:
and conversion to c-strings too:
How did you make it work?
How do you get the name of the unit?
I know it's in a std::string, but everything I try to access it, the game crashes.
I've tried streams (to a log file) with:
Code: Select all
UnitDef *pud = callback->GetUnitDef("UNITNAME");
LogFile << pud->name;
Code: Select all
UnitDef *pud = callback->GetUnitDef("UNITNAME");
char c[200];
sprintf(c, "%s", puc->name.c_str();
Code: Select all
const UnitDef* ud = callback->GetUnitDef("unit");
string unitname = ud->name.c_str();
string humanName = ud->humanname.c_str();
callback->GetUnitDef(); returns a [b]const[/b] UnitDef*.
Veylon: you realise this thread is really old right?
anyway, are you sure pud is nonzero? GetUnitDef() could be case-sensitive, I don't really know, but in any case pud->name.c_str() is fine for a c-string.
AF: you don't need string::c_str() to copy a string to another string, only use c_str() if you need the C-style string pointer (const char *):
This:
works fine.
anyway, are you sure pud is nonzero? GetUnitDef() could be case-sensitive, I don't really know, but in any case pud->name.c_str() is fine for a c-string.
AF: you don't need string::c_str() to copy a string to another string, only use c_str() if you need the C-style string pointer (const char *):
This:
Code: Select all
string unitname = ud->name;
const char *unitname = ud->name.c_str();
Well I have implemented a new task system that basically works, now I'm working on code that actually generates the tasks. Furthermore I've split up the map info system so the metal spot map scales with the extractor radius (so it will work correctly on core prime...)
I've also completely rewritten the config file handler so that it's much more flexible now.
The whole "cells on fixed positions" system is dropped, so you can imagine that it takes quite some time to get a basic AI working again.
This means it's currently not in a usable state, but once it is I will release a new test version. I hope to release it maybe like next week or something, but I'm really bad at estimating the required time (I don't remember ever being correct about it )
I've also completely rewritten the config file handler so that it's much more flexible now.
The whole "cells on fixed positions" system is dropped, so you can imagine that it takes quite some time to get a basic AI working again.
This means it's currently not in a usable state, but once it is I will release a new test version. I hope to release it maybe like next week or something, but I'm really bad at estimating the required time (I don't remember ever being correct about it )