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

AI: Why is it so hard to improve?

Discussion in 'Civ6 - General Discussions' started by eXeel, Nov 2, 2016.

  1. AIL

    AIL Warlord

    Joined:
    Dec 12, 2003
    Messages:
    127
    Location:
    Germany
    @Lord Yanaek:
    "There are some many people thinking any 1st year computer sciences student would create abetter AI in 1 month."
    Well, most likely not if they'd have to start from scratch.

    But when they get access to the existing source code as a base and just add to it, debug it and try to improve it, I'm pretty sure that indeed almost any 1st year computer sciences studend would end up with a better AI than what he started with.

    That's more or less what happened when I started working on Pandora. My knowledge about AI programming was very limited at this point but I had seen what the AI was particulary bad at or was unable to do at all.
    So within the first month I already made massive progress.
    The AI learnt to use the tax-slider it never touched before, it learnt to upgrade units, it got way better at deciding which buildings to produce, it got way better at selecting the right units to build, got better with tile-improvement and so on.
    At that time I didn't dive much into unit-behaviour itself as the code for that seemed too intimidating except for simply removing the method that let the AI patrol aimlessly with it's units as that basically prevented me from letting them upgrade them as they need to be in a city for that.
    But still: It was probably more than twice as hard to beat as before already with still a lof of improvement potential left.
    There clearly are diminishing returns on your time spent vs. AI playing-strenght. The so called 80:20-rule, that says: You can achieve 80% of the effect in 20% of the time and it takes 80% of the time for the remaining 20% applied very well here.
    So the worse the AI is when you start, the easier it is to make huge progress quickly.

    Improving AI via Mods and SDKs is actually much harder and more respectable than when you have access to the source-code. As a modder your interface usually is limited and you never get access to all the data you'd like to or getting that access is much harder than from within the game-code. But that really depends on the interface for the SDK and I might be wrong here. At least for what I tried, I constantly got to situations where I had to guess and trial and error how things worked.

    I completely agree about the notion that dumbing down a smart AI or reducing their playing strenght is easier by several orders of magnitude than the other way around.

    So while I don't think they made the AI bad on purpose, it is easily imaginable that the Sid-quote meant they didn't see much reason to put a whole lot of effort into it either.

    I actually am not a proffession AI-developer. It all started as a hobby-project, where I kindly asked the devs, if they would let me toy around with their code. It just so happened that it eventually turned out really, really well. Of course that doesn't shine a good light on the professionals, if someone who does this as a freetime-activity creates a much better AI than what they were paid for. I guess my advantage was not having to stick to any schedules and being very dedicated because to me improving the AI was actually a really fun experience.

    With "Dominus Galaxia", it's a bit different. I started into it with all the experience I gathered in Pandora and had an extremely basic AI to start work with which was lacking a lot of basics to even actually play the game. But my progress so far is even better. We are not even at Alpha and I have very little player-feedback to use to improve the AI and yet it is the best 4x-AI I ever played against winning less than a third of my games against it on a level where there's no advantages for anyone. For Pandora I didn't get to a point where the AI could beat me on a level playing-field unless I had really bad luck with starting-locations.
    But it still is a hobby project! Only one of our team is actually working full-time on the game and whether any of us gets paid anything depends on the success the game might or might not have. Only one being paid is the artist. Others are just working on it for fun. And I can say: Even if the game flops completely: Now I have a game that is really fun because it has a great AI and that's exactly what I've always wanted but didn't get before I started taking care of that myself!

    @Victoria:
    I said time and dedication instead of time and money for a reason!
    Moneys ability to motivate people to do their best is limited. In my case it doesn't even play a role in my motivation. My main motivation is to have a game that's fun to play... and for me in a 4x a good AI is essential for that! The ability to improve it whenever I find another weakness, is invaluable and gets the replay-value to unthinkable heights for me.
    I swap back and forth between playing and improving the AI: When I lose I can be proud about my AI, when I win I gather data on what the AI could do better. It's always a win for me in the long run.
     
    Bad_Viceroy and Uberfrog like this.
  2. alberts2

    alberts2 Emperor

    Joined:
    Aug 16, 2012
    Messages:
    1,947
    Gender:
    Male
    Location:
    Germany
    In Civ IV the AI just got huge bonuses.

    But it wasn't really better otherwise modders wouldn't still be working to improve it. Look at K-MOD and how much work was done by Karadoc and others to improve the AI. Even after all of that there are still remaining issues.
     
  3. Lord Shadow

    Lord Shadow General

    Joined:
    Oct 14, 2005
    Messages:
    2,001
    Gender:
    Male
    Location:
    Buenos Aires
    That's pretty much it. Bonuses and a simpler game across the board.

    Some people would be happy if the AI could simply roll all of its units into a stack and smash into cities like Miley Cyrus on a wrecking ball, without considering any factor other than sheer numerical strength. Apparently that's the stuff of legends, "epic battles" and fabled challenge. But that's only the glass rose-tinted glasses are made of. For that, there's Civ4 and every Civ that came before. They're not going away just because new Civs come out.

    Some people would be happy if every franchise, not just Battlefield, Call of Duty and Assassin's Creed, were a string of remakes and remakes of remakes. But we must move forward: nothing advances through regression. The AI must be continuously improved to handle new systems and more intelligent approaches. 1UPT is tough on said AI, but it's a decidedly better, deeper, more rewarding system for the player, and the AI handling of it has indubitably improved since its inception in Civ5. They just have to keep at it.
     
    Last edited: Nov 2, 2016
    Bad_Viceroy likes this.
  4. manu-fan

    manu-fan Emperor

    Joined:
    Sep 20, 2006
    Messages:
    1,005
    The AI must be incredibly complex already to do as well as it does. I think that they can make some tweaks though, looking at specific situations and doing different things in those situations that they do now.

    For example: In a Deity game I watched, player was wiping out the Japanese and going towards their only city (their capital). He was laying siege to it with archers and it was taking a lot of turns to get it down. It produced.........a Settler!! It should be something like 'Emergency if 1 City and under attack, switch from Settler to Archer' or something.
     
  5. dexters

    dexters Gods & Emperors Supporter

    Joined:
    Apr 23, 2003
    Messages:
    4,182
    Gender:
    Male
    Location:
    Canada
    If the game was exactly the same as Civ 5 I thinl would not be having this discussion but new mechanics and rules will mean the AI will need to be taught on how to hamake those new mechanics.
     
  6. isau

    isau Deity

    Joined:
    Jan 15, 2007
    Messages:
    3,068
    While it is unlikely the AI will match a player, there are games with 1 unit per turn rules with decent-ish AI, or at least AI that can threaten you.

    Age of Wonders 3, for example, does a competent job. It's not perfect and sometimes there are issues, particularly due to the existence of spells. But overall, it's pretty good. Main differences versus Civ are:
    - Those devs spent a LOT of time going back over the code after release, making edits until the system worked reasonably well (we will see how that works out for Civ)
    - Because of the way battles are isolated, the objective of the units is generally simpler--kill all enemies
    - The units are given more room to move

    It's on that last point where we may be in trouble. For some reason, in Civ 6, they made movement even slower than in Civ 5. Our cities now span multiple tiles but this didn't result in a scale adjustment to the tile count. AI is always going to struggle hard with this. Their melee units can no longer reliably move either 1 or 2 tiles per move, they are often single-stepping through territory.

    The AI does become better at defending (slightly) when roads are made better. That's because it can move units into position with a higher degree of mobility than the player.

    Where it's always going to struggle is taking cities. It struggled with this in Civ 4 too. But Civ 4 masked this much better by making the Domination victory based on the number of tiles owned, not taking control of enemy capitals, which it would definitely be terrible at.

    Beyond all this, there's a final problem. The AI doesn't realize it's bad at taking cities. It think it's an achievable task. So where they could cause major headache for us by pillaging our tiles, they hold off on it on the theory they can grab the city. If they instead focused on just destroying as many tiles as they can they'd be far more dangerous.
     
    Kingreaper likes this.
  7. AIL

    AIL Warlord

    Joined:
    Dec 12, 2003
    Messages:
    127
    Location:
    Germany
    Um... have you played Pandora or are aware of the approach it uses?
    You can stack all you want but there's units and Operations that deal Splash-Damage to a whole stack and boni for flanking a unit from different sides so you are encouraged to spread-out your units but don't have to.

    So it has best of both worlds and I'd say it's easily a better solution than plain 1UPT.
     
  8. Babarigo

    Babarigo Chieftain

    Joined:
    Oct 18, 2013
    Messages:
    72
    The AI has always got big bonuses not only in Civ 4. The only reason why the AI was more dangerous in Civ 4 with its armies is because the stack system was easy to handle. I'm not saying that Civ must go back to stacks but the devs can't expect the AI to perform decently in a more complex system like 1UPT without improving this AI.
     
  9. Cromagnus

    Cromagnus Deity

    Joined:
    Sep 11, 2012
    Messages:
    2,272
    I've mentioned this before on these forums, but the primary reason AI has always sucked in Civ (IMHO) is the game's complexity. Compare it to chess, which is a vastly more trivial game. It took a supercomputer and years of work for researchers to finally beat a grandmaster. That's a game with 64 tiles and only units... a game with no research, production, economy, city micromanagement, trade, exploration, to list just some of the things that make it more complex.

    Now, of course the bar is set much lower than "Grandmaster" with Civ... we just want an AI that doesn't make a fool of itself, but that is still a very complex problem to solve. And frankly, aside from the sheer amount of time and effort (cost) that would be required to really solve it... any successful solution would alienate most of the playerbase. The min spec would be like a 32-core Zen.

    1UPT is definitely part of the problem, and IMHO other strategy games have done better with the AI, but let's just be fair. This is not an easy problem to solve.
     
  10. Lord Shadow

    Lord Shadow General

    Joined:
    Oct 14, 2005
    Messages:
    2,001
    Gender:
    Male
    Location:
    Buenos Aires
    I haven't really played Pandora. But save for the flanking (if I remember correctly), that sounds pretty much like the Civ4 system, which also had collateral damage from planes and artillery in the picture.

    An easier solution, but not necessarily better.
     
  11. Krajzen

    Krajzen Deity

    Joined:
    Oct 23, 2013
    Messages:
    2,893
    Location:
    Poland
    I would pay you for working on civ6 AI - just saying ;)
     
  12. Lord Yanaek

    Lord Yanaek Emperor

    Joined:
    Aug 15, 2003
    Messages:
    1,496
    We had access to the c++ source code for the main game dll in Civ5 (and i think in Civ4) so AI mods were actually changes to the code itself, which is why I hope you might have a look once they release the SDK.
    You did a great job identifying the differences that makes combat easier to the AI in AoW. The main issue for the AI in Civ is not 1UPT, it's 1UPT in a game that hardly have the scaling for 1UPT. In age of Wonders, we actually move stacks on the map, and combat takes place in secondary maps. If the AI has 3 times as many units as we have, they will be able to fight us with 3 times as many units. In Civ, due to scaling, if the AI has 3 times as many units, they will just wait at the back while the front guys get killed like those b-movies bad guys waiting as a 10 men circle around the hero rather than overwhelming him. Corps and Armies should make their task easier but they come quite late so maybe the system could be expanded and start earlier.
    Ranged units are much easier to use well for the AI if they have 10 tiles range rather than 2 which unfortunately is not possible in Civ. The way cavalry ignores ZoC makes them much more vulnerable thought so they should be less dominant then they were in Civ5 if the AI could learn not to send their cavalry at the front just because they are fast so they are the first ones to die.
    Well, this might be something we can teach them. AI almost never pillaged in Civ5 but with AI mods, it became much better at it.
     
  13. MyOtherName

    MyOtherName Emperor

    Joined:
    Dec 7, 2004
    Messages:
    1,526
    I don't buy that -- this looks to me like precisely the sort of problem that our current AI methods give really, really good results for if you take the time to develop it.
     
  14. The_Reckoning

    The_Reckoning Prince

    Joined:
    Sep 21, 2005
    Messages:
    419
    Location:
    UK
    Firaxis sells copies of the game based on how fun it looks.

    How fun it looks is not the same thing as how clever the AI is.

    So they spend the minimum time and effort on it, and people still buy the game.

    Sure they could hire a pair of programmers and dedicate their roles to AI improvement, and probably have the best AI ever in a 4x, but this would cost them too much for it to be worth it.
     
  15. malitano

    malitano Warlord

    Joined:
    Jun 12, 2008
    Messages:
    130
    I've mentioned a few times the first step is to program the AI to always upgrade their units
     
  16. Lord Shadow

    Lord Shadow General

    Joined:
    Oct 14, 2005
    Messages:
    2,001
    Gender:
    Male
    Location:
    Buenos Aires
    Except that's not the first step even for that particular problem. It's not that the AI simply chooses not to upgrade.
    • The AI can't upgrade if it doesn't have the necessary resources.
    • The AI can't upgrade if it hasn't researched dead-end techs (i.e. Archery), presumably because it doesn't specifically need them to proceed up the tech tree.
    • The AI can't upgrade if, at least partly due to the previous items, it finds itself in the middle of one of those huge, multiple-era spanning gaps between unit technologies (i.e. Knight -> Tank).
    So you can see, the problem goes a bit deeper, and is only related to AI per se to a small extent.
     
  17. Abade69

    Abade69 Chieftain

    Joined:
    Nov 2, 2016
    Messages:
    40
    Gender:
    Male
    The answer to this thread is: because of 1UPT (at least the combat issues).

    For a simple board game it takes thousands (even millions) of calculations for the A.I to "see beyond" as a human can. And it takes super computers to beat the best of the best. They should have upgraded the system to be something in between Civ 4 and 5, but they are repeating the same mistake of the 1UPT.
     
  18. GhostSalsa

    GhostSalsa Emperor

    Joined:
    Jul 7, 2012
    Messages:
    1,010
    Location:
    Austin, TX
    Oof, it is because the code has to do this (sorry to quote my own old reply):

    When you're playing the game and wondering why the AI decided to do this or that, first assume the programming failed to understand what was happening in the game.

    Yes 1upt creates a new order of challenge for coding an AI that can understand discrete inputs and change plans. It's amazing work, really, that when the AI declares peace for example, it knows what to do at all. There's no actual computer program out there that can think, "ah, what will I do with these guys and guns now? I need to look around..." So the AI can't really play the game, it can just react to conditions discretely, and VI vanilla reminds us how incredibly hard it is to code a preset meaning to all the discrete conditions that fly about the board every turn..

    But anyway as I've said in other posts I think the best thing is still to tweak and innovate the conditions of combat to be more open-field, so that brute force can threaten the human player more, and the AI will succeed more often with less turn time wasted on pathing.
     
  19. CrispyCritter

    CrispyCritter Chieftain

    Joined:
    Feb 20, 2006
    Messages:
    65
    Do you have examples? I don't know of any that good that handle the very wide range of units and promotions that even an unmodded Civ system must.

    And it's not just development time, which would be large but close to one-time, but the game play time. How much are we willing to pay in game turn time for better AI? My memory is that when Civ 5 was being developed, they had grand plans for the AI, but had to scrap them as it became apparent that any reasonable approach they took would mean turn times would be completely unacceptable. Good AI is tremendously expensive in CPU time and memory. Having good AI handle all the combats on a huge Civ 6 map in reasonable time seems impossible with current hardware.

    The AI can definitely be improved without major execution time costs, but it's going to be done by figuring out ways to squash the obvious mistakes rather then trying top-down to solve the problem "correctly", IMO. "Whack-a-mole" is do-able, but very time consuming and won't get us up to human capabilities. But it should make game play much nicer.
     
  20. Wulf38

    Wulf38 Warlord

    Joined:
    Aug 21, 2010
    Messages:
    228
    I'm a bit disappointed that the combat AI in Civ 6 seems to be a step back even from that in Civ 5 BNW. You'd think they could port most of the existing logic over, since Civ 5 and 6 have almost exactly the same combat model. And while the Civ 5 AI wasn't brilliant by any means, it did at least become somewhat threatening later in the game's life. If you made a mistake and over-extended some of you units into a place where they were outnumbered, the AI could generally kill them. If you didn't defend your cities well enough, the AI could take them.
     

Share This Page