How fixable is the AI?

The_Reckoning

Prince
Joined
Sep 21, 2005
Messages
436
Location
UK
Would be interested to hear from people in the know from the modding community. To what extent can the AI be made worthwhile?

Especially the combat AI - do you think it'll be able to beat a human when it has the advantage, and put up a good fight given an even playing field?
 
There's not much the modding community can do with the AI until the code is released. And I wouldn't count on that happening for a while (several, several months).

If the AI is to get better anytime soon it's all in the hands of the devs.
 
Given the many dozens of wargames I've played the answer will likely be "no".

No one has really managed to design a AI that can compete with a human player on a tactical/operational level, at least on a game that wasn't exceedingly simple, like chess, or that didn't involve pre-made scenarios.

The only way to make the AI competitive is to give production a massive boost that it can replace it's losses and replace Stacks of Doom with Blobs of Doom.
 
Given the many dozens of wargames I've played the answer will likely be "no".

No one has really managed to design a AI that can compete with a human player on a tactical/operational level, at least on a game that wasn't exceedingly simple, like chess, or that didn't involve pre-made scenarios.

The only way to make the AI competitive is to give production a massive boost that it can replace it's losses and replace Stacks of Doom with Blobs of Doom.

Well sure there is no AI which can compete with a good strategy player but you have various ways to improve an AI - and this game needs a lot of improvements here - plus you note it, in higher levels the AI needs help in form from bonus or resources. AI cheating is abolutly ok for everyone who understand why its needed.
 
like chess, or that didn't involve pre-made scenarios.

I've never done any AI work before, but I was wondering what the possibility was of coding in the equivalent of "chess scenarios" into the AI. And then the focus is on getting the AI to build to those scenarios, upgrade to better ones, and then utilize the scenarios its given.

Take a very basic scenario: Your one melee unit in range of a melee unit, who has a city behind him.

The Scenario: Should your melee unit attack the other unit?

The analysis:

1) By Combat Odds, my melee unit should be able to kill the opposing unit, and survive the counter attack. Else move to step 2. Note the AI can include the ability to use the autoheal promotion in this analysis to survive the counterattack.

2) If my unit won't survive the counter attack, but I will kill the other unit. And the other unit is X more worth than my unit (gold value plus some value for promotions). Then I will engage.


Else the AI should not attack, or should attempt to upgrade his scenario into a better one.

Now I recognize that building a chess computer for Civ V is overboard, but Civ V does have some advantages that chess AI does not. One, some of the scenarios will come up time and time again as units are re produced. Even though the scenario above is simple, it will come up fairly often in game.

Second, the Civ AI gets production advantages. So to me the AI should be built with "cautiousness" thrown in. It should only attack when it has absolute concrete goals it can obtain. It should only enter opposing city areas when it going for a particular goal. Otherwise, it should focus on build up and staying outside the "death zone" of 2 squares from a city.

The main reason for this is that as armies get bigger, the human is at a bigger disadvantage. The human will always be smarter, but with more units around for the AI there are fewer gaps and holes to exploit. The AI can afford the maintenance of a larger army better than the human. And since AI's get all the advantages for space race, and in theory cultural victories it forces the human to come to them for a military win (just like high level difficulties in Civ IV).

If the Ai can focus on defense first, and then offense when it has critical points of success, it makes it harder for the human to break...and therefore ultimately harder.


So that's my quick thought anyway, like I said I know very little about AI so I don't even know how easy it is to code recognition of a chess scenario nowadays.
 
I have little doubt that the AI will be made "worthwhile".

However, I don't think the tactical AI will ever be as good as a decent human player. Very few computer games have come close and none with this kind of complexity. For example, the AI in Panzer General was barely adequate and they could tweak that AI for those scenarios. Even the good AI in the V for Victory series wasn't all that great and again, they could program the AI for just that scenario. This is an open world game with no fixed maps and therefore it's going to be much harder to get everything right. It's a pretty daunting task.

With that being said, I do expect that they'll make it better so that it's not as glaringly deficient. That will be enough for the vast majority of players. If the AI doesn't send units in peicemeal and can arrange a coordinated attack - even if the tactics are basic - then that will be more than sufficient.
 
The issue is coming up with a generic combat procedure the AI can follow. It needs to be generic because you're not going to program a different procedure for every situation. (Here's the function for 1 unit versus 1 enemy unit, and we're one tile away from an enemy city. Here's the function for 1 unit versus an enemy unit, and he's inside the city's attack range and I am not. Here's the function for my huge army versus his one unit at a choke point on a hill and inside a fort.) Not only can these situations not be reduced to a clear-cut function, but any kind of a change in the AI will probably involve changing code in dozens of different functions, which is just asking for trouble.

There are issues with trying to make the AI generic and capable of handling every situation, though. Chess is a game of perfect information where everything can be reduced to a simple evaluation function. Nothing in the world is easier for today's computers. Cram a position into them, and they'll chug away at millions of positions per second, assigning a number to each one, and eventually pick out the move with the biggest number next to it. In a game with tons of extenuating circumstances (I'm 50 turns from a culture victory... He just declared on me but I only see one unit of his... He might have access to nukes...) evaluation functions become nearly impossible, and the computer is essentially making moves in a fog, without knowing how good of position it is in. The computer can only do so well, and making it any better would probably require programming in tons and tons of domain-specific knowledge, and would cost tons of processing power, especially when there could be 20 or so civs on a map fighting each other or deciding if they can win a skirmish/battle/war.
 
I was looking for an old quote but I couldn't find it. It was something along the lines of "You never finish and AI, you just stop working on it."
 
Unit formations shouldn't be that hard and would already be a huge improvement. Archers behind melee is just too basic for the AI to miss. And may be they can implement it along with the ability to move armies in formation, wich some players are asking for too.
 
I was looking for an old quote but I couldn't find it. It was something along the lines of "You never finish and AI, you just stop working on it."

Yep, until we can get a Civ Ai to the point where it can beat players like a chess AI, then there's always more to do.
 
To follow up on what a few others have pointed out, the AI will never be, tactically speaking, very sharp. It is insanely difficult to create intelligent AI (Chess AI, which some would characterize as "simple," is in fact mindbogglingly complex--look up Chess AI on Wikipedia and you'll have a profound respect for the clever tricks computer scientists have developed just to get the AI anywhere near capable of beating truly competent human opponents). As people mentioned here, the problem is even more intractable--maps and terrain are randomly created, there are tons of units, and risk vs. reward becomes difficult to compute. All of this means that the developers will probably never significantly increase the overall intelligence of the AI's tactical combat.

Nevertheless, it does seem that there are a few major blunders in the AI's tactics that could be ironed out. City combat is certainly one of them (playing a game on Immortal, I watched gratefully as Bismark destroyed half his army against a city-state with only two land tiles next to the city--for about 100 turns he was literally too stupid to bring any ranged units close enough to hit the city). Being a little more careful about ranged unit placement might be another.

All in all, I think it's going to take awhile. There are surely a number of other pressing balance issues, all of which are easier to fix than the AI.
 
I've never done any AI work before, but I was wondering what the possibility was of coding in the equivalent of "chess scenarios" into the AI. And then the focus is on getting the AI to build to those scenarios, upgrade to better ones, and then utilize the scenarios its given.

it's extremely difficult to do it that way. standard chess AI is just a very optimized search over a tree

civ5's tree is enormously bigger because there are more tiles, more units, and more than 1 unit can move per turn and in any order.

for modders to make a better AI they'll need more tools than just an XML file describing what to emphasize. they'll need to query the gamestate (which units are on what tiles, etc.) and make moves that can modify everything from which tiles citizens are using to which hexes to buy with culture to where to move units and in what order (order matters a lot because of 1upt).
 
There are issues with trying to make the AI generic and capable of handling every situation, though. Chess is a game of perfect information where everything can be reduced to a simple evaluation function. Nothing in the world is easier for today's computers. Cram a position into them, and they'll chug away at millions of positions per second, assigning a number to each one, and eventually pick out the move with the biggest number next to it. In a game with tons of extenuating circumstances (I'm 50 turns from a culture victory... He just declared on me but I only see one unit of his... He might have access to nukes...) evaluation functions become nearly impossible, and the computer is essentially making moves in a fog, without knowing how good of position it is in. The computer can only do so well, and making it any better would probably require programming in tons and tons of domain-specific knowledge, and would cost tons of processing power, especially when there could be 20 or so civs on a map fighting each other or deciding if they can win a skirmish/battle/war.

If you think the Civ AI as a whole, chess-kind of approach is impossible. But what if you limit one battle frontier to a tactical minigame? It just might be possible to use these evaluation functions and search trees there. I don't know if anyone has tried that approach in this kind of game.
 
Would be interested to hear from people in the know from the modding community. To what extent can the AI be made worthwhile?

Especially the combat AI - do you think it'll be able to beat a human when it has the advantage, and put up a good fight given an even playing field?

I'm not a modder, forgive me for posting, but it seems possible to improve the AI but it takes significant work, as it's probably easier to make a game than design all the possibly infinite AI counters to a human. I gather many of the key developers are already working on future games/projects.
 
I think there's a very good chance that Firaxis will address the AI issues in upcoming patches.

In the meantime, the AI is a tough thing to mod, so I'm not expecting the community to easily resolve those issues. But I'm more than willing to be happily surprised. :)
 
If you think the Civ AI as a whole, chess-kind of approach is impossible. But what if you limit one battle frontier to a tactical minigame? It just might be possible to use these evaluation functions and search trees there. I don't know if anyone has tried that approach in this kind of game.

If you were to take every unit in a select (very small) area and assume that nothing outside that small area can affect it, you might be able to do something. Either use a very, very simple evaluation function (like number of hit points left in my army - number of hit points left in his) and hope that enough brute force and crazy pruning will make it work, or perhaps use Monte Carlo methods to come up with best moves.

The real challenges are the ability to move multiple pieces multiple squares in one turn, resulting in an incredible number of moves to test for compared to the small number of pieces, and of course, processing power in a game people are already complaining is too slow during the computers' turns.
 
t's extremely difficult to do it that way. standard chess AI is just a very optimized search over a tree

civ5's tree is enormously bigger because there are more tiles, more units, and more than 1 unit can move per turn and in any order.

This isn't necessarily true. There's rarely a front line which spans 64 hexes with 16 pieces, some of those pieces able to move in all directions up to seven squares. A lot of basic AI failings occur with very few land units in a small area of land.
 
They're still trying to fix the AI since Xerxes used it at Thermopylae in 480 BC. A huge army fell against a bunch of city-states. Realism > Gameplay.:lol:
 
Back
Top Bottom