AI Chat Commands

AI Chat Commands

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

Moderators: hoijui, Moderators

Post Reply
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

AI Chat Commands

Post by hoijui »

Two new Skirmish AI related chat commands have been added. They are both usefull for Users and for AI devs.

aikill
Kill a Skirmish AI controlling a team.
The team itsself will remain alive,
unless a second argument is given,
which specifies an active team
that will receive all the units of the AI team.
usage: /aikill teamToKill [teamToReceiveUnits]
mantis: http://springrts.com/mantis/view.php?id=1516
commit: 601c2455ff1d2925fae516a239e628e5185708ee

aicontrol
Let a Skirmish AI take over control of a team.
usage: /aicontrol teamToControl aiShortName [aiVersion]
mantis: http://springrts.com/mantis/view.php?id=1517
commit: 5dde1d3f0a04b930041b20d36a76fd8c640b13d4

aicontrol will probably be extended, to be able to specify a display name and options for the AI.

aikill should work well already, while aicontrol is still pretty buggy. The command itsself seems to work fine, but most AIs seem to crash instantly or soon after they got initialized mid-game.

For AI devs:
aicontrol initializes the AI in the same way it it happens at game start, but after the Init event, it will additionally receive a UnitFinished event for each Unit of the team it took over control.
I tested RAI and E323AI, which both work sometimes, and sometimes crash after some events. KAIK always instantly crashed for me. So i call uppon AI devs, to work together with me to make their AIs fit for aicontrol, and help me finding errors.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: AI Chat Commands

Post by hoijui »

/aitake was renamed to /aicontrol to prevent confusion, because it does something totally different then /take for AI -> /aitake suggests.

With help of Auswaschbar, i made the two commands synced (untested yet), so they should work for online games too.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: AI Chat Commands

Post by Argh »

These are very useful ideas.

One issue, though. Current skirmish AIs generally think they're supposed to be involved in initialization. Can an AI be assigned to a "team" that doesn't get any Units assigned, so that it's initialized and ready to operate?
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: AI Chat Commands

Post by hoijui »

most spring AIs today seem to crash when initialized midgame with /aicontrol, but it might need just minor adjustments.

the problem wiht what you want ot do is not the AI, but the mod/game logic.
a team with no units is a dead team. you could give the team a useles invulnerable unit, so it stays alive.
The propper way to do what you want would be implementing a modular win condition system in spring, so mods could eg define when a team is dead or not.
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: AI Chat Commands

Post by aegis »

why would /aicontrol need to be synced?
shouldn't the skirmish AI only be running on one computer?
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: AI Chat Commands

Post by imbaczek »

the server and clients need to know who - or what - controls a player for gameover detection, or something like that.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: AI Chat Commands

Post by Kloot »

Also, AI-controlled teams get special permissions to execute certain commands.
Societal
Posts: 64
Joined: 05 May 2009, 13:57

Re: AI Chat Commands

Post by Societal »

[ 347769] /aikill 4 6
[ 347769] Team to kill: player societal is not allowed to kill Skirmish AI controlling team 4 (try with /cheat)
[ 347769] ------------------------------------------------
[ 347769] Kill a Skirmish AI controlling a team.
[ 347769] The team itsself will remain alive,
[ 347769] unless a second argument is given,
[ 347769] which specifies an active team
[ 347769] that will receive all the units of the AI team.
[ 347769] usage: /aikill teamToKill [teamToReceiveUnits]
[ 347780] /cheat
[ 347780] Cheating!
[ 347780] /aikill 4 6
[ 347780] Failed to remove Skirmish AI from team 4.
[ 347780] Spectator societal tried to hack the game (spoofed TEAMMSG_GIVEAWAY)
[ 349627] /aikill 4
[ 349627] Successfully removed Skirmish AI from team 4.


As a dead team I can kill AI bots but not take over their units. I know that spoofing protection has got in the way in the past when I tried to switch from bot to bot so I could set up their commander's initial queue of build orders with the hopes of spectating the result. I know I saw a feature request from a modder that the spoofing protection be disabled with /cheat 1 for this sort of testing.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: AI Chat Commands

Post by hoijui »

should be fixed (in current master) with commit:
8f3af87f0eec0fbe26c390cec9bdf052f9b4bbab
allways allow /team X, RESIGN and "Give Everything To" in single-player games
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: AI Chat Commands

Post by zwzsg »

I have a Lua AI. I truely doubt /aicontrol will magically know it needs to relaunch a certain gadget, so how do I make that gadget aware that /aicontrol was issued?
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: AI Chat Commands

Post by hoijui »

needs an engine->widget call AIInit(someThings), and also AIDie(teamId).
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Profiling possibilities

Post by hoijui »

(only partly related to AI Chat Commands)

In current spring master, when playing spring with AIs, and pressing B, you can now see the total CPU time spent for Skirmish AIs, and for each Skirmish AI instance. You should only look at the time, as the percentage value is only the average over the last 0.5 seconds, and therefore totally unreliable.
The same info that can be seen when pressing B, can be printed to the chat section (and therefore appear in infoglo.txt) in textual form, when writing:

Code: Select all

/debuginfo profiling
cranphin
Posts: 136
Joined: 13 Jun 2005, 16:37

Re: Profiling possibilities

Post by cranphin »

hoijui wrote:In current spring master, when playing spring with AIs, and pressing 'B', you can now see the total CPU time spent for Skirmish AIs, and for each Skirmish AI instance.
Sweet! :)
Btw. , what is the AI:PFS thing when I press 'B' ? :D
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: AI Chat Commands

Post by hoijui »

this is the engine internal Path Manager, and the "AI" in there .. i guess is meant to signal that it is a complex algorithm or so.
These functions can be called from a Skimrihs AI, but are also used by the engine itsself and are callable from Lua.
Therefore, i renamed it from AI:PFS to just PFS, to prevent confusion (smae confusion happend to me to ;-) ).
Post Reply

Return to “AI”