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

War AI Needs Help

Discussion in 'Civ5 - General Discussions' started by budweiser, Aug 19, 2011.

  1. dexters

    dexters Gods & Emperors Supporter

    Joined:
    Apr 23, 2003
    Messages:
    4,150
    Gender:
    Male
    Location:
    Canada

    This has been the case with AI for all Civ game, it's one sized fits all strategy, only the AI gets to play with more units the harder you go.

    On higher difficulty, the AI is much harder to attack as well, becaue they can easily have 3-4 bombard units defending and they rushbuy/build these almost every turn.

    The Civ5 AI also keep reserves. You can beat back an attack, mass your forces and move against the AI and you'll see a wall of troops rush in from behind the fog of war. It takes a while to completely break the AI militarily, and you can't do it turtling in your territory, because their reserves will never come into play. You have to invade and wipe out their reserves.
     
  2. headcase

    headcase Limit 1 Facepalm Per Turn

    Joined:
    Aug 12, 2011
    Messages:
    1,213
    Location:
    Ontario, Canada
    Yes. They should give units free promotions (not of their choice, just drills, shocks, maybe medic) (properly marked in the pre-battle report, of course) and mellow out a bit with the science and gold bonuses.

    Firaxis appears to feel that giving units an outright strength bonus would be too obvious. Well, it would be obvious, but so is the science and gold bonus they get on higher levels. A better AI would be the best solution (and in my opinion an attainable one).

    Naval units don't need an extra bonus though, they need better AI. The AI for naval units is so poor that I would classify it as a bug.
     
  3. dexters

    dexters Gods & Emperors Supporter

    Joined:
    Apr 23, 2003
    Messages:
    4,150
    Gender:
    Male
    Location:
    Canada
    Giving the AI combat bonuses, either as a flat modifier or a free promotion was suggested in the early days of civ5 when the combat AI was performing even worse. The community has more or less rejected combat bonuses as a way to 'patch' the AI to give it an advantage.

    I am of the same mind as well.
     
  4. qemist

    qemist Prince

    Joined:
    Jul 16, 2011
    Messages:
    562
    A 2-ply relative strength optimization (as you sort of suggest) would generally be much better than what the AI does. I.e look at all my (AI) moves, look at all opponent moves for each of my moves (this sounds like a lot but many branches would merge or could be pruned), count how many units my opponent loses and how many I lose in each branch. Choose the move which maximizes the difference of these two numbers (minimax). Imperfect information leads to complications, but these are not insuperable.

    The current AI far too often puts units on "suicide squares".
     
  5. Olleus

    Olleus Deity

    Joined:
    Oct 30, 2005
    Messages:
    6,478
    Location:
    England
    Actually, qemist, that would be a LOT of calculation time. Given 6 units per side in a fight (low estimate) that each of them can move to/attack 10 different tiles (very low estimate, especially if there is cavalry around) that gives a total 1 thousand billion combinations. Sure, most of them can be recombined, but you still have to check them to know that. Even if only 1/10000 is unique, you then have to work out the combat odds for ~5 attacks.

    While this approach could work, the waiting time inbetween turns would be insufferable to 99% of players.
     
  6. headcase

    headcase Limit 1 Facepalm Per Turn

    Joined:
    Aug 12, 2011
    Messages:
    1,213
    Location:
    Ontario, Canada
    They could prune that down a lot. Even if it just calculated the maximum damage each side could do (which basically eliminates every option that involves walking to a blank space without firing afterwards) it would still be much better I think. Also, the recombining is indeed pretty powerful. Any move where the first hex begins in a direction that would not be taken to reach an enemy can all be dismissed as withdrawal scenarios from the first move and completely ignored unless withdrawal becomes the AI's choice. A unit's battle options in a 6v6 scenario would be [any of the six units it can reach] or [any of the ~8 hexes it can reach near those units] or [calculate good withdraw and go with that]. Out of those options, it can take the best 2 or 3 and compare with the best options of the other units. Not saying it's easy, but it's a huge part of the game so it shouldn't be.

    If all of that is too complicated, it should at least say "this is the move I'm going to take. Oh wait, if I do that, 3 guys will shoot at me, I will be down to 15% health, and at that point I will choose to withdraw. They have no reason not to shoot at me, it's a free move and they're clearly not doing anything else. Guess I will not make that move after all".
     
  7. Becomedeath

    Becomedeath The Destroyer

    Joined:
    Feb 19, 2011
    Messages:
    423
    Location:
    Channel Islands
    I think that approaching it purely as a calculation issue is a little closed. The problem with AI in a 1upt environment is more complex than simply valuing units and I think it has a large amount to do with the AI not using set plays. (Not that I'm suggesting it should have a playbook and just repeat moves verbatim.)

    Ultimately, there are only 4 classes of land combat unit.

    Melee - warriors, infantry
    Ranged Weak - archers, crossbowmen (these are only really around for the first few eras and seem to vanish after chemistry appears)
    Ranged Seige - catapults, artillery
    Unit Inteceptors - horsemen, tanks (those with negative city modifiers)

    These are then modified in priority by strength.

    The AI doesn't need to know how to control every type of unit, simply what to do with these 4 types.

    If you look at how you play, you move your units in a pattern that follows how you intend to attack, you make assesments based on the unit defense around that city and approach accordinly.

    The AI doesn't seem to do this, it wades its units in and if the seige ranged happen to be at the front then it will shift them afterwards to let the melee through.

    I think by teaching it attack patterns and then letting it diversify based on opposing units and terrain (ranged units favor hills, melee favour forest next to cities where they can take cover etc) that you should be able to build up a stock of formations that the AI can then replicate.

    Currently, it seems to me, the AI is playing a lot like a simple chess program in that it is applying values to units and simply moving them accordingly to how those values change, rather than creating a wider view of the game and employing a strategy with a clear outcome. It wants a city, it moves units, it has no idea how it's going to take that city other than to just keep pounding it until it breaks.

    Teaching the AI to use units properly, which the above is aimed at, would be a massive leap forward and solve a lot of the stupid moves that it currently uses in it's suicidal conquests.

    I don't think its the AI overall that doesn't work properly, I think it's the AI's understanding of what units do and their relationships.
     
  8. headcase

    headcase Limit 1 Facepalm Per Turn

    Joined:
    Aug 12, 2011
    Messages:
    1,213
    Location:
    Ontario, Canada
    Well said. Watching a good human playing, asking them why they did each move, and trying to apply those heuristics to an AI could probably do a lot without it considering too many combinations.
     
  9. Rex_Mundi

    Rex_Mundi Prince

    Joined:
    Mar 23, 2011
    Messages:
    305
    Location:
    Denmark
    Teaching the AI to build Barracks and Academies would go a long way towards fighting promoted units.
     
  10. Becomedeath

    Becomedeath The Destroyer

    Joined:
    Feb 19, 2011
    Messages:
    423
    Location:
    Channel Islands
    If you developed a "play book" this way, you could even have more advanced strategies for higher levels so the AI didn't need freebies to be harder to beat! :cool:

    I think to a degree human combat movements follow set patterns, in this style of game they have to ultimately, they can't be that hard to map.
     
  11. dexters

    dexters Gods & Emperors Supporter

    Joined:
    Apr 23, 2003
    Messages:
    4,150
    Gender:
    Male
    Location:
    Canada
    Yeah, but I can;t imagine Civ6 not having multi-core CPU as a minimum requirement. So i think 1UPT will get better over time. I'd imagine 8 to 16 cores being standard in 2014 when the next game is ready.

    As for Civ5, the problem for the AI will always be the human will manage its troops better and they will need to rely on numbers, and that's always been the argumrent for Stacks (that the AI can bring together more numbers) in one spot, and it's a fair point to make.

    But meticulously killing a numerically superior AI has always been a hallmark of playing a 'harder' AI so I don't think that will ever change.
     
  12. Ninakoru

    Ninakoru A deity on Emperor

    Joined:
    Nov 14, 2002
    Messages:
    658
    Location:
    Madrid, Spain, Europe
    I would say that's the problem. With the hex map and one unit per tile, giving the AI more units won't affect the outcome so much. Once you have enough units you can stop 100 o 1000 enemy units, so in higher difficulties they shouldn't focus so much on numbers, but giving them a +X% bonus based on difficulty.
     
  13. dexters

    dexters Gods & Emperors Supporter

    Joined:
    Apr 23, 2003
    Messages:
    4,150
    Gender:
    Male
    Location:
    Canada
    Again combat bonus was suggested and rejected, and I think for good reason. You don't want to create an experience where the game is working against you and you lose what should be winnable fights.

    The bonuses need to be subtler.
     
  14. headcase

    headcase Limit 1 Facepalm Per Turn

    Joined:
    Aug 12, 2011
    Messages:
    1,213
    Location:
    Ontario, Canada
    I agree with this too, and it's all the more reason why Firaxis needs to put real work into the AI (Civ as a whole is a complicated game; moving a few units at a city is not).

    I wouldn't suggest a combat bonus except that their bonuses elsewhere are so ridiculous (on Diety) that adding a combat bonus and reducing gold\science bonuses would actually be subtle in comparison :crazyeye:
     
  15. lschnarch

    lschnarch Emperor

    Joined:
    Oct 7, 2010
    Messages:
    1,296
    Just a question:
    As I am currently playing my first game since December, I've got the impression that the combat AI actually has got worse!
    Just for the background:
    Emperor, huge map, continents, France.
    I am capturing workers like crazy (being constantly at war from turn ~30 to 110 now and none of the three wars has been declared by me), I assume that it has been almost 10 workers now.
    This is significantly more than last year, where it would have happened too, but not that much frequently.

    2nd observation: siege weapons are again rolling to the front without being escorted. At least the escorts are not protecting the sieges weapons, but try to engage here or there, leaving the siege weapons alone and prey to my horsemen.
    Once again, this effect seems to be considerably worse than what I remember from last year.

    3rd observation: "Attacks" (actually, they don't deserve that name) on your cities can easily be interrupted by shooting (the city itself or defending archers) at one or two of the attacking units, which then try to move back (assumed: for recovering).
    The rest of the attack force remains where there are just located at that moment.
    The effect is that the attack force is split into parts and can easily picked one by one, thus completely destroying them.

    So, my question is: has there been a patch in the meantime which has weakened the combat AI? :confused:
     
  16. dexters

    dexters Gods & Emperors Supporter

    Joined:
    Apr 23, 2003
    Messages:
    4,150
    Gender:
    Male
    Location:
    Canada
    That hasn't been my experience. The siege weapons usually have preset positions they want to take and travelling there may be causing you to think they're not escorted.

    I routinely lose cities in my emperor games, and experience set backs. Without knowing about your game it's hard to judge the circumstances. Terrain is an issue that can be worked into your favour, but generally, the AI can bring 3+ siege and can now take your cities in under 3 turns with ease.
     
  17. civ7

    civ7 Chieftain

    Joined:
    Jul 1, 2011
    Messages:
    37
    let's allow stacks just for the AI

     
  18. lschnarch

    lschnarch Emperor

    Joined:
    Oct 7, 2010
    Messages:
    1,296
    Then I would like to wait for the experience reports of others, since in this current game all three enemies (Ramkhan, Bismarck and Hiawatha are all doing exactly the same: attacking with too less units, stupidly moving them, sending workers into my territory, leaving the siege weapons alone).

    Granted, the combat AI never was even mediocre, but this time it is extraordinarily bad.

    I mean, based on my experiences from last year, I wasn't exactly afraid when Ramkanheng attacked me, although I just had 2 warriors and 1 archer (upgraded scout).
    When Bismarck joined, I thought "Ok, now I should be a bit careful, perhaps!"
    Then I crushed both their invasion forces, pushed Siam back and had to move my whole army from south to north to meet Hiawatha.
    In total I have lost 1 warrior due to not being aware that cities can shoot over forests, one horseman since I moved it too much forward so that it was attacked in total by four units and 1 swordsman at a city attack.
    All three losses I could easily have avoided (my fault) if I would have been a bit more careful - and that is exactly the problem: I am not concentrated in this game anymore, as I will win the battles anyway.
    I have stolen like 10 workers from the three nations and have already started to kill three of them to reduce troup maintenance.

    And there isn't any challenge. I see them coming, may it be combat units or workers, I crush them or capture them and that's it. It is kind of frustrating to be enabled to do so. It's like slapping a group of 6-year-olds into their faces, over and over again.
    It is even not fun. :sad:
     
  19. dexters

    dexters Gods & Emperors Supporter

    Joined:
    Apr 23, 2003
    Messages:
    4,150
    Gender:
    Male
    Location:
    Canada
  20. Hail

    Hail Satan's minion

    Joined:
    Apr 25, 2009
    Messages:
    746
    Gender:
    Male
    Location:
    Mother Russia
    well first someone must code in a unit manager so the AI's units could work in tandem and not wander around on their own. this is a must, otherwise everything below is simply not applicable

    +1 to brute force method

    the idea is simple:
    1) to go through all the permutations of involved units' positions and/or attacks to find the moves/attacks by units that result in the { our total effective hammers(aeh) - opponent's total effective hammers(oeh) }(#)

    next the AI should switch sides and repeat 1). let's call (#) for this step (##)


    what the AI ultimately ends up with is a matrix(rows what AI did, columns how opponent reacted) that can be min-maxed, but for simplicity avg { (##) } -> max is fine imho
    inversely opponent seeks avg { (##) } -> min

    an artificial example:
    Spoiler :

    1 AI unit(au), 1 opponent's unit(ou).
    unit's generic stats: 100 hammers, 100 hp e.g. full, 40 attack damage, 20 counter-attack damage, 1 movement

    fortification gives +50% to counter-attack damage and -50% attack damage.

    situation:
    ou is fortified and au stands adjacent to him. it is au's turn to act

    NB as you may notice initial (#) for the AI is -100 as ou is fortified increasing his eh to 200. if au forces ou out of fortification, he gains 100 in (#) without(!) even attacking :D

    au(as any unit) can (by row):
    • (1) move(skip turn is the same in this context), but stay adjacent to ou -> (#) = -100
    • (2) move way from ou -> (#) = -100
    • (3) forify himself -> (#) = -100(initial) + 100(fortified status) = 0
    • (4) attack -> (#) = -100(initial) + 40(attack itself) - 30(counter-attack: 20 + 50% fortified bonus) = -90

    indices are in the form (rc); r = row, c = column

    opponent reacts to (1)
    • (11) ou looses his fortified status prior to moving (##) = 0
    • (12) ou looses his fortified status prior to moving, but cannot be reached by au next round (##) = 0
    • (13) skip turn option goes here, since ou is fortified already (##) = -100
    • (14) attack -> (##) = -100(lost fortified status) + 40(attack) - 20(counter-attack) = -80

    opponent reacts to (2)
    • (21) same -> (##) = 0
    • (22) units move away from each other -> (##) = 0
    • (23) same -> (##) = -100
    • (24) n/a

    opponent reacts to (3)
    • (31) au and ou switch sides from initial position -> (##) = +100
    • (32) same -> (##) = +100
    • (33) both units are fortified -> (##) = 0
    • (34) swap sides(e.g. signs) in (4) -> (##) = +90

    opponent reacts to (4)
    • (41) move, but stay adjacent -> (##) = -10
    • (42) same -> (##) = -10
    • (43) skip turns -> (##) = -90
    • (44) attack -> +80(-50% of eh for loosing fortified status) - 40(attack) + 20(counter-attack) = +60

    results:
    (1) -> with (#) = -100 & { -100 <= (##) <= 0 }. 4 * avg = 2 * 0 + 1 * -100 + 1 * -80 = -180
    (2) -> with (#) = -100 & { -100 <= (##) <= 0 }. 4 * avg = 2 * 0 + 1 * -100 + ? = -100 (?)
    (3) -> with (#) = 0 & { 0 <= (##) <= 100 }. 4 * avg = 2 * 100 + 1 * 0 + 1 * 90 = 290
    (4) -> with (#) = -90 & { -90 <= (##) <= 60 }. 4 * avg = 2 * -10 + 1 * -90 + 1 * 60 = -50

    (3) is a clear winner. as you can see (#) -> max should be a pretty good heuristic. another observation is that the most numerous options, e.g. (1) + (2) are the worst.
     

Share This Page