Global AI Interface - Page 9

Global AI Interface

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

Moderators: hoijui, Moderators

User avatar
Veylon
AI Developer
Posts: 174
Joined: 21 Sep 2005, 19:45

Post by Veylon »

Two (should be) easy functions I'd like to see:

Code: Select all

float GetGameTime();
const char *GetLoadFile(); // NULL if no load file
The first would get the game time, just copied from the GlobalSynced object.

The second would get the load file that has all of the team info, map info, player info, and other stuff. That text file that gets used to start the game.

These would help A LOT in making it easier for the AI to know what's going. Like how many people are playing, whether or not the commander should be comm-bombing, how many metal makers to build, what start locations are likely to be occupied and other handy data that isn't currently available to the AI.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

you mean script.txt? opening it from the c:\program files\taspring\ folder should do fien as long as the game wasnt started from spring.exe directly...

Also GameTime, I've said about this and it still stands. Expect it to run at 30 fps, update() should get called 30 times a second, better yet just use the functions in the ctime ehader and record the starting time then everytime you want the time, it's simply the difference between now and the recorded time.

Or do what i do, which seems to work perfectly unless you have horrific lag, and uses the same principles to display time as the .clock feature. There simply is not internal time as you put it, only the framenumber, for which you already have a callback function.
User avatar
Veylon
AI Developer
Posts: 174
Joined: 21 Sep 2005, 19:45

Post by Veylon »

What about when the user plays at 1.5x speed? Or later in the game, it runs at 7 or so? Take a look at the code that actually generates the current time before expecting it to run at 30 FPS.

All I'm asking for is a simple way to get the actual time. Coded like this maybe:

Code: Select all

float AICallback::GetGameTime()
{
    return gs->gametime;
}
User avatar
krogothe
AI Developer
Posts: 1050
Joined: 14 Nov 2005, 17:07

Post by krogothe »

I just read the two posts above so forgive me if im talking crap, but the game always runs at 30 FPS at any speed, where the frames are game frames (not how many frames are rendered on your screen) and seconds the seconds from the game timer at the bottom of the screen, so if you are at cb->GetCurrentFrame == 18000 it will always be 10:00 game time, no matter what speed you are playing at or if your comp lagged or not.
User avatar
Veylon
AI Developer
Posts: 174
Joined: 21 Sep 2005, 19:45

Post by Veylon »

Here's the difference (from Game.cpp)

Code: Select all

	thisFps++;

	LARGE_INTEGER timeNow;
	QueryPerformanceCounter(&timeNow);
	LARGE_INTEGER difTime;
	difTime.QuadPart=timeNow.QuadPart-lastModGameTimeMeasure.QuadPart;
	double dif=double(difTime.QuadPart)/double(timeSpeed.QuadPart);
	if(!gs->paused)
		gu->modGameTime+=dif*gs->speedFactor;
	gu->gameTime+=dif;
	if(playing && !gameOver)
		totalGameTime+=dif;
	lastModGameTimeMeasure=timeNow;
See that they are both calculated a bit differently...
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

My code generates identicla results to the clock spring ahs in the corner.

So what you're saying is you dont want AIClock == SpringClock What you want is AIClock == SystemClock-Gamestart, but why you would want that is something I'm unsure of. Afterall it's pretty simple using the functions in #include <time.h>.

And you can tell what speed the player is runnign the game at by setting a value to 1.0 at start, then monitoring the chat messages you recieve which willc otnain the new value at the end.

Also ahve you noticed that the clock in spring runs faster as you icnrease the speed too? It isnt a 1 second in time == 1 second on clock, it's a 1 second in time/Gamespeed == 1 sec on clock.
User avatar
Veylon
AI Developer
Posts: 174
Joined: 21 Sep 2005, 19:45

Post by Veylon »

Never mind. I see now that I am wrong. The game does simulate at 30 FPS, even if the speed setting is outrageously high or if there are 5000 units running around.

I was confused between how many frames are rendered per second, and how many are simulated.

If you run in debug mode, you can see that the game time and the frames always match up at 30 FPS. I checked several times.

Sorry for the arguing...
User avatar
Dragon45
Posts: 2883
Joined: 16 Aug 2004, 04:36

Post by Dragon45 »

(Didnt want to maek a new topic)

As it stands, is there a PauseGame() function that AI can call?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

I still havent got camera control functions.....

I'm curious if we added include statements and added the OpenGL headers in the spring directory and udner the compiler includes and started adding OpenGL code to the AI could we manually itnervene witht he GUI and add dialogs and thigns of our own?
User avatar
Dragon45
Posts: 2883
Joined: 16 Aug 2004, 04:36

Post by Dragon45 »

Look at the handler for the "track" function (if you press "T" with a unit seleccted, the camera follows the unit around). Might be useful.
User avatar
Triaxx2
Posts: 422
Joined: 29 Aug 2004, 22:24

Post by Triaxx2 »

Camera control seems to have been obliterated in the past few versions.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

mwha I cba routing throuhg spring code to add to the spring itnerface. Someone else could easily add ti using the extra functions cain and zaphod agreed upon to make the itnerface extendable without changing it....
User avatar
caldera
Posts: 388
Joined: 18 Oct 2005, 20:56

Post by caldera »

1. i'm looking for the source-code of existing group ai's, but found only radarai's code. any idea where i can find more?

2. is it possible to play ingame-sounds out of a group-ai? f.e. a siren if a group of enemy-bombers is sighted...

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

Post by AF »

You cant play sounds from groupAI's

And download NTai XE8 vanilla or wait for XE9RC18 source tonight to see my own groupAI's
User avatar
Dragon45
Posts: 2883
Joined: 16 Aug 2004, 04:36

Post by Dragon45 »

wait, whatver happened to Zaphod? O_o
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Zaphod == jcnossen
User avatar
MadRat
Posts: 532
Joined: 24 Oct 2006, 13:45

Post by MadRat »

Any progress on this AI project? I see the last post in early July.

Some Sun Tzu ideas to chew on... Each AI should have its own localized version of the world and rank the tiles by pertinent terrain. Sun Tzu has like 16 levels of terrain and he ranks them from best to worst, which is exactly how an AI could do to help plan its unit path finding. Sun Tzu also lays out using prisoners and such as exploratory units in order to purposely engage the enemy in order to measure their responses. A good AI writer might have some assumptions and several strategies to funnel the game-plan towards as each engagement unfolds. Sun Tzu also talks endlessly about diplomacy. Perhaps the AI writers might be able to co-op a barter system where non-grouped AI's may launch temporary truces and alliances in order to gain an upper hand for themselves; which of course should also have the ability to deceive and cheat their partners as necessary. (Would be funny for one AI to think the other was extraordinary in its expansion only for the truth to be in rapid retreat in reality - shades of the Iraqi Information Minister!) Diplomacy is crucial to any global-based AI system. (Its a shame that Spring doesn't leap out of the old "TA" diplomacy system and create a somewhat more sophisticated engine for that stuff, but that's another idea fork altogether.)

I have been thinking about AI's for a long time and have always wanted to implement the AI techniques of a game called "Fighter Command" from the C-64 days. That would really be an exciting way for an AI to handle air orders.

Anyways, I'll pop in from time to time to see how your project develops. Good luck, fellas.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

erm, this isnt an AI project this is the AI interface the engine exposes.

And there is no diplomacy in spring, its all predefined in the lobby.


Otherwise I'd think the AI would require complexity and awareness that hasnt been achieved by an rts ai yet to be able todo some of those examples.

However It'd be useful if you further outlined the sun tzu stuff in a seperate thread.
User avatar
Petah
Posts: 426
Joined: 13 Jan 2008, 19:40

Re: Global AI Interface

Post by Petah »

Build queue information...
User avatar
LOrDo
Posts: 1154
Joined: 27 Feb 2006, 00:21

Re: Global AI Interface

Post by LOrDo »

Epic freaking ressurection?
Post Reply

Return to “AI”