AI Wars Part 2: Building a better empire.

For you  map makers out there, you’ll be happy to know that I have modified the code today so that if you set your map to NO objects that it will create no objects at all (before it used to still seed the basic set which is no longer needed in v1.1). 

This means I can make a really boring but --- explicitly controlled map.

Screenshots of what’s going on

Please excuse the ugly screenshots. I’m in the debugger.

Turn 1:

image

Everyone on my test map gets 1 fertile land and 1 shard. It’s a barren, ugly world. This world has no quests. No goodie huts. No Monsters.

 

Turn 20: Comparison time

image ME

 

image AI: Gilden – The heavy production faction

image AI: Capitar – The merchant heavy faction

imageAI: Yithril – Warrior/Archer faction

So as the AI guy, my first evaluation on this is to decide whether they are making the right choices.  All three of the AI here have decided not to put any resources into training units but instead have put it into building up their city.

Turn 50: AI errors

image

 

Version 1.1 of Elemental supports mana maint. The AI must learn how to use this.

image

 

I don’t need to go further. Now it’s time to go back and make adjustments.  Stay tuned for part 3.

94,095 views 47 replies
Reply #1 Top

Are different factions going to do things differently?  Like in the GalCiv2, some factions were more aggressive than others, more diplomatic, ect. 

Reply #2 Top

I believe that is the point with identifying each faction like:

 

AI: Gilden – The heavy production faction

AI: Capitar – The merchant heavy faction

He wants the factions to have their own personality. 

Reply #3 Top

I hope so.

Reply #4 Top

I also hope that the factions begin behaving distinctly. As it stands they're just boring to play against because the only real differences seem cosmetic, and barely that.

 

Here's hoping the threading can get elemental up to GalCiv2's standard.

Reply #5 Top



 
I don’t need to go further. Now it’s time to go back and make adjustments.  Stay tuned for part 3.

End of quote

 

Heck i will! I hit the refresh button until it glows red  :grin: . Its very interesting to hear all that stuff. What i thought was a bit disappointing is that that no Faction tried to grab the shards early on for a Manaboost. Ok there are no monsters to fight but having additional power behind the lowlevel spells was for me atleast a vialble tactic to fend of some of the bigger stuff. If the shards give a boost to the mana-regen it also may be a good choice to grab a shard early so that boosting-spells for food/research can be used more often or atleast ones without drawback.

 

 

Reply #6 Top

I think development of AI personalities will come later. I would think he needs to get the basics working and insure he has the functions in place to hook personalities onto first. I've only done a little multi-threaded programing so I'm very interested in how a multi-threaded AI for a game like this works, so please keep it coming Frogboy.

Reply #7 Top

Right but i still would like to see it. I myself did tinker a little bit with MPI (which is more for clusters) and some minor Robotics and Micro-controller stuff. To bad that Java-script (in which i do prog a little Rpg-like browsergame) does not support threading natively i could use some of the insights i won here for that project.

 

Do the Ais have building lists or do they get some kind of goal-driven system? I mean is it more like "build 2 Merchants and if possible a Goldmine" or is it more "reach a Gold production of 5 but you can decide how you do it"? 

Reply #8 Top

Sorry to ask this again- but why is it not feasible for the AI to learn from the players, and maybe if people play MP or connect to Impulse, other players.

 

You mentioned not doing this in part 1, why is it impractical?  An adaptive from game to game AI does seem like it would be the best way to reduce errors, or quickly find gameplay flaws (such as a one optimal solution)

 

 

 

 

Reply #9 Top

Doesn't this just prove that we're not going to have any better AI in 1.1?  Or is too early to tell?  Should I wait for Post #3 on AI?

Reply #10 Top

Quoting Alstein, reply 8
Sorry to ask this again- but why is it not feasible for the AI to learn from the players, and maybe if people play MP or connect to Impulse, other players.

 

You mentioned not doing this in part 1, why is it impractical?  An adaptive from game to game AI does seem like it would be the best way to reduce errors, or quickly find gameplay flaws (such as a one optimal solution)

 

 

 

 
End of Alstein's quote

 

My (very limited!) understanding of machine learning is that you need LOTS of test data for any effectiveness and to store Lots of possible options. Methinks the complexity of Elemental makes this just too much for modern processors? (Which, if you've never tried coding, are actually rather slow when it comes to brute-forcing anything with a half-reasonable amount of data)

Reply #11 Top

Quoting Alstein, reply 8
Sorry to ask this again- but why is it not feasible for the AI to learn from the players, and maybe if people play MP or connect to Impulse, other players.

 

You mentioned not doing this in part 1, why is it impractical?  An adaptive from game to game AI does seem like it would be the best way to reduce errors, or quickly find game-play flaws (such as a one optimal solution)

 
End of Alstein's quote

 

Alstein any form of learning Ai has (so far as i have seen) one mayor problem: Debugging. At some point you get very complex set of rules/neuronal connections/genes that you cant fathom out what the Ai does (ok you can but it needs time). It becomes a Black-box unless you have some genius way to sort and visualize this overly complex systems.

 

Also at this point of Ai development its better to have some predefined Rules and Rule-systems. Like the layers of animal and Human behaviour which has (from a simplistic POV) 3 Layers. The first layer are biological base function and needs like breathing, little programs that run all the time with preset parameters - for elemental thats i think mostly the 1.09 Ai.

 

The second level are Instincts thus behaviours with variable parameters (some of frogboys stuff). Cocks for example have an "flock defence" instinct - they attack anything that is "furry", in a preset but variable size category (loosely "everything smaller then me") and approaches the nests/flocks. For the last thing the distance varies. In a highly dangerous environment the distance is bigger then in a relatively save area. Deer as another example show bigger Flight distances in Area with Human hunters then say in National parks. The instinct get reinforced thus some variables get lower or higher to fit.

 
Another interesting case which are Baby-ducks which can distinguish the shape of flying birds. At theyr birth they flee from any bird or flying object. The general shape triggers the instinct any time but the shapes get sorted by statistic. Baby-Ducks dont flee from other flying ducks because the shape of ducks is normaly far more common then the shape of a predator like a hawk. This is more Patern recognition and very near the 3rd layer.

 

Preset Instincts and even more so base programs can be extremely fast. Locusts have collision detection that works in nanoseconds and was adapted for cars.

 

The third layer is now learning and it gets pretty messy. First of all Learning needs much more Memoryspace which for a Game that is for example pathing heavy anyway a natural problem. Wolves learn to not attack Skunks and porcupines but need to "shape" (which is different from reinforcing a existing one) neuronal pathways to make the connection. They have to store far more parameters for a porcupine like the destinct smell, common collors, expressed behaviour and what not and have to link it to something. But to gether this knowledge the wolf needs the instinct to hunt prey in the first place. The learned behaviour overwrites the instinct/reflex here. The thing is that the wolf creates a subroutine that over-writes the older pre installed one - in terms of computers it means that the game would creates a database of exceptions.

If the game creates to much exceptions your DB gets far to big and the game slows down to much because you have to do long searches. If the game now does not create enough exceptions it falls for the same ruse 20 times in a raw before it catches up if it ever does. THe game needs also the ability to recognize patterns and to apply them.

Learning ais have still have some other problems. Often they take the wrong parameters into account but may seem to work in certain situation. Some pattern recognition stuff went hilariously wrong (some years back) because it took the wrong parameters into account iirc. It was trained to recongize cars with an archive of pictures and the archive had only older more blocky modells were upon the system failed to recognize new more rounder models because they didnt have so sharp angles.

 

In my opinion learning Ai needs at least some minimal scaffolding to build upon and is often very hard to debug and to analyse. That Frogster does now all the layer 2ish stuff creates a also very stable scaffolding to which a Learning Ai could fall back if it fails to win.  

Reply #12 Top

This is tedious. Why not have the AI design the AI?

In terms of general decisions, you can have repetitive play-testing yield improved AI strategies. By creating a tally system for the development of the AI, you could have it do most of the work for you.

For example, during the game, the tally system can keep records of how much was put into research of different kinds, how many resources of particular types were harvested, how many units with particular abilities were trained, how many cities, improvements, spells of type, expenditures, etc. When the AI loses, it examines at what stages of the game it was behind in any particular aspect, and automatically re-prioritises a new XML.

In this way, rather than classify play-styles or techniques in abstract terms as we humans think, the AI will instead have multiple configurations of human strategies stored that it compares to the current actions of the human (or even other AI player) it is playing against, and chooses the closest matching one.

Couple this with specific override directives fed to the AI as a result of community feedback, and you have a 4x strategy game that plays out like a Chess match.

:cylon: You have 15 seconds to comply..... 

Reply #13 Top

I think you're extrapolating the learning measure too far. For an AI in Elemental, learning would simply mean that it adapted at what combat ratings it attacks, and at what combat ratings it does not attack. This would be similar to if the AI should declare war or not, after power rating. The AI "learns" in the sense that it comes closer to making accurate assessments ("I need X to defeat an enemy of Y. if X is not enough, next time I will try X+Z. My goal is to win at least 75% of the time.").

 

Reply #14 Top

Quoting Heavenfall, reply 13
I think you're extrapolating the learning measure too far. For an AI in Elemental, learning would simply mean that it adapted at what combat ratings it attacks, and at what combat ratings it does not attack. This would be similar to if the AI should declare war or not, after power rating. The AI "learns" in the sense that it comes closer to making accurate assessments ("I need X to defeat an enemy of Y. if X is not enough, next time I will try X+Z. My goal is to win at least 75% of the time.").

 
End of Heavenfall's quote

I think you think I know what extrapolating means. My post was inspired by a combination of Skynet and ED-209. In other words, a mixture of unrealistic expectations and resulting disasters.

Also, for fun, I like to write code that writes code. It's interesting to see sometimes the weird things that can occur if you do it in such a way that allows the program to make it's own decisions as to what code to write, especially when those decisions don't come from a predefined set list of allowable options.

Reply #15 Top

Actually I was talking to Heph_

Reply #16 Top

Quoting Heavenfall, reply 15
Actually I was talking to Heph_
End of Heavenfall's quote

 

But you were looking at me when you said, 'Why is a Raven like a writing desk....'

Reply #17 Top

Quoting Alstein, reply 8
Sorry to ask this again- but why is it not feasible for the AI to learn from the players, and maybe if people play MP or connect to Impulse, other players.

 

You mentioned not doing this in part 1, why is it impractical?  An adaptive from game to game AI does seem like it would be the best way to reduce errors, or quickly find gameplay flaws (such as a one optimal solution)
 
End of Alstein's quote

A true AI e.g. a simulated adaptive neural network complex enough to play Elemental and truly learn is beyond the scope of what is possible on the current generation of home computers in my opinion. I mean they've yet to make a truly effective chess AI that can run even on a supper computer.

Computers aren't intelligent, if stardock wrote a truly adaptive intelligent oponent that truly learned how to play a game of the complexity of elemental the whole academic AI comunity would proclaim it the biggest AI break through in history.

To sum up you have no idea what your asking for; have you any idea of the size of neural network you use to play elemental, understand the game and come up with stratergies, (just including the parts of your brain you use for this), simulating that many neurones in realtime on your PC is simply not possible it doesn't have the processing power or memory needed for that sort of simulation.

Reply #18 Top

Quoting Heavenfall, reply 13
I think you're extrapolating the learning measure too far. For an AI in Elemental, learning would simply mean that it adapted at what combat ratings it attacks, and at what combat ratings it does not attack. This would be similar to if the AI should declare war or not, after power rating. The AI "learns" in the sense that it comes closer to making accurate assessments ("I need X to defeat an enemy of Y. if X is not enough, next time I will try X+Z. My goal is to win at least 75% of the time.").

 
End of Heavenfall's quote

So rather than actually learning you want the programers to decide on some random variables in the formulaic responses that the system will adjust when it looses. You can give it a try but since the results of it's atempts may vary from game to game and the degrees of freedom (what it can learn and to what extent) are preprogrammed it might not be as effective as you think. Certainly it's not actually a learning AI.

 

Reply #19 Top

Quoting Trojasmic, reply 9
Doesn't this just prove that we're not going to have any better AI in 1.1?  Or is too early to tell?  Should I wait for Post #3 on AI?
End of Trojasmic's quote

I have to say I find you avatar very appropriate; you always seem to be down beat on everything you post. Cheer up :grin:

Reply #20 Top

Quoting Istari, reply 12
This is tedious. Why not have the AI design the AI?

In terms of general decisions, you can have repetitive play-testing yield improved AI strategies. By creating a tally system for the development of the AI, you could have it do most of the work for you.

For example, during the game, the tally system can keep records of how much was put into research of different kinds, how many resources of particular types were harvested, how many units with particular abilities were trained, how many cities, improvements, spells of type, expenditures, etc. When the AI loses, it examines at what stages of the game it was behind in any particular aspect, and automatically re-prioritises a new XML.

In this way, rather than classify play-styles or techniques in abstract terms as we humans think, the AI will instead have multiple configurations of human strategies stored that it compares to the current actions of the human (or even other AI player) it is playing against, and chooses the closest matching one.

Couple this with specific override directives fed to the AI as a result of community feedback, and you have a 4x strategy game that plays out like a Chess match.

You have 15 seconds to comply..... 
End of Istari's quote

Istari,

I believe what you are talking about is a Learning AI engine and most AI engines are not learning AI engines.  The Human brain is a learning intelligence engine.

But this is a valid strategy for learning AI engines, by changing certain database and resource variable you can change how fast or how much a particular instance can "learn".

Cheers!

 

Reply #22 Top

Quoting Heavenfall, reply 13
I think you're extrapolating the learning measure too far. For an AI in Elemental, learning would simply mean that it adapted at what combat ratings it attacks, and at what combat ratings it does not attack. This would be similar to if the AI should declare war or not, after power rating. The AI "learns" in the sense that it comes closer to making accurate assessments ("I need X to defeat an enemy of Y. if X is not enough, next time I will try X+Z. My goal is to win at least 75% of the time.").

 
End of Heavenfall's quote

 

Learning means that you create something absolutly new. Your idea here is more Akin to an instinct with reinforcemnet. Its an basic instinct that can be preprogrammed with the value of say x = y+z% and z=20. The thing with instincts is that they can have simple variables that modificate a behaviour but dont create a entirly new behavior. In this case you run a fairly simple statistic on one set of values or you do a direct reinforcement by calibrating z after each fight say by incresing it by 3 after a lost battle and decreasing it by 1 after each won battle.

 

Learning means the acquiring of entirely new Technolgies and Strategies.

Both, learning and instincts seem very similiar at times because one can use a learned behavior like a respective on top of preprogrammed "instinct" - but this would be then a reflex. Dr. Iwan Petrowitsch Pawlow did something similiar with dogs. The pawlowian-reflex is an aquired thus learned behaviour which is entwined with a preset behaviour (a "baseprogram" in this case) that made the dog water its mouth upon seeing food.

Reply #23 Top

Quoting Istari, reply 16

Quoting Heavenfall, reply 15Actually I was talking to Heph_
 

But you were looking at me when you said, 'Why is a Raven like a writing desk....'
End of Istari's quote

I don't know what this means (or what the reference is from), but it was very funny...

Reply #24 Top

Brad,  you wanted CHEESE, here is my cheese.

The current AI is flawed in that it does not react to the following situation.

AI 'X' decides I'm a good target and attacks my newest outpost, while I may be weaker ATM I used summoned creatures and magic to break the AI's assault and then immediately follow up with a counter assault of my own which steamrolls the AI all the way back to its Capital.  My analysis is that the AI is not capable in its present state to adapt its suplly line of fresh troops allowing me to pick them off 1-3 at a time before they and consolidate and become a serious threat.

That was problem #1, problem #2 is that the AI Sov seems against common sense to refuse to defend its capital and the Sov stack tends to be the last significant threat once war breaks out. 

Combined, these are the two flaws that make the Hardest AI setting to be a cakewalk imho ... 

  

Reply #25 Top

Quoting Trojasmic, reply 23



Quoting Istari,
reply 16

Quoting Heavenfall, reply 15Actually I was talking to Heph_
 

But you were looking at me when you said, 'Why is a Raven like a writing desk....'


I don't know what this means (or what the reference is from), but it was very funny...
End of Trojasmic's quote

 

Alice in Wonderland...