Page 1 of 1
AI version info itnerface
Posted: 11 Dec 2005, 20:32
by AF
Looking at the interface between the dll and the engine ther eseems onyl one flow of information, being dll gives a globalAI instance and an itnerface version, engien responds with interface calls.
I propose we add 3 new functions, a
const char* GetAIVersion()
const char* GetDescription()
int GetVersion()
So that other programs could get more information about an AI and display it. The returned strings would be html formatted too.
I'll have this in NTAI 0.29 among other things, are there any suggestions on variations or alternatives?
Posted: 11 Dec 2005, 20:51
by krogothe
Great idea!
Also allow the AI to cheat by itself? (makes testing a lot easier) and maybe even allow players to spectate AIs? No one needs that "you won the game" when playing alone to test stuff either

Posted: 11 Dec 2005, 21:19
by AF
a bit offtopic ther.
AI not beign able to cheat without the user typing .cheats is because of a check done by the engine. If this was undone then any AI dll could cheat at will but that would mean I could write a GroupAI that gave me the location of every enemy unit without typing .cheat and without the enemy knowing till I've already seen ti all. It could give me extra untis without them knowing too, and increase my resources, and I wouldnt have to do anythign to hack the engine either.
To spectate the AI's I just start a FFA then type '.cheat', and '.spectate'
Posted: 11 Dec 2005, 23:53
by krogothe
I know about the .cheat and .spectate and .give 100 CORKROG (or something like that).
The cheating in the groupAI can be fixed by doing what we are all asking for, a checkbox system with allowed AIs, so that a DLL must be enabled first by all players. Its possible to do it without opening the game to exploitage, and it would help a great deal in testing not needing to type cheats every single time

Posted: 12 Dec 2005, 20:13
by AF
It's he problem of GrouPAI's and GlobalAI's btoh using the same function, if theyw here seperated then it wouldnt be so abd, btu otherwise I'm nto a big fan of usign the cheat itnerface anyways.
Posted: 12 Dec 2005, 21:38
by krogothe
They should be separated for pretty obvious reasons. Its about time the devs sorted that...
Posted: 12 Dec 2005, 21:43
by jcnossen
The shared interface can't be used to cheat.... so what or why should be seperated?
Posted: 12 Dec 2005, 21:50
by AF
IGlobalAICallback and IGroupAICallback both ahev identical cheat callback functions. The check in the IGlobalAICallback version needs removing
Posted: 12 Dec 2005, 22:08
by jcnossen
Group AI callback, no cheat interface:
Code: Select all
class IGroupAICallback
{
public:
virtual IAICallback *GetAICallback ()=0;
virtual void UpdateIcons()=0; virtual const Command* GetOrderPreview()=0; virtual bool IsSelected()=0;
virtual int GetUnitLastUserOrder(int unitid)=0;
};
Global AI callback, a cheat interface:
Code: Select all
class IGlobalAICallback
{
public:
virtual IAICheats* GetCheatInterface()=0;
virtual IAICallback* GetAICallback()=0;
};
Posted: 12 Dec 2005, 22:11
by AF
then remove the chcek that checks if we've typed .cheat or not
Posted: 12 Dec 2005, 22:16
by krogothe
Alantai Firestar wrote:then remove the chcek that checks if we've typed .cheat or not
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Posted: 13 Dec 2005, 20:06
by Veylon
I would like to see the AI have the ability to see the game time in seconds.
The framerate can vary (mine's at 15 FPS), and the player can pause, which messes up other time checks, so having the game time would make the AI behavior more consistent.
Posted: 13 Dec 2005, 20:10
by AF
Look at Logger::GameTime() in NTAI. It returns a string in the format [00:00] showing minutes and seconds. If it goes into hours it reformats as [00:00:00].
A second in game time is 30 frames unless you increase the gamespeed. You can check the gametime manually by comparing with the system clock, to see howto do that look at NTAI's log class again. Otherwise assume the game runs at 30 fps or 60 fps. NTAI's logging times seem synced fairly well anyways with the clock in the corner showing gametime.
Also it relies on the interface to count not some abstract coutnign of update() calls so it doesnt keep coutning while the game's paused.
Posted: 13 Dec 2005, 20:51
by Veylon
I will take a look at yours. I did notice that it put the time in the log file, and that was what made me think of this.
I would prefer, though, that it got the time directly from the engine, though, so that it's more in-step.
Posted: 13 Dec 2005, 20:54
by AF
It does, it takes the game frame from the engien that applies the sae set fo rules to ti that the engine uses to display the clock in the corner, then does some formatting to it.
edit::
Code: Select all
string Log::GameTime(){
char min[2];
char sec[2];
char hour[2];
int Time = G->cb->GetCurrentFrame();
Time = Time/30;
int Seconds = Time%60;
int Minutes = (Time/60)%60;
int hours = 0;
if(Time>3600) hours = (Time-(Time%3600))/3600;
if(Seconds+Minutes+hours == 0){
return "[00:00]";
}
sprintf(hour,"%i",hours);
sprintf(min,"%i",Minutes);
sprintf(sec,"%i",Seconds);
string stime="[";
if(hours>0){
if(hours<10) stime += "0";
stime += hour;
stime += ":";
}
if(Minutes<10){
stime += "0";
}
stime += min;
stime += ":";
if(Seconds <10){
stime += "0";
}
stime += sec;
stime += "]";
return stime;
}
Posted: 13 Dec 2005, 21:18
by krogothe
You probably only want the frame so from the above what you really need is:
cb->GetCurrentFrame();
Posted: 13 Dec 2005, 21:19
by AF
No he wants the game time in seconds and minutes, and thats what the above does, it reformats into [00:00] etc so ti can be printed ingame ro in a log etc...
Posted: 13 Dec 2005, 21:24
by krogothe
yeah that is quite handy, but im so used to it now i simply think in terms of frames, not seconds

Posted: 13 Dec 2005, 22:26
by AF
Code: Select all
DLL_EXPORT void WINAPI GetInfo(char* name)
{
strcpy(name,"NTAI V0.29.05, a skirmish AI coded by Alantai");
}
DLL_EXPORT float WINAPI GetVersion()
{
return 0.2905f;
}
That is what i have thus far. That okay?
Posted: 13 Dec 2005, 22:58
by Veylon
Oh! I'll use that, then.