Civ AI sucks

This thread gave me the idea for a little thought experiment...

Imagine posting a fully comprehensive list of actions that should be undertaken from the start of the game, which would then be followed by a human player with no variation from the commands, regardless of the circumstances.

For example, the first turn could be:
Move warrior/scout in the direction which will reveal the largest # of tiles

Settle city

Begin building Worker

Work tile with the highest food/hammer output

Begin researching Agriculture

End turn
This, then, mimics the most basic kind of script for a computer-controlled civ.

But how well will it work? In some cases it would be a fairly good starting script, but in others it would be either weak (eg. loads of seafood/no farmable tiles) or impossible (if the civ starts with Agriculture).

So, you'd have to make the command list more complex, and include a lot of "if x, then y" commands:
Move warrior/scout in direction which will reveal the largest # of non-water/tundra/ice tiles

Settle city

If no seafood is present, begin building Worker

If seafood is present, but Fishing is not yet researched, begin building Worker

If seafood is present, and Fishing is researched, begin building Workboat

If building Worker, work tile with the highest food/hammer output

If building Workboat, work tile with the highest hammer output

If seafood is present, but Fishing is not yet researched, begin researching Fishing

If seafood is not present, farmable land is present, and Agriculture is not yet researched, begin researching Agriculture

If seafood is not present, farmable land is not present, and Mining is not yet researched, begin researching Mining

If seafood is not present, farmable land is not present, and Mining is researched, begin researching Bronze Working

End Turn

Now this is better, but it's still far from being as sophisticated as the kinds of judgements a half-decent civ player will make in the first few seconds of a game. Notably, it doesn't take into account religion, UBs/UUs, traits, other resources and terrain, etc, etc.

To deal with all the possibilities, you'd have to increase the list dramatically, and yet you'd still only have the first turn covered. And when you look a mere 20-30 turns down the line, when other civs have been discovered (or not), things have got incredibly complicated, requiring a command list spanning many, many pages. But it would still make for a very weak game when compared to the player using his/her own judgement, taking into account the synergy between different game elements, planning ahead, and leveraging the advantages he/she receives.

So, if you want to make the comparison with Chess, what would the first turn command list look like there?

Move piece x to square y

End turn

And nothing more. Assuming no foreknowledge of the psychology or playing style of the opponent, there are no other commands that can be given at this point. Even as you get further into the game, the range of possible moves remains very limited in comparison, and the range of commands will never be more than a tiny fraction of that in the civ model.

(Comparing civ and chess is probably pointless anyway. It's like comparing, say, motor racing and boxing - one is first past the post, the other is last man standing).

Overall, not only does this thought experiment hint at just how complex cIV is for human and AI players alike, but it also demonstrates why players who come here asking for hard-and-fast rules as to how to win at civ are looking at things the wrong way - it's not necessarily the case that there's no right answer, it's just that the right answer would be so mind-bogglingly lengthy as to be utterly useless.
 
I'm not saying making a Civ AI is easier then making a chess computer.

I'm just saying that the game itself is more complex.

To get things straight, what I mean is:

Chess > Civ4 (harder then)
Civ AI > Chess computer (harder then)
 
I do not agree with
Chess > Civ4 (harder then)
besides chess being more abstract ( hence more dificult for ppl that have more need for visualization ). The simple fact that you have more players on board makes it harder. But De gustibus....
 
Coding a Civ AI is a lot less like coding a chess AI than it is like coding a Go AI.

Brute force works fine in chess.

Go and Civ are both too complex to allow brute force analysis. You must choose different strategies. It's one of the reasons AIs can beat even the best human players in chess but even the best AIs get routinely slapped around by high-level Go players. (not even the world champion, just top-tier people)

You just can't do simple branching analysis when there are as many variables as there are in Civ and Go.

As for claiming chess is more complex than Civ, it's an interesting assertion. I'd like to see it proven rather than just begging the question by asserting it as an unproven "fact". At it's most basic level the assertion seems preposterous; less units, less board-space, less turns in a game, no tech-tree, no means of production, all these make chess seem the less complex game by far. If it's not, I'd love to have a good explanation as why it's not. But just asserting it without proof seems likely to do little other than cause people to discount your other opinions as equally ridiculous, which is not what I am guessing is the desired result of the assertion.

-abs
 
I know there's more to Civ then just that.
But if you think that chess ain't complicated, then you're basically an idiot.

I'm not saying chess isn't complicated. But programming-wise, Civ is more complicated. I fail to see how you can disagree after it's been clearly pointed out by people who know better than you except that you just want to troll.

But, interestingly enough, so if I do incorrectly think that chess is simple, then I'm an idiot? Doesn't seem to be a logical argument.
 
Go is a good example ..... it is a quite complex game ( it doesn't look that until you get your first beating :lol: ( like in Civ IV , I must add ) ) with high branching of the decision tree.
 
I'm not saying chess isn't complicated. But programming-wise, Civ is more complicated. I fail to see how you can disagree after it's been clearly pointed out by people who know better than you except that you just want to troll.

I'm getting mad now....:mad: :mad: :mad:

How hard is it to read my posts

Should i record what i'm going to say

I've said THOUSANDS OF TIMES

THAT I AGREE, making a Civ AI is harder then making a chess computer.

Jezus,, what part of that is unclear to you and the other people in this topic that made a responce without reading my post?


@absimiliard
I can see, based on the statement: "Brute force works fine in chess", that you aren't an experienced chess player.
I find it hard to explain why chess is so complex. How can I prove this? I mean the game has been around for centuries
and still nobody has found out how to win a game 100% of the time unlike a simple game of tic-tac-too.
 
Calm yourself.

I think the thing that's causing confusion/irritation is that you persist in hammering home the point that chess is more complex than civ, in a thread which you created to moan about the poor quality of civ's AI.

If the complexity of a game is not the issue when it comes to programming a competitive AI, then why bother mentioning chess at all?

If your point was that chess is more complex, and so requires a more sophisticated AI, and yet there are human-beating chess AIs, so civ's AI should be able to beat humans without bonuses, then you'd at least have an argument (albeit a flawed one).

But, in light of your comments that it is, in fact, harder to build an effective AI for civ, I struggle to see what your point is. :confused:
 
hiddie said:
I can see, based on the statement: "Brute force works fine in chess", that you aren't an experienced chess player.

I very much doubt that he is suggesting a human player would work by brute force. I also very much doubt you could beat a chess computer operating on pure brute force - there's some element of pruning in modern chess programs, but I think they'd be able to beat most people without it.

I find it hard to explain why chess is so complex. How can I prove this?

"Complex" really is the wrong word. That refers more to the actual rules and mechanics that make up the game, and in that respect chess is very simple. Your line of argument that "chess is hard" has virtually nothing to do with complexity, but on the relative abilities of you and other players (human or computer) to make use of the rules, complex or otherwise.

I mean the game has been around for centuries
and still nobody has found out how to win a game 100% of the time unlike a simple game of tic-tac-too.

This process is known as "solving" a game, and is incredibly hard to do - essentially you have to evaluate every possible variation. Tic-tac-toe has a tiny board and a very low number of moves - a human could solve it on paper without too much trouble. Recently Checkers was solved, which took an awful lot of computing power, and is still a very simple game. Chess is another step up from checkers in complexitiy, and so far is a long way from being solved. A sizeable chunk of the endgame has been solved (any endgame with 7 pieces or fewer a computer can play perfectly), but there's a very long way to go. I wouldn't place any bets that it won't be done in my lifetime though.

As for solving Civ, given the huge number of additional systems and variations relative to chess, you'd need many orders of magnitude more time to solve it.
 
Calm yourself.

I think the thing that's causing confusion/irritation is that you persist in hammering home the point that chess is more complex than civ, in a thread which you created to moan about the poor quality of civ's AI.

If the complexity of a game is not the issue when it comes to programming a competitive AI, then why bother mentioning chess at all?

If your point was that chess is more complex, and so requires a more sophisticated AI, and yet there are human-beating chess AIs, so civ's AI should be able to beat humans without bonuses, then you'd at least have an argument (albeit a flawed one).

But, in light of your comments that it is, in fact, harder to build an effective AI for civ, I struggle to see what your point is. :confused:

It was someone else who mentioned chess, not me.
The thing that was irritating me was that people we're telling me that a civ AI is harder to make than a chess AI, as if I didn't agree with them. If you read my posts is obvious that I did agree with that.
 
It was someone else who mentioned chess, not me.
The thing that was irritating me was that people we're telling me that a civ AI is harder to make than a chess AI, as if I didn't agree with them. If you read my posts is obvious that I did agree with that.

I know someone else brought it up. I was referring to your comment that chess is more complex than civ

Troy's comments, whether or not they were a good argument, were actually relevant to the discussion of civ's AI.

What does your assertion that chess is more complex, but that civ's AI is harder to program, actually amount to in the topic at hand?

If the complexity of a game isn't the thing which makes AI hard to programme, then what is?

I assume you must have some answer to these questions.

Explaining that would be much more constructive than making comments about how other posters don't understand chess as well as you do.
 
@absimiliard
I can see, based on the statement: "Brute force works fine in chess", that you aren't an experienced chess player.
I find it hard to explain why chess is so complex. How can I prove this? I mean the game has been around for centuries
and still nobody has found out how to win a game 100% of the time unlike a simple game of tic-tac-too.


I'm actually a mediocre chess-player, much as I'm a mediocre go player. However, my skill is irrelevant to the statement I made.

The programming techniques applied by the team that made Deep Blue was well known to be a algorithm that employed deep branching and evaluation of the results for tactical superiority. The depth to which the computer explores a position is directly related to a host of things, technological advancement being the one that meant it took years of effort before we could make a computer that would beat the greatest human minds in chess.

Complexity of game is another factor. Go programs employ different algorithms than branching because the branching happens so much faster that you cannot look "deep enough" into the future game positions. Go is a more complex game. That's why it's harder to code for, you can't use established techniques.

You're right that the AI for Civ is harder to make work well than it is for chess, or go as well.

I merely assert that perhaps the reason is that chess is a less complex game, and that this explains why it's harder to make a good Civ, or go, AI than it is to make a good chess program.

This is why I am sceptical of the un-proven assertion that chess is more complex than Civ. I feel that the evidence so far seems to support the opposite position, that chess is the less complex game.

So, I'm curious, Why you think chess is more complex? What supports your position?

-abs

P. S. "My personal skill level at chess really is utterly irrelevant to the quality of my argument. There's no need to get hot under the collar with me, please. I do not need to be good at chess to know how people make prize-winning chess programs."
 
I know someone else brought it up. I was referring to your comment that chess is more complex than civ

Troy's comments, whether or not they were a good argument, were actually relevant to the discussion of civ's AI.

What does your assertion that chess is more complex, but that civ's AI is harder to program, actually amount to in the topic at hand?

If the complexity of a game isn't the thing which makes AI hard to programme, then what is?

I assume you must have some answer to these questions.

Explaining that would be much more constructive than making comments about how other posters don't understand chess as well as you do.

A thing that's hard for a computer can be easy for a human and vice versa.
For example: A human would be much better in marketing and/or creating an MP3 player than a computer would be, true or false? It depends on your perception of the definition of the word complex whether it's easy or hard to program a game winning computer.
 
Let me try to bring myself, and the thread back on topic then. And allow me to apologize for focusing on chess so much.

Maybe the problem in programming the Civ, and one reason it's so bad, is that the complexity of Civ precludes brute forcing a turn by turn solution for each AI. It requires a more situationally aware AI. Something that thinks more like a human and ignores the complexity for a broader view that uses goals and pattern recognition.

These areas, where we try to get the computer to think like a person, have been stubbornly difficult areas for researchers in artificial intelligence. People and computers just don't "think" alike.

So perhaps we are asking both a very difficult request, "Make us a good AI for Civ", and asking it of a much smaller programming base than the folks who make Chess programs.

Maybe that's why the Civ AI is bad where it's bad, because the complexity of Civ is more responsive to a human style of thought than to the normal style of computer "thought".

In which case we should probably all offer thanks to the programming team for making us as good an AI as it is.

I know I wouldn't want to write that code.

-abs
 
Let me try to bring myself, and the thread back on topic then. And allow me to apologize for focusing on chess so much.

Maybe the problem in programming the Civ, and one reason it's so bad, is that the complexity of Civ precludes brute forcing a turn by turn solution for each AI. It requires a more situationally aware AI. Something that thinks more like a human and ignores the complexity for a broader view that uses goals and pattern recognition.

These areas, where we try to get the computer to think like a person, have been stubbornly difficult areas for researchers in artificial intelligence. People and computers just don't "think" alike.

So perhaps we are asking both a very difficult request, "Make us a good AI for Civ", and asking it of a much smaller programming base than the folks who make Chess programs.

Maybe that's why the Civ AI is bad where it's bad, because the complexity of Civ is more responsive to a human style of thought than to the normal style of computer "thought".

In which case we should probably all offer thanks to the programming team for making us as good an AI as it is.

I know I wouldn't want to write that code.

-abs

I agree with you on that.

Maybe "suck" was a very big word to use.

But there are some stuff that could have been added to the AI.

-Building cities up. I know this is difficult but not impossible. Knowing where to place a city, knowing what to build in a city can be improved.

-Better warfare and diplo strategies. This is ofcourse very hard to pull off. I'd be suprised if it would be realy good.

Just some general stuff, where I always ask myself "why"?

Forest chopping, use of civics etc.

Back to my original question: Is there a mod or something with an improved AI (other than the improvements made in BTS)

BTW: srry for my English, I know it's unreadable..
 
I think Blake has continued beyond the modifications they added in BTS.

Try searching for Blake's better AI. I think there's a "mods" forum, it's probably in there.

I hear he's improved AI city-placement substantially, and AI behavior in other ways. Supposedly adds a difficulty level or two to what you're playing.

-abs
 
I've been thinking a lot about what a good AI would have to look like. I think it would be hierarchical, modular, heuristic, and able to learn from experience.

Hierarchical and modular: Civ works on different levels, and the AI would have to as well. The top level would choose an overall direction, such as:
Expand horizontally, building settlers to claim more open city spots.
Grow vertically, investing in the infrastructure/civics to allow existing cities to grow larger.
Expand via warfare.
Racing (for a Wonder or key tech).
Pursue spaceship victory.
Pursue cultural victory, etc.

Then for each of those, you would have a module of code that would come up with an estimate of what the costs and benefits of pursuing that course would be. Think of these modules like federal agencies each putting together a report and budget request, and submitting them to Congress. "If you give us X dollars, we will use it to build Y miles of highways over the next Z years." Likewise, the "expand horizontally" module would come up with a report that says "If you allocate the hammers to build 3 settlers, 3 workers, and 6 anti-barb units, we believe we can establish cities in these 3 locations." The top-level module would then weigh the reports against each other ("expand via war" would be requesting hammers to build axemen and an estimate on the returns of that investment) and choose between them. You would also want to be able to recognize overlap. Expanding horizontally requires some military as anti-barbs, and expanding via warfare requires military units, so you could start by allocating hammers to military while keeping both options open.

Likewise you want the ability to split your resource allocations. It often makes sense to keep hammer-poor commerce cities chugging away at a piece of infrastructure even while you're preparing for war. Probably the way to handle this is with an iterative process, where the higher-level module proposes an allocation of resources and goals, and each of the lower-level modules then reasses what it can do with that allocation. After a couple of iterations, you'd converge on a plan that was at least locally optimal (there are likely to be many local maxima -- repeating the search from several different start points in your variable space would give some hope of hitting a reasonably good one).

Hierarchical: How does the "expand via war" module figure out how many axemen it can produce? It now acts as an upper-level module and queries lower-level modules, in this case city governors. Each city governor in turn will produce an estimate of requirements (tiles that might be shared between cities, worker-turns to improve tiles, etc) and an estimate of output. The "expand via war" module then compiles these city-level reports into the more condensed report that it passes upwards to the top-level module. And in the case of a partial allocation, the "expand via war" module would be in charge of identifying the cities where the unit-building return is greatest e.g. high production cities that already have a barracks.

Now the key to doing any sort of gradient descent is that you need a good algorithm for evaluating the goodness of a position, and that's not going to be straightforward. This is where heuristics and learning from experience have to come in. Sometimes it's easy -- more axemen are better than fewer axemen, all else being equal -- but sometimes you're comparing apples to oranges -- is it better to grow cottages or to generate a GS by running specialists? There will be all sorts of weighting parameters that determine how a given situation is evaluated, and these will have to be learned from experience. Much neural network theory required, no doubt.

First, mod the game so that existing AI's can play against each other without slowing down for graphics, etc. Then, create a bunch of observer AI's that will run in parallel trying to predict what the current AI's will do, and updating their internal parameters to improve those predictions. Eventually, you'll hopefully end up with new AI's that mimic the behavior of the existing AI's, but running off the new architecture and capable of further learning. Now you let them battle it out many times, slightly varying the parameters each time (or even the network structure that calls on those parameters), evolving towards the winners. (There's a risk here that you would lose the "personalities" of different AI's, as they would converge on a single "best" strategy. But you might be able to get them to converge to different local minima, or apply a nearest-neighbor penalty to force them to stay distinct, or some such). Alternatively, if you could make the internal state sufficiently readable, you could have the AI shadow a good human player who would "correct" it as needed -- if the human decides that an axe-rush will be more profitable, but the AI has decided on "expand vertically", then he could force it into "expand via war" and it would adjust parameters such that in future it's more likely to arrive at that conclusion under similar circumstances.

Anyway, it would be fun to work on an AI structured along these lines, if I needed another Ph.D. thesis and someone was willing to pay me a decent salary....

peace,
lilnev
 
I hear he's improved AI city-placement substantially, and AI behavior in other ways. Supposedly adds a difficulty level or two to what you're playing.

What makes you say this? There's only been one post in the BetterAI forum since Oct 3 of last year. I haven't seen any other indications of activity for BetterAI either.

Bh
 
I searched the better AI mod. But it seems that it was added in BTS and since then there hasn't been any update for BTS.
 
I have some sympathy with the original poster, although I think the AI is quite good already and civ4 is extremely complex.

Compare Shaka vs. the other aggressors in this game. Shaka has an outright chance, especially on the higher levels, to win by domination. The AI for him is very good. He strikes from the get-go and uses his extra production to continue the assault. The other aggressor AIs generally have no chance to win the game because they don't tech well enough so they fall tech-backwards and they aren't aggressive enough early on, expanding their empire.

Compare Mansa vs. some of the other tech-fiends. The situation here is not as drastic because there are more tech-fiends that can present a chance of winning, especially at the higher levels. However, can anyone dispute that Mansa represents the biggest threat in most games?

There are some AIs that play to their strengths and they are the ones who are fun to play against. There are others that do basically...nothing. Oh, sure, you might sweat seeing Ragnar nearby early in the game, but not nearly as much if you see Shaka imho.

I would like to see more aggressors think like this early on: 1) Where is my closest military resource; 2) Where is my closest opponent. Does 1 and 2 compute for me to launch an attack asap? If yes, attack asap. If no, expand normally until the situation is such that an attack can be launched then attack asap. By asap I mean 1) check power graph. If stronger attack, if not, build up strength then attack.

That should be the BASE of every aggressive civ imho. Then you can flavour them up a bit based on traits/uu/ub/personality.

Imo that would add more challenge to the base game.
 
Back
Top Bottom