Skirmish AI progress report

Skirmish AI progress report

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

Moderators: hoijui, Moderators

User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Skirmish AI progress report

Post by jcnossen »

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.

Image
User avatar
hrmph
Posts: 1054
Joined: 12 May 2005, 20:08

Post by hrmph »

Very cool! You've made quite a bit of progress already!
User avatar
Slamoid
Posts: 237
Joined: 25 Jan 2005, 19:23

Post by Slamoid »

<dumb_questions>
Are you going to do just ArM scripts, or a race selection menu? Current version? Minispring compatible?
</dumb_questions>
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

- 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)

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.
Torrasque
Posts: 1022
Joined: 05 Oct 2004, 23:55

Post by Torrasque »

That's awesome! Really nice screenshot ;)
I make me really happy to see people develop for Spring-

One dumb suggestion : Informe Ace07 and Coryrc that some IA are comming. It could be cool to select the IA in the battleroom.
User avatar
munch
Posts: 311
Joined: 26 May 2005, 20:00

Post by munch »

Nice - looking good =)
User avatar
hrmph
Posts: 1054
Joined: 12 May 2005, 20:08

Post by hrmph »

Is the script in a .dll or is it fopened from a textfile?
User avatar
Neuralize
Posts: 876
Joined: 17 Aug 2004, 23:15

Post by Neuralize »

Zaaaphod. Progress!?
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

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.
User avatar
hrmph
Posts: 1054
Joined: 12 May 2005, 20:08

.

Post by hrmph »

Nice!
Doomweaver
Posts: 704
Joined: 30 Oct 2004, 14:14

Post by Doomweaver »

Good job, this is fantastic news! :-)
User avatar
GrOuNd_ZeRo
Posts: 1370
Joined: 30 Apr 2005, 01:10

Post by GrOuNd_ZeRo »

Glad to see this is being worked on! will definitly be better than having to run my own oponments :P
User avatar
Veylon
AI Developer
Posts: 174
Joined: 21 Sep 2005, 19:45

Post by Veylon »

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:

Code: Select all

UnitDef *pud = callback->GetUnitDef("UNITNAME");
LogFile << pud->name;
and conversion to c-strings too:

Code: Select all

UnitDef *pud = callback->GetUnitDef("UNITNAME");
char c[200];
sprintf(c, "%s", puc->name.c_str();
How did you make it work?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

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*.
besides if you're looking for the units name just use the "UNITNAME" bit in quotes, and if you want the name visible to the player use ->humanname.
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

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:

Code: Select all

string unitname = ud->name;
const char *unitname = ud->name.c_str();
works fine.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

I'm fully aware of that Zaphod, only he wanted a valid explanation and I gave a valid though maybe not 1000% politically correct example
User avatar
Veylon
AI Developer
Posts: 174
Joined: 21 Sep 2005, 19:45

Post by Veylon »

To heck with political correctness! I just want something that'll work.

I see that the const part is important. I'll have to try it again.
User avatar
Slamoid
Posts: 237
Joined: 25 Jan 2005, 19:23

Post by Slamoid »

While you're here Zaphod, how's the next version of your AI coming along?

I really would like just a little somthing stupid to play with!!! :(
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

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 ;) )
Strider
Posts: 30
Joined: 04 Sep 2005, 23:26

Post by Strider »

Looking forward to it Zaphod keep us informed.
Post Reply

Return to “AI”