1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

No excuse for poor ai/ai tech article

Discussion in 'Civ5 - General Discussions' started by Disgustipated, Oct 11, 2010.

  1. Disgustipated

    Disgustipated Deity

    Joined:
    Nov 14, 2006
    Messages:
    11,429
    Location:
    Las Vegas
    For many years I have accepted the excuse that a proper AI cannot be made for a game as complex as Civ. It has thousands of squares (now hexes) not just a couple dozen of a chess board people say. And then I see this article.

    http://www.cnbc.com/id/39594637

    If google can make a car that can drive in traffic by itself (just think how many different things it has to react to), how can we not get a decent ai? I'm just not buying the excuses for poor AI anymore. To me, this car looks amazing. It has more than just a few thousand hexes to contend with. It has many square miles to contend with (although arguably it only has to deal with small numbers of square miles at a time equal to appox. the stopping distance of the car).

    So what are your thoughts. Can a decent AI be made for this game? I'm not asking for something like chess that can think 100 turns ahead. But it would be nice is the AI could at least think 5 turns ahead in a war, with generalized long term goals for peace and objectives for war.

     
  2. Jediron

    Jediron Prince

    Joined:
    Jan 8, 2006
    Messages:
    396
    Funy as it seems, but there are less parameter involved by driving a car . For example: all other different things you speak of, you can group toghether under one argumeny: objects. Most of the time the goal is not to hit them or keep a distance to it.

    And don't forget that the cars "ai software" gets input from electronical devices; such as detectors. In a game ALL have to be coded, there is NOT a single electronic device that can help gathering info.

    Now we take a game Civ 5; it's like chess (or worse). The more units on the map, the harder it gets, then you have the number of other CIVs, your of their standings towards each other. Number of cities and city placement, borders, where to defend which hex to go, etc.etc.etc.

    Now while i think the AI can be better then it is now; the AI seems just as bad as with CIV1, it will take a long time it comes close to human mind. In any case, with this type op gaming.

    I think alot has to do with the time and effort needed to make a more or less good AI, is too costly for the game-developers. Maybe they start of with good intentions, but as time goes by, realise (or told) it can't be done , due to a number of reasons; most of the time though: time and cash.
     
  3. dannythefool

    dannythefool King

    Joined:
    Jul 15, 2009
    Messages:
    657
    This is a non-issue, the game doesn't need sensors because it already knows everything about the world.

    Apart from that, I agree. A previous employer of mine actually had a car that was half automated. Avoiding crashing into the scenery is easier than you'd think, and beyond that, an automated car doesn't need to do much more than a non-automated one with a GPS device and maybe some proximity sensors. And what it does is all very short term decision making, no strategies that have to be viable for hundreds of turns. (This was almost ten years ago though so this specific experimental car was constrained by other limitations, like the battery only providing the four PCs in the back with power for about 20 minutes...)
     
  4. Jediron

    Jediron Prince

    Joined:
    Jan 8, 2006
    Messages:
    396
    Ow, yes. Bad example :lol:

    Anyway, about computer AI. See how many games (if not all) have problems which something simple (to us) as path-finding. It's somewhat better these days, but once and a while you bump into it again. From time to time. You can even notice it in CIV ;-)
     
  5. gunter

    gunter King

    Joined:
    Oct 16, 2002
    Messages:
    790
    Wanna know what ruined the development of the AI during last years ?

    Kiddish Consoles
     
  6. Jediron

    Jediron Prince

    Joined:
    Jan 8, 2006
    Messages:
    396
    i blame 1 Unit per tile. Because there is NO development...lol
     
  7. mamuz

    mamuz Chieftain

    Joined:
    Sep 21, 2010
    Messages:
    44
    Managing a Chess board is complexer than Civ for a computer. But, the fact is AI algorithm to play chess exists for long time. A lot of research & development is already made. It simplifies things.

    For Civilization, Civ V is really harder for a computer than Civ IV. Civ IV was simple : your have a trait, and one predefined way for victory, the only things to do was :
    - research tech useful for ressources around you city, improve the tiles.
    - built all buildings as you can starting with the ones accordingly to your predefined victory
    - maintain a correct number of units
    - create stacks of doom for war
    Note that even if it's simple, Civ IV's AI was dumb.

    In Civ V, i guess AI change the way to win (i think it's too complicated to a computer to be efficient by making that), he needs to choose which buildings in which town (it's really harder that buit all as you can) and he needs to use tactics for combat (it's harder than in Civ IV, but i agree with you here, this kind of AI engine already exist, and works nice in other game).

    I think Firaxis has made a bad job for tactical AI (= Combats), but for the other things, i can understand the challenge it is. I think the best way to correct AI is to fix for each leader a predefined way for victory, and for each predefined way, help the AI with predefined humans ways of playing. Because, in general, AI can't act (only humans can). AI can only react to something. And i imagine Civ V's AI tries to act. Without a memory (which can answer to this question : "why i've chosen to not develop paladin 20 turns ago ?"), and complex algorithm, i guess it's impossible.
     
  8. ohioastronomy

    ohioastronomy King

    Joined:
    Dec 14, 2005
    Messages:
    714
    There are too many variables in gaming, believe it or not. That's sort of like asking why you can't program a robot to do improvisational jazz.

    Civ V AI is worse than Civ 4 because one unit per hex doesn't work at the scale of civilization, and there are serious problems with even the logistics of movement. There is a good discussion about that here.
     
  9. Jediron

    Jediron Prince

    Joined:
    Jan 8, 2006
    Messages:
    396
    Wow. What a statement. Can you enlight me a little, cause i can't see why that should be the case.

    CIV5:
    -many more hexes
    -many more units, cities, mountains, water to take into the calculation
    -many more different types of units
    -more unit are come into place, by building/buying them
    -Air, land and Sea units
    -last but not least; more players involved

    vs Chess:
    - 32 units total (16 vs 16)
    - 6 types of units
    - 64 tile playfield, static

    And yes, a good CIV -AI also needs to calculate alot AHEAD, for a good strategy. Just like chess-players think 6,7,8 or more turns AHEAD.



    Really, your assumption puzzles me :confused:
     
  10. Vellis

    Vellis Chieftain

    Joined:
    Oct 11, 2010
    Messages:
    60
    Believe it or not, the AI for playing Civ V is actually more complex than the AI for driving a car, albeit in a different way. My last job was actually with a company who works on autonomous vehicles. Driving a car is as much a matter of processing as decision making. It's a matter of quickly locating the objects around you (the vehicles around you, the lines marking lanes and the edge of the road, relevant street signs etc.) and then establishing rules to abide by. Keeping a certain distance from the car in front of you, slowing down/accelerating at the right time, etc. I am curious how/if they handle street signs, as that is a problem of pattern recognition.

    Civ V is also a problem of pattern recognition. This is something the human brain excels at, but computers struggle with. You can look at a given map in Civ V, look at what units you have available, what units you're fighting, and instantly formulate a sound strategic plan. A computer can't mathematically calculate that. In Civ IV combat was a math problem to be solved, maximize production and make a big stack of mixed units. Civ V's AI unfortunately doesn't have that luxury =p

    As for the question in the OP of "Can a decent AI be made for this game?" The answer is absolutely. It just can't really be compared to driving a car. Establishing a couple simple rules like don't march one unit at a time into the grinder, attack a unit/city if you can, and don't walk back and forth two tiles away from a city would do wonders for the combat AI =p
     
  11. dannythefool

    dannythefool King

    Joined:
    Jul 15, 2009
    Messages:
    657
    It's a completely different type of pattern recognition. There are some patterns that are quite easy to find in a picture, like straight lines or circles. Identifying an unobstructed street sign is not that hard since they are standardized at least on the country level. There is a generic approach that you can follow, basically you make a probability function that determines the probability for a specific sign being present in the image based on what features and relations can be detected. At no point do you have to consider multiple possible meanings. All you have to do is identify a sign that always looks the same. (As a side note, it's more realistic that autonomous cars won't use video cameras to interpret road signs, instead they will use a combination of a database like many GPS navigation systems already know the maximum allowed speed on any given road, and electronic signalling as used by high speed trains that are de facto autonomous, because no human can react fast enough to drive anything at 400 km/h.)

    If you look at humans playing a strategy game on the other hand, you don't have a standardized pattern you can identify. Every situation is always ambiguous. Simple example: If I move my entire army right next to my neighbour's border, that doesn't mean one specific thing. The AI is written so that it views this as a threat, with all the military close to its border, but that's just an educated guess based on what counter strategy is the most viable one. It views it as a threat because it can - and has to - defend against the hypothetical threat while it can do nothing - and neither needs to do anything - about the other possibilities like maybe I'm just neatly organizing them on my screen so I can take a screenshot of my military might ;-) There are no simple cues like "limit speed to 50 km/h".
     
  12. JP1

    JP1 Warlord

    Joined:
    Nov 11, 2009
    Messages:
    185
    Location:
    Atlanta, GA
    Driving is not an adversarial search activity. The other cars are not out to get you, adapting their strategies and methods as needed on the fly to continually make your life as hard as possible. And as much as the AI in that car is lauded in the article, I remain skeptical that they've developed an AI system which can handle even a majority of driving situations. (70-MPH highway driving, stop-and-go traffic negotiating an accident situation and moving out of the way for an ambulance, badly marked backroads with faded speed limit signs....)

    And as a brief aside, I don't think fully autonomous cars will ever get off the ground. Because after they do, someone will get into an accident while on auto-pilot and win a ridiculous lawsuit for hundreds of millions of dollars in emotional damage, and the people developing this stuff will go back to research.
     
  13. Sydrian

    Sydrian Chieftain

    Joined:
    Feb 15, 2010
    Messages:
    3
    One thing to understand with chess is the complexity, for computers, is in learning how to evaluate a position. The only real numbers in chess are material. CiV gives the computer TONS of metrics to measure decisions by. It's difficult for the computer in chess to know if it is winning or loosing in a given position. Sure, its easy for the computer to know it is up two pawns, but how do you tell the computer that the positional advantage it gave to the opponent is much stronger than those two pawns? Sure the game of a game like CiV may be more complex, but most of the problems in the game can be broken down into questions that are simpler for the computer to answer.

    On another note, it actually shocks me that the AI is so atrocious at short term combat. A simple +/- decision on if the computer can win a given battle is very easy for a computer. What's difficult for a computer is deciding if attacking a given point is a good decision. For instance, give the computer a choice between two cities, one is slightly more valuable because, of say a happiness resource while the other is in a location that holds some sort of strategic importance. I would expect the computer to choose the happiness city, as that is something the computer can easily evaluate, while the AI more than likely has little to no understanding of the strategic importance of the second city.
     
  14. kattana

    kattana Warlord

    Joined:
    Oct 28, 2005
    Messages:
    217
    sure they can, but you have to remember that the computer used to beat the chess champion was the size of a small warehouse that played many many games each turn to figure out the best path. here you have at best maybe a quad core processor. though i have noticed that civ v does not in any way fully utilize my 4 cores. maybe about 20%

    also you have all those whining about how long it takes now to cycle between turns, LOL, if you wanted the AI to start playing ahead turns to look into better strategies, it would take a lot longer, which is something i would actually be OK with.

    so you want better AI, then you will have to deal with much longer wait times between turns.
     
  15. DaveGold

    DaveGold Emperor

    Joined:
    Dec 1, 2009
    Messages:
    1,058
    Before we anyone else compares CIV4 AI vs CIV5 AI lets just remember that the CIV4 AI would get the very basics right. Defend a city. If moving a unit off a hill will get it killed then fix the unit on the hill instead. Put your units into a mixed stack and use the right units at the right times.

    The CIV5 AI does nothing right, near enough, and typically works by 'shoot if you can shoot, attack if you can attack, else move forward in the vague direction of an opponent'. That's all, no intelligence required. Wind the units up, point them in the right direction, and send them off.

    This was the argument put forward by Gary Kasparov for why computers would never beat a grand master at chess. The CIV5 AI doesn't need to be at grandmaster level.

    The simplest chess AI looks at possible moves and evaluates them exhaustively. It then picks the best one. You could set the numbers of turns ahead that the AI would evaluate, the more turns you could look ahead the better the simulation of intelligence became. I would argue that if the CIV5 AI looked just one turn ahead it would play better than it does now, no joke. Two turns ahead is probably all it would ever need.
     
  16. CurseUppl

    CurseUppl The bureaucracy expands.

    Joined:
    Apr 22, 2009
    Messages:
    257
    Location:
    Holy Terra
    Okay, don't quote me on this but...

    32 chess units can each use one of 64 tiles. That's 32^64 which almost gives a googol (bear in mind that is larger than there are atoms in the Universe).

    At any given time in Civ5, the AI has to deal with small area of hexes, say 5x5, with a few different units available at that time. This number is but a tiny tiny tiny fraction of the googol mentioned above.

    Any math/chess genius correct me if I'm wrong :)
     
  17. cccv

    cccv King

    Joined:
    May 6, 2010
    Messages:
    798
    Math is very much not my strongsuit, but that doesn't seem logical to me. why do you think Civ only has to deal with a 5x5 group of hexes while chess has to take into account every one of the 64 tiles on the board? In both cases there are a number of pieces/units and a limited number of of moves each can make that do not include every tile on the board. In chess it's 16 pieces and that only decreases. For Civ that number of units can be anywhere between 2 and a crap-ton. More than chess, in other words. So I'm still not getting where you're coming from there.

    As for the car, I'm not going to trust that until they can make Chrome stop crashing.
     
  18. fantsu

    fantsu Prince

    Joined:
    May 24, 2009
    Messages:
    480
    Location:
    Finland
    Chess is pretty complex alright.

    There is still no computer that can win human in it.
    And they count millions of moves in a second.
    :)
     
  19. MadRat

    MadRat Cheese Raider

    Joined:
    Sep 26, 2008
    Messages:
    598
    Location:
    Under the sink
    The problem with using that simplistic value like 32^64, is that it will never, ever occur in a chess game. It can occur through just a random piece placing and as math model. Fischer random chess gives more starting variants; but you still wont get that many different positions.

    Secondly chess playing programs don't calculate every possible position - in the opening they use chess "books" or databases and early mid game. Indeed end game theory as well has specific algorithms. The number of pieces and position sis GREATLY reduced by the time "pure" analysis occurs. Sadly this is also the point in which the AI quality takes a nosedive.

    Kasparov pointed this out a while back. he mentioned he wasn't playing a computer as much as he was playing against expert-system database. In defense of AI - most grandmaster-level players aren't any more intelligent than most average players they just have memorized and experienced a lot more games and thus they are in themselves more human databases than actual strategic geniuses.

    Civ on the other hand has much much harder time with random civs, random maps, variant sea/land ratios, different techs and many different win conditions. It would be much much harder to get an intelligent looking AI the a chess program because you have to analyze the board position every time versus just looking at a database.

    The Civ 5 AI does suck not because it is inherently bad - but because comparable games like Civ 4, Gal Civ, SoSE, had actually more variability, but better decision making than a simpler Civ 5 with stupider results.

    Rat
     
  20. dannythefool

    dannythefool King

    Joined:
    Jul 15, 2009
    Messages:
    657
    Your main fallacy is that the number of tiles is important. It's not. The number of possible moves and possible outcomes is. And chess, as far as that is concerned, is comparatively simple. You really don't have many options at any given time, many of those are zero sum games, and many books have been written describing good and bad tactics in various stages of the game that a chess AI can use for reference. For example, a pawn can do exactly one thing most of the time: Move one step forward. At most, it can do three different moves. The opponent only has a very limited number of responses. Pieces that can't reach the pawn don't count. Most of the time, no piece or very few pieces will be able to reach it. There may or may not be a future implication that would be really good to realize when moving the pawn, but the size of the board is not relevant here; the number of turns the AI can predict is, and that directly depends on the number of moves each piece can make on each predicted turn. There also is no randomness, a chess AI knows that it will defeat that pawn if it takes one more step. And five turns earlier it knows that it will defeat the pawn in five turns if it takes five more steps. These variables never change.

    The reason why computers are bad at chess is that humans have intuition and can train that intuition, while the computer always has to consider all possible moves. Even simple games that require more intuition and less hard facts, such as Sokoban, are harder for a computer to solve than chess. Running around in circles on a chess board will lose you the game, not so in Sokoban. (With that said, a chess AI would still beat 99% of its player base if as many people bought chess software without being good at chess as people who are not very good at strategy games buy strategy games.)

    The Civ AI works in a completely different way, though. It doesn't predict moves (and I don't think such an approach is viable). It seems to use a heuristics based approach to war, e.g. it has weights for various actions like "attack another unit", "damage city", "capture city" and so on, and the weights are chosen so that across a large number of similar situations, the outcome will be favourable most of the time. There are higher level goals that affect those weights. Gameplay based on heuristics always looks erratic, though, and thus makes mistakes appear even more glaring.

    Adjusting those weights can make a huge difference, and so can rules that prevent some of the more stupid things the AI does, but the game only just came out, and to implement either of these properly requires experience with how people actually play the game.
     

Share This Page