AI Design Idea

AI Design Idea

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

Moderators: hoijui, Moderators

Post Reply
Eadword
Posts: 21
Joined: 15 Aug 2012, 06:34

AI Design Idea

Post by Eadword »

I had this idea for an AI, I have always wanted to be able to play one that is as hard, if not harder than a player. I figured that since an AI is able to do all of the things that a player is able to do there is no reason that the AI could be better, particularly since they are able to compute data very quickly compared to a human, although they do have a bandwidth limit. I proved this point with ComplexAI which can be found at http://springrts.com/phpbb/viewtopic.php?f=43&t=28621.

This idea was designed with the intention of it being coded in C++ but does not really have to be. The design was actually written up by me and a coding friend of mine, however we are more than a little sidetracked with other projects and do not plan on making it anytime soon, if at all; we where hoping that someone may find this of use.

The general idea of the AI is to be able to learn and work with many different games based on config files. We planned it all out with dia and that is what is attached to this post along with an odt of my thoughts of what an AI should be able to do based on the observations of multiple others for Balanced Annihilation.


I hope this helps someone, we would love to see our ideas be useful instead of being locked up on my hard drive for all eternity. Please keep us posted on any use, we would love to know if it was helpful.
And of course:
These ideas are distributed in the hope that they will be useful, but WITHOUT ANY GARUNTEE; without even the implied GARUNTEE of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Enjoy!
Attachments
SpringAI.7z
Our package of ideas. Please note that if you open the dia file and then read the properties of each of the classes we filled in many of the attributes and functions including some descriptions despite the fact they do not show up on the png.
(83.22 KiB) Downloaded 34 times
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: AI Design Idea

Post by hoijui »

i am pretty sure that nobody will find it here, as it will soon be lost in forum history. but if you add it to the wiki here:
http://springrts.com/wiki/AI:Skirmish:List
you have the best chances that someone that might be interested in it, would stumble upon it.
User avatar
Petah
Posts: 426
Joined: 13 Jan 2008, 19:40

Re: AI Design Idea

Post by Petah »

Hi,

I am glad you shared this, as I find it quite an interesting topic.

Metal and energy are mod specific, so to be a fully config based AI, it needs not have specific resource managers but a global "ResourceManager" that handles all resources for the mod. That being said, I would personally do likewise and focus on one particular system.

One thing that is missing is a team cooperation manager. The way I based my AI is that one AI would focus it efforts on a particular task. Such as there would be the following tasks to pick from given the size of the map and amount of players:

- rusher
- resource production
- techer
- raiders/army builders

And then there was the "Overmind" class that analysed the battle and changed team priorities as needed.

There also was the lower level micro based manager, for things such moving units into optimal range, and creating formations etc.

You can see my AI that I made here: https://github.com/Petah/BAI there is even a couple of (highly oudated) Dia diagrams.
User avatar
NeonStorm
Posts: 173
Joined: 23 May 2012, 18:36

Re: AI Design Idea

Post by NeonStorm »

Imagine defense on a map like "Final Pass" or "Wide Pass".

How useful would a tower be?
How would you put that into configs?

Maybe the AI not only need configs, but also to learn the map.

Possible enemy inc from only 1 direction + Towers are good
-> make towers, prefer small passes, prefer not at edge (use full range)

It could also copy tactics from players based on success rate.
User avatar
Petah
Posts: 426
Joined: 13 Jan 2008, 19:40

Re: AI Design Idea

Post by Petah »

NeonStorm wrote:It could also copy tactics from players based on success rate.
Firstly, how would an AI identify a tactic, and secondly how would they reproduce it?

Of course a genetic algorithm work for this but it would be far too hard to train to the point of it actually being good.
Eadword
Posts: 21
Joined: 15 Aug 2012, 06:34

Re: AI Design Idea

Post by Eadword »

Although the AI is intended to be for any mod and therefor highly configurable, Energy and Metal are the only resources in the API. Although some games may add something as I recall the only way to access those is through LUA in most cases, which we could not have done. That is why we where focused on those two resources.

Secondly I do not believe that we tried to factor in tactics, however it is not a bad idea for future development, although it may be difficult. I personally would try and categorize them into a few options at first and then after observation add in more. The ones I would start with are Turtle, Rush, and Boom; eventually the hope would be to add in mixes that would factor in different tech levels.

The whole path-finding thing was really new to us at the time and, quite frankly, still is; the path finder class would find the best path to take and then the unit would receive the path in the form of a task. It is a great idea to somehow learn the map and that would be a resource held by the knowledge manager and accessed by all of the managers. It is a great idea but it would be a later feature due to its complexity (at least in my opinion).
Sorry, I just realized, we actually kind of had this, it is the map manager, although we did not really know yet how we would go about it.

Lastly we had joked about allowing the AI to read user commands during the game since I believe I had seen something in the API that allowed it read the in-game messages so then we could have had it so if the user said "turtle" for instance maybe it would not attack, just defend, or "attack" and then it would send what ever it had to where it knew the enemy to be (if it had found one by that point, otherwise I suppose scout then attack). Other than that team protection types of things would be managed mostly by the Battle Manager and if the AI has spare resources and their team mate does not the Resource Manager could share some.

I do understand that many things that I say would go under one thing or another are actually there since we had not specifically thought of it but I will be continuing to append to the dia file so that when this is all done I can put it up one the wiki. Also thanks for your input.
Attachments
SpringAI.7z
This is the updated diagram.
(10.02 KiB) Downloaded 18 times
User avatar
NeonStorm
Posts: 173
Joined: 23 May 2012, 18:36

Re: AI Design Idea

Post by NeonStorm »

How about give the AI a resource distribution relative to what the player does?

Player spend:
* 100m into units
* 300m into eco
* 1000m into defense

AI will try to spend:
* 100m into units
* 300m into eco
* 1000m*(0.5..1 based on unoccupied space) into defense
* rest into units or eco

The scouting manager tells the AI what the player is making.
Eadword
Posts: 21
Joined: 15 Aug 2012, 06:34

Re: AI Design Idea

Post by Eadword »

I would but I did not want the ai to cheat, if that is what you where saying, my hope was because the ai can do everything the player can do there should be no things added that a player could. Now if someone actually made this ai I would not complain, it is just why I would not.
User avatar
Neddie
Community Lead
Posts: 9406
Joined: 10 Apr 2006, 05:05

Re: AI Design Idea

Post by Neddie »

I do not believe he was suggesting the AI cheat in the traditional sense, but rather that the player's resource usage be mapped and modeled for the AI to emulate. You would have to do it over a period of time anyway, using abstract categorizations of expenditures to aggregrate the data usefully across factions, so this doesn't necessarily require affording the AI any advantage. It is something the player cannot do, of course.
Eadword
Posts: 21
Joined: 15 Aug 2012, 06:34

Re: AI Design Idea

Post by Eadword »

I think I see what you mean, although if the ai tries to use resources based on what it finds while scouting there are always things that it will not find causing it to inaccurately spend, unless it somehow does not die in scouting and is able to find everything. Correct me if that is not the idea but that is what I got from it.
User avatar
Neddie
Community Lead
Posts: 9406
Joined: 10 Apr 2006, 05:05

Re: AI Design Idea

Post by Neddie »

We'd have to ask him to clarify. I assume it could be done two different ways, either based on scouting or based on some sort of listener which has extended access to the sim. I think a system like that could be viable, if it only accounted for a portion (limited segment, perhaps) of resource usage and built a composite image of behaviour from snapshots, rather than the continnum of play or a single check. It seems like a fun problem.
User avatar
NeonStorm
Posts: 173
Joined: 23 May 2012, 18:36

Re: AI Design Idea

Post by NeonStorm »

I mean, the AI scout how many mexes the player has or could have claimed (which part of the map)

Thus expect (calculate) some income value.

Scout as many things as possible to scout.
-> Adjust expectations (of what the player makes)

If the player is expected to spend most resources on statics, the AI should try to claim most of the map.

Else the AI should try to hold some units ready to intercept attacker and raiders or focus on fast units instead of slow ones.


The AI should try to scout as much as possible, as long as the scouts don't suicide too much metal (compared to how much new things they scout and how much is available).


It should use unit vs unit statistics (killed, died) to make optimal counters, but also take into account unit combos (arty should be supported by riots, snipers need at least some scouts/raiders)
Eadword
Posts: 21
Joined: 15 Aug 2012, 06:34

Re: AI Design Idea

Post by Eadword »

Perhaps, but I feel that it would also have to be able to tell when the player updates to the moho ones and energy to metal things can be built. I simply think that although it is important to scout, it should not be used to determine how the ai spends resources. Again, it could be great but I feel that our would be more reliable to create a solid resource pattern that it tries to follow and knows how to adapt to different maps that may not have as much metal in reach for instance.
User avatar
NeonStorm
Posts: 173
Joined: 23 May 2012, 18:36

Re: AI Design Idea

Post by NeonStorm »

maybe it would be good, if UnitDefs have some common variables how AI will use these units.

Then it could get used by every AI.

e.g: Some slope tolerance variable (a fac could contain different units: ZK:striderhub, EvoRTS: the big fac).
* Sometimes some AI has built a veh fac on desert triad on the top of a hill.
Eadword
Posts: 21
Joined: 15 Aug 2012, 06:34

Re: AI Design Idea

Post by Eadword »

Do you mean having knowledge that it is builder, attacker, missile silo, factory,... That sort of categorizing?
User avatar
NeonStorm
Posts: 173
Joined: 23 May 2012, 18:36

Re: AI Design Idea

Post by NeonStorm »

Eadword wrote:Do you mean having knowledge that it is builder, attacker, missile silo, factory,... That sort of categorizing?
ZK uses unarmed as a category and STUPID_TARGET for highly armored things.
-> Mass is not always good to classify targets, because it does many more things.

Another example would be if the AI focus on either metal, energy or build power of the enemy if the enemy has very few of that.
-> units could have a variable storing their main use (e,m,bp)
Post Reply

Return to “AI”