Global AI Interface
Moderators: hoijui, Moderators
AIs and command overriding
A thought about global AI, group AI and command overriding:
if a player plays with GroupAI it's all simple: player gives a command to Group and group tries to complete it(unless player tells it to stop), but with global AI it's different:
1)For example globalAI gives some comand, then situation changes, before command is complete and GlobalAI should be able to stop the current command and issue a new one.
2)GlobalAI gives command to some GroupAI and the GroupAI shouldn't be left alone to manage everything!
If situation changes(again:)) GlobalAI should be able to stop the groupAI, issue it a different order, or form a new group with other groupAI and give THEM a new order.
3)If groupAI was unable to complete the order given to it by GlobalAI (other group or ally placed a building there or whatever) it should report to globalAI and it will give them a new job, or make a new group or just remove them from GroupAI and use them as it pleases.
So like GlobalAI is big boss, GroupAI is his executor and GlobalAI can fire GroupAI anytime when GlobalAI sees stuff that GroupAI can't see.
GlobalAI is the only one who can see the situation as a whole, that's why his workers should never be left alone;)
Also AF's and Triaxxe's offensive/defensive/value/threat matrices for squares(areas) are really good ideas, but that could be implemented later when the basic functions wil work.
I think AI should be able to process the map in the beginning, create those matrices (also map for storing enemy info), determine all unbuildable squares, strategic points (mountain, shore), slect it's strategy, and then during the game update those matrices as needed.
if a player plays with GroupAI it's all simple: player gives a command to Group and group tries to complete it(unless player tells it to stop), but with global AI it's different:
1)For example globalAI gives some comand, then situation changes, before command is complete and GlobalAI should be able to stop the current command and issue a new one.
2)GlobalAI gives command to some GroupAI and the GroupAI shouldn't be left alone to manage everything!
If situation changes(again:)) GlobalAI should be able to stop the groupAI, issue it a different order, or form a new group with other groupAI and give THEM a new order.
3)If groupAI was unable to complete the order given to it by GlobalAI (other group or ally placed a building there or whatever) it should report to globalAI and it will give them a new job, or make a new group or just remove them from GroupAI and use them as it pleases.
So like GlobalAI is big boss, GroupAI is his executor and GlobalAI can fire GroupAI anytime when GlobalAI sees stuff that GroupAI can't see.
GlobalAI is the only one who can see the situation as a whole, that's why his workers should never be left alone;)
Also AF's and Triaxxe's offensive/defensive/value/threat matrices for squares(areas) are really good ideas, but that could be implemented later when the basic functions wil work.
I think AI should be able to process the map in the beginning, create those matrices (also map for storing enemy info), determine all unbuildable squares, strategic points (mountain, shore), slect it's strategy, and then during the game update those matrices as needed.
You havent read our thread sfully either. If you had you would realise that triaxx matrixes and mine are different both in size and purpose.
Jouninkomiko, We can simply use the functions available to grop AI's, threat atrixes will be the AI programmers business. However the group AI functions are incomplete.
We need a way to build something at a position, a way to add somethign to a build queue with no position thus for factories. We also need a way fo geting build queues, or in other words some function that returns an array of unit names from which we already have functiosn that can provide info.
alik83, I have sorted out that which you have described and further, however please tell me how you will code an AI to detemine a strategic point to save me the time and maybe start a discussion?
Jouninkomiko, We can simply use the functions available to grop AI's, threat atrixes will be the AI programmers business. However the group AI functions are incomplete.
We need a way to build something at a position, a way to add somethign to a build queue with no position thus for factories. We also need a way fo geting build queues, or in other words some function that returns an array of unit names from which we already have functiosn that can provide info.
alik83, I have sorted out that which you have described and further, however please tell me how you will code an AI to detemine a strategic point to save me the time and maybe start a discussion?
-
- Posts: 436
- Joined: 26 Aug 2004, 08:11
yea, im trying to fill in the blanks with a global AI in order to give an AI programmer the means to handle communication between group AIs and to get global information without going through a group AI.
A question: do you think some of the information gather should be a callback function when it happens, or that you should poll it every x seconds, and react to it accordingly?
A question: do you think some of the information gather should be a callback function when it happens, or that you should poll it every x seconds, and react to it accordingly?
- sp2danny72
- Posts: 60
- Joined: 09 Jan 2005, 04:52
AI API
jouninkomiko:
The only thing i miss from your list is:
"query a-b movecost".
It can be calculated from terrain info,
but since the pathfinder must know this
already, why not add it as sugar...
The only thing i miss from your list is:
"query a-b movecost".
It can be calculated from terrain info,
but since the pathfinder must know this
already, why not add it as sugar...
I'm for the second option
I'm for the second option, although callback functions for some events happened would be nice additionaly.
That's how AI works anyway: it gathers all info every x seconds and reacts accordingly. From this info it can estimate and calculate about any kind of event that happened, so it can do everything a callback onEvent function does.
But also with second option you can do something you can't do with a callback onEvent function:
You can calculate HOW FAST the situation is changing, what it can lead to (i.e. how fast the damage is delt, how fast your energy drops, how productive your attack is), generally estimate the tendency of current sitation.
So you can live without option 1 but you can't without option 2.
P.S. Ofcourse it might not be nessesary to check the status of every unit and every map area every x seconds, but if the computer can handle it, why not?
That's how AI works anyway: it gathers all info every x seconds and reacts accordingly. From this info it can estimate and calculate about any kind of event that happened, so it can do everything a callback onEvent function does.
But also with second option you can do something you can't do with a callback onEvent function:
You can calculate HOW FAST the situation is changing, what it can lead to (i.e. how fast the damage is delt, how fast your energy drops, how productive your attack is), generally estimate the tendency of current sitation.
So you can live without option 1 but you can't without option 2.
P.S. Ofcourse it might not be nessesary to check the status of every unit and every map area every x seconds, but if the computer can handle it, why not?
To Alantai
Alantai, It's gonna take me some time to read your AI posts, i'm not yet ready to describe all of my AI logic, because if I start it, it's gonna take like 3 new topics...
Also my main goal is to create a helper for the player (but this might include giving full control to AI), because just AI is still always deterministic and has no psychology;)
In general: Greenheaven AI would be completely different that GOW AI. So some might want to design AI specifically for that map.
Anyway, AI should be able to process the map in the beginning of the game and determine all lakes, mountains, planes, unbuildable squares(not bother them later), resource distributions, paths to reach particular map areas and so on
i.e. later in game it might want to build a Guardian on high plane, start a fight early on for a resource-rich center of map or get Artillery and Merls near one side of mountain to shoot to the other side..
Not going to discuss matrices and agents right now cause it's a long story.
I like some of your ideas and some are quite arguable...
Thanks for sharing them, anyway
Also my main goal is to create a helper for the player (but this might include giving full control to AI), because just AI is still always deterministic and has no psychology;)
In general: Greenheaven AI would be completely different that GOW AI. So some might want to design AI specifically for that map.
Anyway, AI should be able to process the map in the beginning of the game and determine all lakes, mountains, planes, unbuildable squares(not bother them later), resource distributions, paths to reach particular map areas and so on
i.e. later in game it might want to build a Guardian on high plane, start a fight early on for a resource-rich center of map or get Artillery and Merls near one side of mountain to shoot to the other side..
Not going to discuss matrices and agents right now cause it's a long story.
I like some of your ideas and some are quite arguable...
Thanks for sharing them, anyway
My proposal requires both ideas to function properly though. Initial callbacks are run when the map loads, to determine metal and energy quantities for the map. These are run from the values matrix information agent. It also checks what's incoming from each matrix sector ever five seconds.
As for your own AI proposal, go ahead and post it. That's what the forum is here for, and I guarantee that at least I'll read it as soon as it's up. AF'll probably get to it as soon as he has time, right?
As for your own AI proposal, go ahead and post it. That's what the forum is here for, and I guarantee that at least I'll read it as soon as it's up. AF'll probably get to it as soon as he has time, right?
My current thought is that strategic points on a map can be noted by a mapmaker, with a few catagories such as "defensible pass" "resource rich" etc. An AI dev could create functions to respond to these areas, eg "patrol pass with bombers" "build extra defenses in range of pass" or "raid resource rich area often"
That way you don't have to write a series of algorithms to determine what the key elements of a map are from within the AI, you just react to what the map dev tells you.
If this is taken a step further you might be able to allow the map file to contain general battle plans for an AI from each start position, with the programmed AI determining how to best go about that plan.
Tsumari
That way you don't have to write a series of algorithms to determine what the key elements of a map are from within the AI, you just react to what the map dev tells you.
If this is taken a step further you might be able to allow the map file to contain general battle plans for an AI from each start position, with the programmed AI determining how to best go about that plan.
Tsumari
I would say finding resource rich areas etc at startup would be a lot easier than many other stuffs needed for a competent AI and hardcoding stuff this way will limit flexibility later on.
Having a general battleplan for the ai would of course simplify things a lot for the ai but at the same time make it a lot less flexible.
Having a general battleplan for the ai would of course simplify things a lot for the ai but at the same time make it a lot less flexible.
I'm not sure if it would really make it less flexible, it's more like giving it a default to start from. For example, when I load up your map Flooded Desert if I play on the right of the map with an enemy on the left, I know I have a land based chokepoint near the center to defend, with the threat of shore bombardment in two seas, and a high likelyhood of needing and encountering air power. Where air transports may be safely used (to get to the enemy, not moving around my territory) is not immediately known, but it exists somewhere along the large shoreline of the left side of the map, depending on where the enemy started. These details don't really change unless you change the start positions of the players.
If you go through the trouble to code the AI to recognize these areas the algorithm is probably going to produce the same result each game, anyway, and it could be up to an individual AI to go about tackling a map differently than another, or having enough attack and defense options coded to make it diverse. One AI might nuke the chokepoint and go naval while another tries to push through it, etc.
Oh, there is another AI related bit I thought of. An AI team might need to be able to compare the relative strength of all enemies in a FFA game so an AI guy can make it pace its attacks to avoid being worn out and conquered too easily. You could make this information masked unless the AI has established LOS on the enemy recently, if you want to make it scout.
If you go through the trouble to code the AI to recognize these areas the algorithm is probably going to produce the same result each game, anyway, and it could be up to an individual AI to go about tackling a map differently than another, or having enough attack and defense options coded to make it diverse. One AI might nuke the chokepoint and go naval while another tries to push through it, etc.
Oh, there is another AI related bit I thought of. An AI team might need to be able to compare the relative strength of all enemies in a FFA game so an AI guy can make it pace its attacks to avoid being worn out and conquered too easily. You could make this information masked unless the AI has established LOS on the enemy recently, if you want to make it scout.
Tsumari hasnt read my threads either.
You all fail tor ealise that the map can change now since the terrain is deformable! The AI will quickly find that the map it was programmed for is no longer the map it is playing on.
As for movement costs, you should read the Group AI interface before posting here, otherwse you end up contradicting yourself, such a function exists in the Group AI interface and I'm sure that interface will be available but with Jouninomikos additions.
alik83, pm me if you havent already, when I goto this forum I dont have time to red everythign of intrest anymore and I'd like at least to seperate AI from Spring what not for the moment, and I'm more interested in seeing what your thinking as you develop it rather than after you'e posted it.
btw, AI posts are a priority for me
You all fail tor ealise that the map can change now since the terrain is deformable! The AI will quickly find that the map it was programmed for is no longer the map it is playing on.
As for movement costs, you should read the Group AI interface before posting here, otherwse you end up contradicting yourself, such a function exists in the Group AI interface and I'm sure that interface will be available but with Jouninomikos additions.
alik83, pm me if you havent already, when I goto this forum I dont have time to red everythign of intrest anymore and I'd like at least to seperate AI from Spring what not for the moment, and I'm more interested in seeing what your thinking as you develop it rather than after you'e posted it.
btw, AI posts are a priority for me
If you label a section of the map "chokepoint" for the ai, for example, and that piece is blown all to hell, the AI can use pathfinding to see it's impassable and it no longer becomes a chokepoint. Or it can use the restore function from a construction unit to restore that chokepoint.Alantai Firestar wrote:Tsumari hasnt read my threads either.
You all fail tor ealise that the map can change now since the terrain is deformable! The AI will quickly find that the map it was programmed for is no longer the map it is playing on.
btw, AI posts are a priority for me
The worst problem isn't how to react to certain situations, it's figuring out how to get the AI to recognize what is going on. If the AI can tell what's happening it's not out of the question for a human programmer to say "oh ya, respond with XX units." But if people go coding algorithms to try to be super-intelligent with the AI it will eat up CPU power and lead to an increasing number of false positives for areas the AI thinks are important.
The whole idea of a modular AI that can read the map and determine strategy sounds nice, but getting a computer to recognize what we see as visual strategic features is hard. Just because the map changes a bit doesn't make it any easier to code the super AI.
Tsumari
And I think that some people are overcomplicating things. Give the Ai the ability to track areas where lots of enemy units pass, and areas of a certain type, such as a moat or a pass or a steep but very high mountain and allow the I to mae combinations of those basic thgins to poduce more comlx situations than its has algorithms to calculate and let it react to those.
I dont thin putting in an algorithm for everythign is wise anyways as it's information overload.
*Loos ahead and sees a new generation fo AI thinkers trying to push in who see thigns in a very different and more conventional way*
*shudders, but welcomes the company and ideas*
I dont thin putting in an algorithm for everythign is wise anyways as it's information overload.
*Loos ahead and sees a new generation fo AI thinkers trying to push in who see thigns in a very different and more conventional way*
*shudders, but welcomes the company and ideas*
Perception is the whole problem, how to get the AI to percieve things. An AI can't "see" the map like we do, and this is the mistake people make when talking about a game AI, they say well let the AI see this, and such and such is easy. That's actually true, but getting the AI to see what is going on is the hard part. That's why people can make an AI to play a branch-of-moves game like Chess to an excellent degree, but when even our best programmers throw their resources against something like Go they can only make an AI win on kindergarden boards.
Tsumari
Tsumari
- sp2danny72
- Posts: 60
- Joined: 09 Jan 2005, 04:52
One more thing for the API
I just came up with one more thing I would like to have in the API;
When the game is finished, the AI should be able to append custom
data to the replay-file, such at version number, seed used, custom
settings if the AI has such (such as agressitivity) etc... very needed
for debugging.
And one more thing; the cheat stuff should be in for making easy
(tutor) AI:s, that for example doesnt go to tech-level 2 until the
player has etc...
<edit>
Also, it would be nice if the AI could set/get a per unit "tag" value.
When the game is finished, the AI should be able to append custom
data to the replay-file, such at version number, seed used, custom
settings if the AI has such (such as agressitivity) etc... very needed
for debugging.
And one more thing; the cheat stuff should be in for making easy
(tutor) AI:s, that for example doesnt go to tech-level 2 until the
player has etc...
<edit>
Also, it would be nice if the AI could set/get a per unit "tag" value.
I do not think that damage per time in a battle is something that the interface should keep track of. This is information that the AI itself could keep track of by keeping track of the units it has and uses the unit status functions to get their current hp. Also, I don't think it would be a good idea to have a moderately complicated and time consuming process in the interface. The interface itself should be as simplistic as possible to expedite its development time and to make sure that it is not the bottleneck in the AI system. The best AI will need every spare clock cycle, and I don├óÔé¼Ôäót want any being used for things we may not need.