June/July Patch Notes

The point of this whole TLDR is that it is a false dichotomy to compare AI algorithms for chess and for Civ. There is a completely different underpinning play model. It's made more difficult in Civ NOT because of the possible permutations but because of the inability to devise the kinds of databases that chess models use. The Civ AI must play "by the seat of its pants" because there exists no century's worth of opening and ending positions.

The difference is easier to see if you consider the way both chess programs and the Civ program offer levels of play, from most difficult to easiest. The chess program null hypothesis is the scoring of positions, and so its default is to play perfectly. For easier settings, it's simply a matter of selecting the positions with lower scores thus giving the human a chance to take advantage of "mistakes".

Civ, on the other hand, works oppositely. Its null hypothesis is to make the best possible play within the rules at the lowest levels, and then to "cheat" at the highest levels by ignoring rules that bound humans.

I hope this helps to facilitate a better understanding of how the two compare — or rather, how they really don't at all.

This is going to bit OP, but while it needs large opening libraries and complex heuristics to do a chess machine like Deeb Blue (I didn't left these unmentioned because I didn't know about them but because they are somewhat irrelevant for this comparison), it's fairly easy to code a chess program that looks somewhat intelligent and can beat a novice without bonuses. It's not as easy to program such AI to CiV, and the fundamental reason for that is that CiV really is an infinitely more complex game than chess. Yes, possible permutations of chess positions will eventually grow to the point that a computer can't handle, but for CiV it happens much quicker. In chess you can evaluate several positions ahead, but for CiV it's impossible to evaluate even two turns ahead. Even if you restrict CiV AI problem strictly to tactical combat, it's still essentially more complex than chess as in CiV, you can move all you're units during one turn instead of just one, which leads to combinatorial explosion much quicker. Chess really isn't a particularly complex game in computing/mathematical perspective, and that's the fundamental reason why chess computers do so well against humans. In slightly more complex Go computers suck while there are lots of research put there too.
 
People keep bringing up SC2 as an example of "good AI", and although I'm a noob at the game I find it poor. It's strats are incredibly predictable: it just relies on high apm on higher levels (if I had 1000 apm I'd do decently too). Civ is *much* more complex in it's mechanics than SC2 and the options available are far more open-ended than "build units and send them crashing into the opponent's units" which is essentially what the SC2 AI does. So no disrespect to SC2 (love the game) but it's not the pinnacle of AI programming some make it out to be imo. Sorry to go OT.
Like you said, you are a noob at the game making you completely unqualified to rate the level of the SC2 AI. The higher level AIs do a lot more than just beat you with high APM. They will rush, they will harass, they will do drops, etc. They might not used some of the more advanced techniques that you see in tournaments, but the AI is quite good.

I do agree that the Civ AI is much more complex for a number of reasons. The most obvious is that there are more than just 2 players, a lot more "structures" and "units" that can be built, a lot more dynamic interaction between the players AIs and City-States, etc.

Writing a good Civ AI is extremely complex, but I do agree that the AI could use a number of improvements.
 
Chess really isn't a particularly complex game in computing/mathematical perspective, and that's the fundamental reason why chess computers do so well against humans.
With respect, I reject your premise. Chess computers are horrible against humans when they play from a brute force "computing/mathematical perspective." Without the openings and endings libraries and without the positional heuristics, not even a parallel array of Crays could beat an ordinary master, let alone a grandmaster or world champion. Computations at billions of terabytes per second, 99.99999% of which are pointless, won't win games. Human emulation is critical. A grandmaster doesn't begin a game by calculating from a position of 1. a3, but a brute-force computer will. The trick is to aim for the plausibly useful while ignoring the insanely pointless. Computers that beat humans do that for any position that is not book.
 
I said this elsewhere.

By the way, I like these changes, despite the dampening of several of my favourite Wonders and Policies. Wow, now I really struggle between picking Tradition or Liberty and Freedom is way less powerful. And the Horseman's new city penalty. LOL. All those that tweaked the settings and 'achieved' Deity Victories with the early Horseman should have to redo it for the Achievement. This game is becoming what it should have been in the beginning. Thx Fireaxis.
 
Programmer and wargamer here, I'm loving the AI discussion. My $0.02:

Civ V has no excuse for poor tactical AI when tactical hex-based wargames have been proficient in them for decades. If we put the Civ V AI up against Panzer General AI, I have a feeling the Civ AI might just lose the battle. That said, I believe there are structural problems with Civ which prevent effective tactical application of AI - namely the restrictive topology of the map.

From my experience, the effective battlefield is only a couple hexes wide. It's rare to get an open field not hemmed in by mountains or coasts (I don't play on pangaea though, so I admit I have no idea how the AI fared there - but even in the middle of a continent, there's plenty of impassable mountains and cities). With such little room to maneuver, units become stuck in the ordering they were in when they first reached the battle. Hell, it's even a headache for me, a human player, to order things in formation if a mountain or a hill breaks up my trail of marching units.

Compare that to wargames where most of the land is traversable, and it's evident that for Civ V:

- the possibility space for movement is much lower (which is a point in favour of the AI, since there's less computational complexity)
- the topology is more complex because each hex does not have a passable neighbouring hex (a point against the AI, because movements are more complex to calculate, especially if you throw embarkation into the mix, which I don't believe the AI does)
- the position of units is less flexible because you have to order them before encountering combat. If a player catches you while marching, chances are he can get rid of or bypass the two guard units the AI has and slaughter the rest of the ranged units. That's been my experience.

That said, the computation for tactical AI should not be insurmountably complex. Given the limited range of movement and combat order, and the easily sortable order of attack, you result with a combination, not a permutation, of moves.

However, if Civ V's AI is anything like that of Civ IV, it's not traversing a possibility space. Instead, it would be using heuristics to set goals and resolve combat. This would be 'good enough,' rather than the 'correct and optimal' solution you'd get by considering all reasonable possibilities. This is easier to code but trickier to get right, since you're relying on 'good enough' behaviour to emerge from simple blocks, and it's difficult to predict the final effects of tweaking those blocks because the complexity is compounded through multiple turns and civilizations.

What's interesting is that the designer gave the AI bonuses to its strategic goals (higher prod, happiness) rather than its tactical goals (no +% vs human, for example). The strategy AI is probably more complex than tactical AI, but I bet it's easier to compute even if it's harder to get right. If the AI were better at pursuing its grand strategy and received bonuses to combat instead, that might be an interesting compromise to consider.

PS

I'd like to see a Civ vs PG battle, actually. A large land-only map, load it up in both games, and when PG makes a move, manually do it in Civ, and when Civ makes a move, manually do it in PG. Mod either game so ranged and melee units behave the same across the games, and let the AIs duke it out...
 
Perhaps after the DLL is released a mod can come out that completely rewrites the AI to play as a leader as opposed to a competitor.

lolwut?

You do understand that leaders of nations compete...often, right?
 
It's not as easy to program such AI to CiV, and the fundamental reason for that is that CiV really is an infinitely more complex game than chess. Yes, possible permutations of chess positions will eventually grow to the point that a computer can't handle, but for CiV it happens much quicker. In chess you can evaluate several positions ahead, but for CiV it's impossible to evaluate even two turns ahead. Even if you restrict CiV AI problem strictly to tactical combat, it's still essentially more complex than chess as in CiV, you can move all you're units during one turn instead of just one, which leads to combinatorial explosion much quicker.

Just considering the tactical AI (the infrastructure logic is potentially much easier, though there's room for imrovement there too) the difference in problem space complexity is enough that comparisons with chess AI is difficult. Some parts aren't relevant (though I'm not a chess AI expert). also, caveat here - I haven't read any developer interviews for Civ. but...

For a game like civ, we break down the overall situation into logical simulation islands and apply some set of rules to each sub-section. There's also an overall strategy bias (ie, move units towards an opponent and/or set up a defense, etc.) but the key is how well we analyze each local situation and how well we apply some combination of our rules. This is different from chess in that we don't typically do an exhaustive analysis of every possible move - it's more like chess's positional scoring.

It looks like the developers could put more work into weighting the different aspects of the possible positions. An example is the AI's predeliction to place ranged combat units towards the front lines - putting more emphasis on maintaining a protective zone of control front would be beneficial.

Some aspects of Civ's AI don't have a chess equivalent. For instance, in a chess game the human player and the AI are on a completely balanced playing field - total knowledge of the current situation. In Civ, it's unlikely that the AI "sees" the game in the same way as a player does, and it'll affect the situational analysis logic. This is true even if the AI is very strict about only considering data an equivalent human player would have. The main difference is memory - as units move in and out of the fog of war, how does the AI remember and "weight" previously sighted risks? It's impossible for it to do so the same way a human player does - our squishy brains are very good at integrating possibilities into a likely overall "unknown but probable" picture, whereas a computer has to enumerate every possible move a newly hidden set of units could have made.

I've worked on a number of game AI's, some good, some terrible. I wouldn't say the Civ AI is terribly bad, but it could be better. It's been my experience that implementing a good game AI is an organizational problem. The key is to recognize and respect the problem, and then to staff up with people that have relevant experience. AI research silver bullets are almost always failures. A "bad" AI usually happens when a new staff doesn't lay down a solid AI architecture, and when the project management underestimates the man-hours required and/or prioritizes other aspects of the game. You can also get into trouble by trying to use too much legacy logic - Civ's hex-based wargamy-type logic is very well developed, but I don't think they went out hunting for people with prior experience in that area.

Edit:

Civ V has no excuse for poor tactical AI when tactical hex-based wargames have been proficient in them for decades. If we put the Civ V AI up against Panzer General AI, I have a feeling the Civ AI might just lose the battle.

I worked with the SSI guys when they moved to Mindscape. Do I know you? :)
 
I worked with the SSI guys when they moved to Mindscape. Do I know you? :)

Unfortunately not. I spent hours on SSI games, but that was playing them, not making them :)

I like the pacing of the game with the new patch. I'm not bored in the early eras any more - I pretty much quit SP as soon as I bought the game when it was released because I was bored to tears. The diplomatic AI could use more stable behaviour, but it's not enough to deter me from looking forward to a patched-up MP weekend with my friends. Hopefully my game will be... immune to all the MP complaints so far.
 
Are you sure about that? Programming a decent AI with a given ruleset seems already a titanic task. I'm not in the dev team, so I have no idea of what they are thinking, but getting a good AI for the core game, while coding some extreme cases, seems more important than building an AI that can answer all possible modded situations (because of the impossibility of "brute force" algorithms, and the limits of an "evaluation" algorithm).
Having spent quite some time looking at the civ4 AI code. Yes, I'm sure. In the long this is for the better. Hardcoding strategies is somewhat of a redherring anyway. The problem with hardcoding is that it leaves the AI extremely vulnerable for exploits; situations that we're not properly accounted for in the hardcoding. A good example of this is the original starcraft AI, which could be beat simply by distracting it with one of your first workers.

In the case of civ5 hardcoding of the AI would have meant that the AI would have needed to be completely revised for each patch considering the rather big changes these have introduced in the XML.

In the long run, an AI that evaluates the game situation based on the actual game rules is much more flexible. It will however take time to fine tune the algorithms that evaluate the game positions.

edit:
The civ5 AI may actually contain some hardcoding on the grand strategy level. The level of the AI that determines what it needs to achieve its goals.
 
Trias, while I am not familiar with all the gaming AIs I am willing to bet all of them are hardcoded simply because implementing a learning algorithm is very complicated. And if the AI cannot learn then it can only do what it was tough to, which is what hardcoding means in this case.

As for the Civ5 AI, yes it's poor. It was expected it would be poor in terms of tactical combat choices since there's so much work involved into simulating the choices. You need graphs for movement, to compute movement possibilities, terrain weighting, enemy set up and placement and mix all this with your current troops set up and positioning. And then do all this 3 turns ahead. And then add in unknown factors' management such as what might be behind the fog, does he have a bomber in range, will his units level-up and much more.

Bottom line is we, the players, make tactical decisions based on a huge number of variables which are not easy to reflect into source code, not without a huge effort. This is the first iteration of the 1UPT combat AI though, so future games will have something to develop on top of.
(this is not to excuse the AI using ranged units as shields)


Now, where the AI is unexpectedly poor in Civ5 is the grand strategy and diplomacy. These are much easier to implement and could be built from the previous titles.
 
Like you said, you are a noob at the game making you completely unqualified to rate the level of the SC2 AI. The higher level AIs do a lot more than just beat you with high APM. They will rush, they will harass, they will do drops, etc. They might not used some of the more advanced techniques that you see in tournaments, but the AI is quite good.

I do agree that the Civ AI is much more complex for a number of reasons. The most obvious is that there are more than just 2 players, a lot more "structures" and "units" that can be built, a lot more dynamic interaction between the players AIs and City-States, etc.

Writing a good Civ AI is extremely complex, but I do agree that the AI could use a number of improvements.

The SC2 AI is atrocious. I'm a diamond level player which may or may not effect how I view the AI. That being said, the AI is completly terrible in responding to 'cheap' tactics. IE: you can win with canon, reaper, spine crawler, and a bunch of other 'cheeses' without any form of competition. You can even do so against 3 brutal AI on some maps...lol
 
...In the case of civ5 hardcoding of the AI would have meant that the AI would have needed to be completely revised for each patch considering the rather big changes these have introduced in the XML.

In the long run, an AI that evaluates the game situation based on the actual game rules is much more flexible. It will however take time to fine tune the algorithms that evaluate the game positions. ...

Trias, while I am not familiar with all the gaming AIs I am willing to bet all of them are hardcoded simply because implementing a learning algorithm is very complicated. And if the AI cannot learn then it can only do what it was tough to, which is what hardcoding means in this case. ... Now, where the AI is unexpectedly poor in Civ5 is the grand strategy and diplomacy. These are much easier to implement and could be built from the previous titles.

I also have a lot of coding experience, but never with "Artificial Intelligence." Therefore, I hope my question doesn't make everyone question my intelligence or education. So, OK: Does the AI "learn & remember" everything again & again for every new game you start? Or does the AI "learn & remember" across hundreds of games?
 
Trias, while I am not familiar with all the gaming AIs I am willing to bet all of them are hardcoded simply because implementing a learning algorithm is very complicated. And if the AI cannot learn then it can only do what it was tough taught to, which is what hardcoding means in this case.
No, what hardcoding in this case means is telling the AI to always do A, B and C, if D, E, and F. For example, hardcoding the opening 10 turns or so.

Of course the AI, does nothing more than it was coded to do. But what it was coded to do is: Given game situation A find the most optimal move, according to criteria B.

As for the Civ5 AI, yes it's poor. It was expected it would be poor in terms of tactical combat choices since there's so much work involved into simulating the choices. You need graphs for movement, to compute movement possibilities, terrain weighting, enemy set up and placement and mix all this with your current troops set up and positioning. And then do all this 3 turns ahead. And then add in unknown factors' management such as what might be behind the fog, does he have a bomber in range, will his units level-up and much more.
3 turns ahead? Hardly. The AI doesn't even look 3 moves ahead. Unit moves are basically resolved on a 1-by-1 basis.

Now, where the AI is unexpectedly poor in Civ5 is the grand strategy and diplomacy. These are much easier to implement and could be built from the previous titles.
That would be quite hard since the civ4 AI basically had no Grand strategy, and its diplomacy consisted of marionette behavior.
 
The SC2 AI is atrocious. I'm a diamond level player which may or may not effect how I view the AI. That being said, the AI is completly terrible in responding to 'cheap' tactics. IE: you can win with canon, reaper, spine crawler, and a bunch of other 'cheeses' without any form of competition. You can even do so against 3 brutal AI on some maps...lol
By "on some maps", you mean on the maps where you can easily cheese the AI. I've done it to, so I know it can be done, but that doesn't mean that the AI is terrible. It just means that there are a few very abusive strategies that you can use to win with a very early "all in". You are basically exploiting LoS issues and the fact that the AI doesn't scout well very early in the game (a mistake few top level players make).

FYI, pro games are sometimes won with some "cheese" strategies (there have been some 6-pool and Cannon rush wins in the GSL). And these cheese strats are also common in Platinum and early Diamond to some extent.

But the bottom line is that you are still using gimmicks to exploit a few early game weaknesses in the AI. There's really nothing comparable in Civ5.
 
That would be quite hard since the civ4 AI basically had no Grand strategy, and its diplomacy consisted of marionette behavior.

Yeah, people complain about CivV AI but don't seem to have any problem with the AI of previous versions. I don't get it.
 
Yeah, people complain about CivV AI but don't seem to have any problem with the AI of previous versions. I don't get it.

People actually complained about the Civ IV AI a lot. However, a bad AI in Civ IV wasn't as big of a problem because it didn't lead to me winning wars against them without loosing a single unit when I was vastly outnumbered.
 
No, what hardcoding in this case means is telling the AI to always do A, B and C, if D, E, and F. For example, hardcoding the opening 10 turns or so.
You're looking at it the wrong way. AI is developed from the input level, based on sensors or rather criteria here. If the algorithm inputs are pre-defined and static, that means hardcoding. You don't have to tell him the exact starting 10 turns but if he's criteria will always be the same he will always make the same choices within the same context, never learning and adapting the code. Which is to say that his variables will always have the same values for any number of cases as they are being pulled taking into account weights and priority tables.

Giving him 1000 possibilities instead of 1 and making him choose is still hardcoding the decision making process.
3 turns ahead? Hardly. The AI doesn't even look 3 moves ahead. Unit moves are basically resolved on a 1-by-1 basis.
I wasn't talking about what it is doing but what it should be.
I also have a lot of coding experience, but never with "Artificial Intelligence." Therefore, I hope my question doesn't make everyone question my intelligence or education. So, OK: Does the AI "learn & remember" everything again & again for every new game you start? Or does the AI "learn & remember" across hundreds of games?
Gaming AIs never learn anything. They are hardcoded to make educated decisions based on pre-defined algorithms and criteria. For it to actually learn, it would have to self-generate source code or self-modify it based on the learning process. This is to say that after you'd kick his ass a few times with a LS rush, he'd learn your trick and try to counter it.

Gaming developers are a long way from doing something like this. Especially since you'd have to work in a high-level programming language like LISP.
 
You're looking at it the wrong way. AI is developed from the input level, based on sensors or rather criteria here. If the algorithm inputs are pre-defined and static, that means hardcoding. You don't have to tell him the exact starting 10 turns but if he's criteria will always be the same he will always make the same choices within the same context, never learning and adapting the code. Which is to say that his variables will always have the same values for any number of cases as they are being pulled taking into account weights and priority tables.

Giving him 1000 possibilities instead of 1 and making him choose is still hardcoding the decision making process.
It is great that you are telling me that I'm looking at it the wrong way. But all your telling me is that I'm wrong because you are defining the term I choose to use differently. That is a silly argument in any discussion.

(BTW, by your definition of hardcoding the AI that brute forces playing Go on a 5x5 board is also hardcoded, which is a silly way to defining hard coding in this context.)

I wasn't talking about what it is doing but what it should be.
No, it should not be doing that all, because it is a stupid waste of computing resources. (You might want to try doing the math on actually calculating 3 turns ahead in civ.)

Gaming AIs never learn anything. They are hardcoded to make educated decisions based on pre-defined algorithms and criteria. For it to actually learn, it would have to self-generate source code or self-modify it based on the learning process. This is to say that after you'd kick his ass a few times with a LS rush, he'd learn your trick and try to counter it.

Gaming developers are a long way from doing something like this. Especially since you'd have to work in a high-level programming language like LISP.
There actually are computer game AIs that are in some sense self learning. In most cases this means randomly adjusting it weighing parameters and keeping the values that work best. (The overmind AI for starcraft broodwar does this for example.)
 
Good afternoon Civ Fanatics! I am very happy to bring our latest and greatest patch notes for the upcoming patch. This is the patch that adds the much-requested hotseat and tons of other things.

Okay, well, I'm very pleased that the threatened over-nerf of happiness buildings didn't happen. I think I'm dropping down to King for difficulty when this patch makes its way to the Mac just the same.

As a builder and wonder-whore, I have some thoughts: They've really modified the culture-victory's wonder list. Hagia Sophia's always been on my "if I have a city with production free" list. It was nice to have, but not that crucial. Now, though?!? A free Engineer all but guarantees you another one so it's like a buy oen get one free. Chichen Itza, already one of the best wonders in the game, is now a must have. Cristo Redentor is no longer the make-or-break wonder for the cultural victory, but the Eiffel Tower is worth racing to. As a late game wonder, I generally have at least 15 policies by that point in the game. That makes it a +11 happiness wonder.

Interesting, but of course, I won't get to play with it for a couple weeks after Aspyr has time to port it to us Mac users.
 
Back
Top Bottom