Frogboy Frogboy

More weekend AI musings

More weekend AI musings

I’ve been getting a lot of messages. Let me first say that I get between 20 to 30 a day (just messages, not counting my regular email) so I tend to be very very slow in getting back to them (I apologize in advance for this).

But the most common question I have been getting these past few days is “How will I know if the AI is “good enough”?

Now, I understand that people want the game to come out on August 24th (the scheduled release day). I very much want this too. But we’ve been working on this game for a long time and we want to get it right and the AI is a big part of that. If the AI isn’t ready, we’ll push it back to the next retail slot available to us (February 2011).

I am pretty confident that the AI will be ready.  So again, how will I know if it’s ready?

The basic answer is, if it can beat me on my test map, it’s probably ready to go.  The test map consists of a main continent and 4 islands.  Thus, the AI has to be able to handle everything from me simply walking to him and crushing him to taking care to not let me take over the islands and wipe him up with magical spells (the shards are on the islands). 

There’s lots of other strategies in between I’ll try out on it and have it learn.  But that’s the basic minimum I expect – be able to play a good game without having to cheat.

Today, I focused more on the nuts and bolts. Getting the AI to build a decent army and start carefully targeting cities and units that it thinks it can take.  One AI player ultimately beat out the other 3 and won the game (I wasn’t participating in this game).  It didn’t do it very well IMO. It was inefficient and sloppy but it did, after many new functions being added, eventually get its act together beat its AI competitors.

But it has a looong way to go.  The TACTICAL battle AI I won’t get to for another 2 weeks. That’s why we haven’t been showing it yet.  Then there’s the matter of it using magical well both tactically and strategically.

The part I’m really not looking forward to is dealing with islands and human cheese (build up via magic a wall of mountains or turn your area into an island).

I am happy to say that right now, the AI does do some critical (and difficult) things even now such as designing its own units (non trivial), intelligent building up a city under many different circumstances (again, non trivial, the GalCiv AI never built its planets well ). It can recruit NPCs. It can marry and have children.  It can gather together units and form a combined arms army. It can research technologies intelligently.

So even at this stage, other than the island hopping and the tactical battle AI (and having it cast spells) we could toss out a “challenging” AI if I let it cheat enough.  Of course, that’s not acceptable. The AI needs to play well without having to cheat.

I’m going to toss in a disclaimer here – EVERY AI I’ve ever written has guys who have just gotten incredibly good or found some loophole and said “The AI sux!11!”.  This will be the case here too.  I’ll be working on this AI for years to come.

If you have any questions on AI development, feel free to ask here.

 

p.s. Hello to my friends on CanardPC. :)

114,776 views 65 replies
Reply #51 Top

Quoting Orvidos, reply 8
"Human cheese." Interesting way to put it.

The day the AI is able to figure out how to counter me doing absolutely batshit things that would leave me defenseless/dead against human players (but yet, maybe not!) I'd call it ready.
 
Basically: When it can adapt at human speed.

It's difficult to to implement. At best, it will look like AI is adaping, but it will be programmed to do so, it will not do it itself.

Also, a game should have effective scouting. So to adapt to something, AI should have a way to know about that "something" (like, the fact that you're defenceless). Surprisingly, most 4X strategies are reactive - you see something happening and you adapt to what already happened. There isn't many ways to scout what's going on and no way to guess the rest based on the scouted information. Competitive RTS are more advanced in scouting/counter-scouting, guessing game and strategies/counter-strategies.

Reply #52 Top

I must say that I am happily surprised that the AI can already design its own units. I thought that you would have to "make" units for each faction's AI.

Reply #53 Top

Depends on your definition of cheese. A common strategy in this type of game, is to tech for a tech switch, so you can trick your opponent to waste his energy on the wrong stuff and give him a false sense of security. I've never seen an AI capable of such a ploy, nor have I seen an AI that would look for it, recognise it, or know how to respond to it.

I'm very, very, very, very much in favour of letting the AI use stratagems. Especially if it can be done in such a way that the AI can check if conditions in-game favour a particular ploy, load up a how-to, and start executing it. It might not benefit the best players, but I doubt most of us will ever be so good at the game that we won't routinely expose our soft little underbellies to some flavour of cheese. Even if most of us eventually learns how to cope, actually having to pay attention to what the AI is doing - and perhaps even facing an AI that receives new cheese how-to's over the years - would make it just about the most entertaining AI in video gaming.

Reply #54 Top

Quoting Ellestar, reply 51

Quoting Orvidos, reply 8"Human cheese." Interesting way to put it.

The day the AI is able to figure out how to counter me doing absolutely batshit things that would leave me defenseless/dead against human players (but yet, maybe not!) I'd call it ready.
 
Basically: When it can adapt at human speed.
It's difficult to to implement. At best, it will look like AI is adaping, but it will be programmed to do so, it will not do it itself.

Also, a game should have effective scouting. So to adapt to something, AI should have a way to know about that "something" (like, the fact that you're defenceless). Surprisingly, most 4X strategies are reactive - you see something happening and you adapt to what already happened. There isn't many ways to scout what's going on and no way to guess the rest based on the scouted information. Competitive RTS are more advanced in scouting/counter-scouting, guessing game and strategies/counter-strategies.

I don't know about most 4x games, but not all are and there's no particular reason 4x games should be. Dom3, for example, has tonnes of scouting-specific stuff and, at least if you play against humans, you will get your ass kicked if you don't utilise them. GalCiv2, on the other hand, lets you gather the same information and use it in the same ways, through diplomacy and espionage. GalCiv2 makes it way too easy, actually, but as the AI is basically incapable of being tricksy and doesn't know how to recognise the signs of incoming human cheese, it's not a problem.

Reply #55 Top

Frogboy, is it possible for regular players (ie: non-developers) to start up an AI-only game and observe them?   (I'm not in the beta yet so I don't know).  In any case, that sounds like it would be a pretty nifty feature - I think it'd be fun (and informative) to set up a bunch of AI players of different types and "spectate" what happens.

 

Reply #56 Top


If you have any questions on AI development, feel free to ask here.

I noticed that it's relatively easy to mod an extra feature to the existing AI, but almost noone changes an AI structure - it will basically require a rewrite of the AI. So, to make a good AI i think it's important to use an advanced AI organization (even if it does nothing at the start). So, the question is:

1) Is your AI hierarchical (strategy level, tactical level, unit level etc.)?

2) Can AI make and execute war plans and development plans?

3) Anything else of note that is important but equally hard to add later?

Basically, why exactly Elemental AI may become stronger than other 4X AIs?

The point is that with (1) AI actually knows what's his high-lvl goals and how to achieve them with low-lvl stuff, instead of doing low-lvl stuff in uncoordinated manner with no particular purpose. And (2) is important for efficiency - say, instead of having a chance to make a 2nd Farm 50% of the time in the growth phase when XML tells AI to focus on food (basic fuzzy logic + data-driven AI), maybe AI will be better with plan to make a Library then a Farm, and it will still have enough food.

Reply #57 Top

Quoting Ellestar, reply 51

It's difficult to to implement. At best, it will look like AI is adaping, but it will be programmed to do so, it will not do it itself.

Also, a game should have effective scouting. So to adapt to something, AI should have a way to know about that "something" (like, the fact that you're defenceless). Surprisingly, most 4X strategies are reactive - you see something happening and you adapt to what already happened. There isn't many ways to scout what's going on and no way to guess the rest based on the scouted information. Competitive RTS are more advanced in scouting/counter-scouting, guessing game and strategies/counter-strategies.

 Veeeeery true.

 

Reply #58 Top

It can research technologies intelligently.

Along the same lines as Ellestar's quesitons - does this mean the AI will chose which research to perform based on its changing needs and goals, rather than on some sort of table driven system?  How does that work?  Some sort of weighted priority of tech areas, or something more detailed?

Also, have you seen any of Christopher M. Park's writings about AI (he did the AI for AI War).  His AI has the huge luxury of not playing by the same rules as the player, but he says some interesting stuff about emergent behavior and the potential pitfalls of "optimal" AI behavior.  http://christophermpark.blogspot.com/2009/06/designing-emergent-ai-part-1.html

 

Reply #59 Top

Quoting LintMan, reply 58

Also, have you seen any of Christopher M. Park's writings about AI (he did the AI for AI War).  His AI has the huge luxury of not playing by the same rules as the player, but he says some interesting stuff about emergent behavior and the potential pitfalls of "optimal" AI behavior.  http://christophermpark.blogspot.com/2009/06/designing-emergent-ai-part-1.html

 

I already saw this article. His AI is designed to do a completely different task than 4X AI - that is, how a zerg should lose to the player in a cool-looking way. AI has significantly more units than a player, and if it's wanted to win AI should have attacked with all units at the same time. Also, as i understand, rules of his game are very simple. You can't really do a something like "emergent behavior" for global spells, for example :)

I agree that decision trees for a strategy choices opens too much room for exploits, it's hard to debug and to maintain. Fuzzy Logic is better, but it should be well-tuned to be effective. I mean, he mentions that RTS AI without Fuzzy Logic is too predictable, and that's true, but predictability is rarely a problem in TBS. I mean, it's not like you care if AI always makes a library when the most efficient building to make is a library, right? And when TBS AI decides what to build with a Fuzzy Logic, you'll see that one AI makes 2 cities, and another one 6 cities, because first AI decided by random that it's better to make Library, Temple and Barracks first, and effectively lost the game because of it. That AI stupidity because of the wrongly-tuned Fuzzy Logic happens too much. Actually, many early TBS "AIs" built buildings and researched techs at random. Or, at best, random + some hardcoded priority (so-called data-driven "AI").

So, it's not like "optimal AI behavior" is a bad idea. Obviously, non-optimal behaviour is worse. The only problem is to make it optimal for real, not just to call it "optimal" :) Predictability is not optimal either.

Reply #60 Top

One thing I really liked in GC2 is how AI  are unique. It's not juste some architectural/tech difference between civs, but they act in different ways, like they have their own culture and objectives. You can produce a "perfect" AI, but without some personality, it won't be fun (in my opinion).

 

Quoting Frogboy,


p.s. Hello to my friends on CanardPC.

Hehe, thanks we appreciate it. Some of us were wondering if it was you or your evil twin who posted on CanardPC (I still have some doubts).

:ninja:

Reply #61 Top

Frogboy, if you rated all your AIs at 5-7, tops, what's the highest rated AI you've ever played against?

Civ4 had the best islandhopping AI I've ever seen, you could copy that for a start.

Reply #62 Top

Quoting Noumenon72, reply 62

Civ4 had the best islandhopping AI I've ever seen, you could copy that for a start.

Weird....I thought that it was quite weak...but again I was only playing with the FFH2 mod. Maybe it's different in the vanilla?

Reply #63 Top

Quoting Tormy-, reply 63

Quoting Noumenon72, reply 62
Civ4 had the best islandhopping AI I've ever seen, you could copy that for a start.

Weird....I thought that it was quite weak...but again I was only playing with the FFH2 mod. Maybe it's different in the vanilla?

Vanilla AI isn't that good (but still better than in many other 4X games), i played my first game in Civ 4 on Deity difficult and won :) In Warlods expansion, they included a BetterAI mod and AI become much better. Compared to other 4X AI's, it's one hell of a monster AI for such a complex game. FFH2 AI is relatively weaker because mod changes a lot of things and adds a lot of new things, but AI was never a focus of that mod, they're using the original game AI. So, it shows that Civ 4 AI was well-designed - it works with effectively a new game (FFH2) without any major changes.

Reply #64 Top

Quoting Scorpiana, reply 25
Just a little (maybe ) question, will we be able to just have a few AI's play against each other and see how / why they decide to do the things they do? That could make for an interesting new game, have people try to develop an AI that can beat the others, could even become a tournament, let the best AI win and become self aware... Ok, that last part may be a bit too much

lets do this