AI version info itnerface

AI version info itnerface

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

Moderators: hoijui, Moderators

Post Reply
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

AI version info itnerface

Post 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?
User avatar
krogothe
AI Developer
Posts: 1050
Joined: 14 Nov 2005, 17:07

Post 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 :P
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post 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'
User avatar
krogothe
AI Developer
Posts: 1050
Joined: 14 Nov 2005, 17:07

Post 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 :P
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post 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.
User avatar
krogothe
AI Developer
Posts: 1050
Joined: 14 Nov 2005, 17:07

Post by krogothe »

They should be separated for pretty obvious reasons. Its about time the devs sorted that...
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

The shared interface can't be used to cheat.... so what or why should be seperated?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

IGlobalAICallback and IGroupAICallback both ahev identical cheat callback functions. The check in the IGlobalAICallback version needs removing
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post 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;
};

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

Post by AF »

then remove the chcek that checks if we've typed .cheat or not
User avatar
krogothe
AI Developer
Posts: 1050
Joined: 14 Nov 2005, 17:07

Post by krogothe »

Alantai Firestar wrote:then remove the chcek that checks if we've typed .cheat or not
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
User avatar
Veylon
AI Developer
Posts: 174
Joined: 21 Sep 2005, 19:45

Post 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.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post 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.
User avatar
Veylon
AI Developer
Posts: 174
Joined: 21 Sep 2005, 19:45

Post 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.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post 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;
}
User avatar
krogothe
AI Developer
Posts: 1050
Joined: 14 Nov 2005, 17:07

Post by krogothe »

You probably only want the frame so from the above what you really need is:
cb->GetCurrentFrame();
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post 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...
User avatar
krogothe
AI Developer
Posts: 1050
Joined: 14 Nov 2005, 17:07

Post by krogothe »

yeah that is quite handy, but im so used to it now i simply think in terms of frames, not seconds :P
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post 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?
User avatar
Veylon
AI Developer
Posts: 174
Joined: 21 Sep 2005, 19:45

Post by Veylon »

Oh! I'll use that, then.
Post Reply

Return to “AI”