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

How weak is the AI?

Discussion in 'Civ6 - General Discussions' started by Lynxx, Oct 10, 2016.

  1. NerdByFate

    NerdByFate Chieftain

    Joined:
    Oct 7, 2016
    Messages:
    90
    Location:
    United States
    I would disagree. That confused me at first glance. ;)
     
  2. Siesta Guru

    Siesta Guru Prince

    Joined:
    Dec 2, 2007
    Messages:
    498
    Location:
    The Netherlands
    I'm mostly hoping that the royale will show off some proper AI tactical decision making. That is probably the hardest thing to get right, yet the easiest to observe and what will make the most impact in terms of feeling like the AI is competent. Empire building mistakes can be easily compensated by bonuses, war not so easily. You'll get unfairness feelings much quicker with combat bonuses than with production bonuses, because what happens in combat is just so much more visible. It's also almost certain to be impossible to mod tactical combat until we get access to the source code, while empire building related problems could potentially be fixed by the community and/or patches.
    If the AI manages not to dance around, and we see it maneuver terrain (especially choke points) properly and if it manages to correctly position and use range units, then we can expect good things!
     
    jbavon likes this.
  3. stealth_nsk

    stealth_nsk Deity

    Joined:
    Nov 28, 2005
    Messages:
    5,513
    Gender:
    Male
    Location:
    Novosibirsk, Russia
    Well, surely weighted decisions with priorities algorithm looks the best for most strategic decisions in civilization, but there are other simple AI algorithms like decision tree, which could be used for parts of the strategic AI. And I should say tactical AI is quite different beast.
     
  4. NerdByFate

    NerdByFate Chieftain

    Joined:
    Oct 7, 2016
    Messages:
    90
    Location:
    United States
    I agree. It would seem that we will likely learn quite a bit about the AI's functionality from the royale on the 19th. Fingers crossed it won't be as bad as I currently believe it may be.
     
  5. StittsvileJamie

    StittsvileJamie Chieftain

    Joined:
    May 11, 2016
    Messages:
    41
    Location:
    Ottawa, ON
    I have a feeling that most observers will see exactly what they want to from the AI only battle.
     
    Mort_Q and rreebb like this.
  6. Siesta Guru

    Siesta Guru Prince

    Joined:
    Dec 2, 2007
    Messages:
    498
    Location:
    The Netherlands
    True, but even if a decision tree like system is chosen over a purely weighted model, it is likely to still base the decisions of the tree on values that can be easily set in configuration files. The civ teams have released a lot of content outside of the main game, like little scenarios with their own tech trees, and they're not going to create entirely new AI systems based just on that. They need a system that can be configured easily to fit new tech trees, new government options, new buildings, etc. And likely this'll be possible for those who didn't actually write the AI, as they'll probably use different people. The AI core programmer is unlikely to be the one who ends up setting all of the config values for all the scenarios.

    And considering both civ 5 and civ 4 have used these weighted models (I'm not sure about earlier installments), I think I feel pretty secure in saying that civ 6 and probably most future civ games will also use very similar systems.
    Which would mean were probably stuck with AIs that have rather similar skills in terms of empire building as the ones we have now. Hopefully it'll be better tweaked, and hopefully some of the systems will be offloaded to more specific systems that can allow 'planning', but I'm not expecting too much. I fear that the AI will be rather weak when it comes to chasing eurekas and placing districts for example.
    The tactical game is where were likely to see the biggest gains, this is the most visible aspect of AI, they had more complaints about it, and its probably the easiest part to make significant gains in.
     
    Atlas627 likes this.
  7. stealth_nsk

    stealth_nsk Deity

    Joined:
    Nov 28, 2005
    Messages:
    5,513
    Gender:
    Male
    Location:
    Novosibirsk, Russia
    I didn't dive deep into the AI code for Civ5, but isn't weighted model lacks decent planning capabilities? The tactical AI surely uses some kind of "targets", do you know whether strategic AI has anything like this?
     
  8. Siesta Guru

    Siesta Guru Prince

    Joined:
    Dec 2, 2007
    Messages:
    498
    Location:
    The Netherlands
    Do you mean strategic as in who to declare war on?
    If so, the standard war declaration model uses a couple of weights too and isn't based on a plan like 'I want city x'
    It's basically a mix of: 'what is my personality', 'how much do I like civ x', 'am I already at war with someone/planning a war', 'how close is civ x', 'what is my relative military strength compared to civ x', 'am I on the conquest grand strategy', 'do they have nukes', 'are they a reckless expander', 'what is the difficulty level (prince and above all have the same)'.
    It loops through all of the civs, and for each combines these factors using weights and if that combination of those factors hits a certain threshold, the AI will go into a war planning phase towards the civ with the highest score. When it prepares it will do a 'call to arms' where it collects all units in a certain area, puts it in a formation, moves it over, then declares war when its close. You can see this in game sometimes as the 'sneak attack' spies tell you about. During the preparation phase, the AI can still change its mind, which is especially common with distant civs, hence the phantom sneak attacks.

    War can also be declared by someone asking them to, which uses hardcoded weights rather than xml weights and a completely different method. Whether a player asks and/or accepts is determined by:
    'Do I like the person asking', 'do I like the target', 'am I not already in or planning a war', 'whats my personality', 'am I on the conquest grand strategy', 'is the target a warmonger'
    So significantly less factors.
    And lol, it appears I just found a bug, because its written so that the AI will be less likely to ask for a joint war if trade is happening, but instead of checking this for the player it is targeting it checks for the player it is asking. So its less likely to ask if it is trading with whoever he would've wanted to ask. This actually doubles up in effectiveness too, because whether a civ accepts is also impacted by the same thing. I guess that explains why the civs that declare together seem so random and why it's almost always some random civ across the globe that bugs you about declaring war.

    In these types of joint declarations, the AI also won't wait for the 'call to arms' before declaring. And might never end up sending any forces.

    On top of these systems, there's an additional weight based system that checks whether they will offer or accept peace and at what cost. This again uses different weights, most of which can be set through xml.

    Because you basically have 4 different systems which all work with different weights: do I declare war myself, shall I ask/accept to declare war together, shall I offer/accept peace, shall I launch an attack force; you sometimes get funny results like war declarations not being followed up by attacks, or civs that declare war and will then offer everything for peace asap (there's a fixed timer).
     
    Last edited: Oct 17, 2016
    Atlas627 and ThisNameIsTooLo like this.
  9. stealth_nsk

    stealth_nsk Deity

    Joined:
    Nov 28, 2005
    Messages:
    5,513
    Gender:
    Male
    Location:
    Novosibirsk, Russia
    I was speaking about the whole strategic level - techs, policies, building things.

    Anyway, as described, the AI uses "states" as "war planning phase", which is the most basic form of planning. That's ok :)
     
  10. Wizard-Bob

    Wizard-Bob Always remember to Find Your FUN!

    Joined:
    Sep 7, 2010
    Messages:
    170
    Gender:
    Male
    Location:
    Florida
    First, Thanks so much, Siesta Guru, for your very informative peek at CiV AI. Enjoybale to read!

    The Civ 6 unstacking of cities will really cause a significant change to this area of the AI. Will be interesting to see the AI in action :)
     
  11. Siesta Guru

    Siesta Guru Prince

    Joined:
    Dec 2, 2007
    Messages:
    498
    Location:
    The Netherlands
    Yeah the war preparation phase is definitely a form of planning. There's also some things like deceit put in there so that they'll hide their intentions. The normal war declaration and general attitudes towards players feel like some of the more sensible AI systems in game, although some tweaking would be nice (its weirdly sensitive to rapid expansion and not sensitive enough to players having no military).
    The joint war system is sadly terrible though. I didn't expect it to actually contain a major bug, but I think most players can agree that those declarations felt very random.


    In terms of techs/policies/buildings/units, there's very little on top of of the flavor system and very little I would consider planning ahead. There is absolutely 0 regard for requirements, and a lot of complex mechanics have been reduced to simple flavor values. A real player thinks about the amount of marble/stone he has when considering the Mausoleum, an AI just has flavor_gold. Even the worst of real players wouldn't build navy in preparation for a war with a landlocked player, an AI just sees flavor_offense and flavor_defense on navy units and builds them.

    But, some of the flavor system reacts to changing environments and is in that sense intelligent. Being on a naval map increases the desire for naval, there's a boost to expansion at the start of the game, that kind of thing. Sadly there's not that many of these though.

    On top of that, looking through the actual code now, I can find these intelligent behaviors on top of the flavor system
    - It does do city specialization based on intelligent factors. This impacts flavors. On top of that, there's a designated wonder city. Other cities don't build wonders. And there's a randomness based system in place that stops them from going 100% into wonder production.
    - It can recommend units of a certain type if it needs to fill a certain formation up. As in, we're going to siege a city, we don't have any siege units, lets build a catapult. As far as I can tell this happens rarely though.

    The religion picker system works differently from units/buildings/policies/techs and appears to be one of the better systems. It actually calculates the extra benefit every religion gives in terms of increase of yields inside of its empire based on the benefit to tiles/cities. Then out of its top 3 choices, it picks one. The only weird things here are is that happiness is dramatically undervalued, and that I don't think they really realized that the formula used massively overvalues the benefit of the city bombard damage boost pantheon, which will probably always be in the top 3 picks.
     
    Last edited: Oct 17, 2016
    Atlas627 and ThisNameIsTooLo like this.
  12. stealth_nsk

    stealth_nsk Deity

    Joined:
    Nov 28, 2005
    Messages:
    5,513
    Gender:
    Male
    Location:
    Novosibirsk, Russia
    Thanks for the details, it's really helpful! Looking through tonns of C++ code is really a pain :)
     
  13. ThisNameIsTooLo

    ThisNameIsTooLo Emotion Lord

    Joined:
    Sep 14, 2012
    Messages:
    213
    What if the AI, in addition to having preference values for building flavors, also had preference values for specific buildings?

    For instance, Tomyris may only want a Domination victory, so she'd prefer to make only buildings with a high Military flavor. But she, like all AIs, would have a high preference value for building a Science District, so as soon as she runs out of Military-flavor things to build in a city, that'll be the next building she focuses on.
     
  14. Siesta Guru

    Siesta Guru Prince

    Joined:
    Dec 2, 2007
    Messages:
    498
    Location:
    The Netherlands
    That's possible even within flavor based system through adding one-use flavors that boost only one building, unfortunately that wasn't possible in civ 5. Creative use would be a great tool in promoting better strategies and more flavorful leader strategies.
    It'd be great if they made use of this or allowed modders this ability. You could for example make a civ specific flavor that you slap on ancient/classic science buildings, medieval production/military buildings, some techs to beeline in renaissance and then on some units of that era. That would encourage behavior we'd think of as planning for a renaissance era assault, while still allowing some flexibility if the map doesn't allow for it or something.
    It would appear to us like planning and proper strategizing, even though it uses the same flavor system.
     
    ThisNameIsTooLo likes this.
  15. stealth_nsk

    stealth_nsk Deity

    Joined:
    Nov 28, 2005
    Messages:
    5,513
    Gender:
    Male
    Location:
    Novosibirsk, Russia
    Weighted system is actually quite powerful, as there's no limit how complex the parameters are. For example, it's possible could calculate "naval exposure" (like the percentage of naval cities from the total amount of cities) and use it to favor building naval/land units during war preparation.
     
  16. ThisNameIsTooLo

    ThisNameIsTooLo Emotion Lord

    Joined:
    Sep 14, 2012
    Messages:
    213
    Naval = (Civ-specific weighted constant) * (number of water tiles within workable radius of own cities) / (total number of tiles within workable radius of own cities)
     
  17. Lyoncet

    Lyoncet Emperor

    Joined:
    Dec 20, 2009
    Messages:
    1,676
    Location:
    Minnesota
    Agreed. Unfortunately they're just as powerful as they're made to be, and no more. And in the case of Civ, the answer, unfortunately, is usually "not terribly."
     
  18. Siesta Guru

    Siesta Guru Prince

    Joined:
    Dec 2, 2007
    Messages:
    498
    Location:
    The Netherlands
    Yeah that's right. A weighted system is definitely one of the best ways of doing this kind of thing, but if most if your weights are 'dumb' as in 'not responding to the environment', and if many of the weights are weirdly tweaked, then you end up with players that barely manage to get anything done.
    I've done a bunch of flavor tweaking for a balance/ai mod Ive been working on for a while, and the AI actually ends up being a beast (at emperor+) with proper weights and less lopsided balance. T300 domination victories in battle royales, that kind of thing. And that's using just the 'dumb' preconfigured flavors, without being able to resort to more intelligent stuff like weighting certain civs to prefer good strategies.
     
  19. Lyoncet

    Lyoncet Emperor

    Joined:
    Dec 20, 2009
    Messages:
    1,676
    Location:
    Minnesota
    The optimistic part of me says, "Yeah, let's keep showing them what's possible, and one day a game will ship with great AI!" And then another part of me says, "Or they'll just keep leaving it up to modders." :blush:
     
  20. Todd Hawks

    Todd Hawks Warlord

    Joined:
    Nov 13, 2005
    Messages:
    228
    I don't think we will see much. You only get to see how bad the AI truly is when you let it play against a human player. If you pit weak AI against weak AI it will all look on par. Especially if the weakness is on the strategic side (slow teching, unit upgrading, diplomacy,...)
     

Share This Page