1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  3. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  4. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  5. Dismiss Notice
  6. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

AI+ v12.1

AI Improvements for Civ VI

  1. Lion King

    Lion King Chieftain

    Joined:
    May 24, 2015
    Messages:
    56
    Gender:
    Male
    Location:
    Russia / UK
    Hoorah, Siesta is back!
    Now we can hope for a new version of AI+)
    I made a looot of tests (I almost hate Civ6 by now) for the last two days with AI+, creating a new mod and mixing everything.
    What I found is:

    1) To force AI to produce ships is relatively easy - just play with pseudoyields either in the base game or in AI+. By the way, looking through the base game code I was impressed that there is no difference in pseudoyields for difficulties/"under siege" conditions and so on. When using AI+ I tried to increase basic pseudoyields for ships (also reduced a bit naval preferences switch bw land and naval units as it is too extreme) to a level of 100 or 200 and it works. However I never saw AI producing aircraft carrier (mb special pseudoyield needed)

    2) Just simply including ships in the team doesn't really work. I created the following team with one of the line specifying non-zero ships:
    <Row TeamName="Naval City Attack Force" AiType="UNITTYPE_NAVAL" MinNumber="2" MaxNumber="6" />

    It would still use the same operation - "Attack Walled City":
    <Row TeamName="Naval City Attack Force" OperationName="Attack Walled City" InitialStrengthAdvantage="0.5" OngoingStrengthAdvantage="2" />

    Yet, on its own this one doesn't create anything. My AI operations log doesn't show any naval unit included in any operation which means that AI simply ignores this team. As a result of it all ships created by AI are not tied to formation. They can attack enemy ships and even cities sometimes but it will be one unit attack.
    By the way I noticed that AI creates aircrafts under "settle" operation, which I am pretty sure means they won't be doing any useful thing on the battlefield.

    3) However, it seems that the "Naval team" approach can work.
    In couple of my first test games (when I haven't looked at logs yet) I created a "naval team" and also put in "City Defence" operation max number of naval units to 1.
    It's probably not the best idea as AI starts building ships when it should be building units. However I think this was the first time I saw naval unit appearing in "AI operations" log. As a result of this operation AI starts accumulating naval units near its cities rather than spreading them across the oceans. That appears to be the main trigger for using this "naval team" formation and I saw couple of great examples when AI used ships, the best example attached (Arabian AI created two fleets and used them in a smart way to take two French cities).
    Now I am wondering if the City Defence operation is a pre-requisite to city assault operation. I am not really familiar with behaviour tree nodes but I don't really see any element which would prohibit AI from using ships in a normal operation.
     

    Attached Files:

  2. Lion King

    Lion King Chieftain

    Joined:
    May 24, 2015
    Messages:
    56
    Gender:
    Male
    Location:
    Russia / UK
    Update:
    It looks like simple shifting max number of naval units to non-zero works with AI+. I don't know Siesta what you did with the behaviour tree, but I finally able to see naval units in AI operations, both defending and attacking cities.
    E. G:
    67, 2, Attack Enemy City, Operation Recruit, 1 units, Recruited 1, Contract for: UNIT_GALLEY
     

    Attached Files:

  3. DemonEmperor

    DemonEmperor Chieftain

    Joined:
    Jan 17, 2017
    Messages:
    27
    Thanks!
    More detailed information would be helpful - I'm thinking of making a mod that overhauls the diplomatic and governmental aspects of the game.
    A planned component was modular unit/weapon building - e.g. if you want to build a battleship you first need to build a hull, and then add guns. And total tonnage/number of ships could be limited by treaty (mostly on defeats, but also as way to avoid war). same goes for land units.
    Was trying to figure out if
    1) the AI would be able to handle said arms limitation treaties and actually follow them
    2) the AI would actually use the treaties (AFAIK the easiest/best way within the framework is to treat them as diplomatic promises, which I've never seen the AI use with each other)
    3) the AI would be able to properly handle the diplomatic repercussions of breaking a treaty (against another AI, would be insta-denounce unless they're declared friends)
     
  4. Lion King

    Lion King Chieftain

    Joined:
    May 24, 2015
    Messages:
    56
    Gender:
    Male
    Location:
    Russia / UK
    Ok, after several tests I got the following:

    The whole decision whether to use naval units at city siege is decided by "OpTeamRequirements".I put maxnumber to 4 for naval units and had lots of fun on small islands map.
    Persian AI took 3 civ almost entirely by building fleets of frigates and caravels. So I can conclude that normal attack city behaviour tree is working good for ships. There is however two problems:

    1) AI doesn't distinguish between naval melee and naval ranged units. In some situations naval ranged units can bombard city for a number of turns without taking it with melee ship/unit.
    I suspect it is because I removed minimal requirements from land melee units. There is a split required for naval_melee and naval_ranged in tea to make sure at least one melee ship/unit is participating.

    2) AI doesn't distinguish between coastal and non-coastal cities and that's a bigger problem. AI can get a solid pack of units to the siege but ships won't be able to reach the city. That doesn't block AI from starting the attack but obviously chances to take that city are small.
    In my opinion there should be an "if-function", saying something like:
    a) If target city is coastal, then delete "city attack team" and use "coastal city attack team", which allows to use naval melee and ranged units. (or alternatively to check if there is a direct naval route to the target city)
    b) If target city is within one cell from sea, then use "naval bombardment team", where you can include a couple of ranged ships to help landing melee units.

    Alternatively the whole "city attack" tree can be recreated (in the manner similar to "zergrush" ), but again somewhere there should be a condition checking the target city.

    My problem now is that I don't know how to code that condition ;)
     
  5. Siesta Guru

    Siesta Guru Chieftain

    Joined:
    Dec 2, 2007
    Messages:
    487
    Location:
    The Netherlands
    Yeah there's basically nothing in the base game that makes them produce more or less units on a pseudoyield basis. They do build/more less based on the presence of operations, but only if the pseudoyields are high enough.
    Make sure to keep in mind that the pseudoyield value of the yields table is multiplicative and the pseudoyields attached to strategies are additive.


    Are you sure it doesn't work straight out of the box? I've not done anything specific to make this possible and have seen the behavior for a while. Ships do rarely attack in general with AI+ on. It just isn't very often/reliable nor very effective.

    You can attach your own aitypes to units and use those instead of the standard ones if you want a split. It doesn't always work perfectly (they still wont build most support units despite my best efforts), but it can get you somewhere.


    Yep.. In my experience it does sometimes actually prevent it from attacking when the cities can't reach it, and is the main reason I haven't just added the naval ships to the operation. AIs basically end up wasting resources to build ships that will actually make attacks on land cities less likely to happen. There is as far as I know no way to code any conditionals in so were stuck there. With purely new operations like the zerg one (which is basically turned off now btw), you at least prevent the normal attacks from being less effective as long as the new operation never launches.
    Man, all of this would be so simple with access to the actual code / with a good lua api.

    Just here to answer some questions at this point :) I don't have anything planned for AI+ atm and don't anticipate doing much beyond maintenance until we get better tools. If you're curious I'm building a Dota 2 bot right now, which actually allows coding with a pretty good API and proper debugging tools. It's a lot more fun to work on that.



    Interesting idea, but I'm afraid it's highly unlikely you can do this without access to the game code / without the devs making some way to use lua code for AI. Behavior trees at least don't allow you to code any of the important steps. They don't have a conditional for diplomatic promises, nor one that counts the amount of ships. And while you can kind of force unit builds with behaviortrees, you cant make them not build units, especially not in such a subtle way where they may consider whether it is worth the diplomatic penalty. There's not even any support for custom variables in behaviortrees.
     
  6. Uncle_Joe

    Uncle_Joe Chieftain

    Joined:
    Sep 9, 2005
    Messages:
    448
    Any chance for an update compatible with the Fall patch? The unmodded AI still seems to be far too friendly....
     
  7. Siesta Guru

    Siesta Guru Chieftain

    Joined:
    Dec 2, 2007
    Messages:
    487
    Location:
    The Netherlands
    Having a look right now to see if anything needs changing / whether there are new tools to work with.

    Edit:
    Looks like it at least doesn't crash the game. Competence has yet to be evaluated.

    Toolwise I don't see anything fundamentally new, but it seems there a couple of small additions to the xml toolset which is always nice. Mostly to support the new naval operations.
    There are also a couple of additions to the strategy conditions. There are now entries for classical/medieval/industrial eras on top of the renaissance/modern that were already available. Should allow for some finetuning of build desires etc. across the ages.
     
    Last edited: Oct 20, 2017
  8. V. Soma

    V. Soma CFC Staff

    Joined:
    Apr 13, 2004
    Messages:
    3,532
    Location:
    Hungary
    Hey Siesta, glad to see you around... sooo, some finetuning, eh? :)

    Would you advise using the mod as v11.1 with the autumn patch?
     
  9. Siesta Guru

    Siesta Guru Chieftain

    Joined:
    Dec 2, 2007
    Messages:
    487
    Location:
    The Netherlands
    Yeah I would still recommend it if you preferred it before the fall patch. It seems to mostly run as it used to. Settle rates, building choices and ability to capture stuff seem to basically be the same and I haven't noticed any other anomalies.
    Finetuning will be done if necessary.
     
    RohirrimElf likes this.
  10. Lion King

    Lion King Chieftain

    Joined:
    May 24, 2015
    Messages:
    56
    Gender:
    Male
    Location:
    Russia / UK
    Hey Siesta,
    Have you had a chance to test the new patch?
     
  11. Siesta Guru

    Siesta Guru Chieftain

    Joined:
    Dec 2, 2007
    Messages:
    487
    Location:
    The Netherlands
    Enough testing to be confident that it still works. Not enough testing to know yet what kind of tweaks (if any) are going to be necessary
     
  12. Uncle_Joe

    Uncle_Joe Chieftain

    Joined:
    Sep 9, 2005
    Messages:
    448
    Will 11.1 'interfere' with the new naval changes they added?
     
    Leyrann likes this.
  13. Siesta Guru

    Siesta Guru Chieftain

    Joined:
    Dec 2, 2007
    Messages:
    487
    Location:
    The Netherlands
    So it shouldn't, but it could. I can only confirm that the new fall patch naval operations still run, which means it probably works. However, there may be some small interference. I've not been able to confirm a successful naval attack in testing yet.

    I'm currently testing it, but it's a rather annoying process, so any feedback is very welcome.
    Why is it annoying: For any kind of certainty I'd have to analyze like 5+ full games both with and without the mod since naval assaults are not something that'll happen every game anyway. It takes me like 5 hours to run a match and I have to actually watch it since the log files won't be clear enough.
     
    Last edited: Oct 26, 2017
  14. Lion King

    Lion King Chieftain

    Joined:
    May 24, 2015
    Messages:
    56
    Gender:
    Male
    Location:
    Russia / UK
    Hi Siesta,
    I ran several games on the autoplay mod (island plates, 8-10 players, Emperor/Deity difficulties) after the fall patch mainly without AI+ and noticed the following:

    1. Settling team behaviour:
    a) on Island maps AI settles quite far from the original homeland. This sometimes leads to crazy situations when AI set a city right next to another AI on the opposite end of the world, despite having several empty islands next to it. (I think this can be corrected easily by changing preferences to closer settlements)
    b) AI sometimes takes most of its army to accompany a settler - I think there is no limit on number of max combat units in settlement operations)

    2. Military behaviour:
    Naval assaults: I also haven't seen any city being taken by ships (I thought maybe I missed it as I don't monitor closely autoplay games).
    At the moment there are two naval actions in the game: Naval_superiority operation with its own behaviour tree and team name "City Naval Attack Force" which uses normal siege operations with condition that target should be coastal (seems that someone in Firaxis reads this thread).
    AI certainly does run Naval_Superiority operation - it builds number of ships and moves them across the oceans as coordinated groups but rarely use them in sieges, using them more as an escort formation.
    When it comes to sieges AI prefers to use land units, I see several reasons for it:
    * Naval teams have a condition of min percentage of ships just 1%. I don't know why it is so low - if AI can't get ships to the target of Naval assault, it can always use normal siege operation (there is no condition for it)
    * AI always prefers to use normal city siege operation rather than the Naval attack (not sure why)
    * Min odds of success and new unit requirement ("Must Have Units" condition) are too high - AI just can't get that many units in a close proximity to the city (this is more a general observation for both land and naval operations - I started seeing AI amassing large groups and moving them close to the border but not attacking opponent at all).

    To be honest I am not sure about this Naval Superiority thing - it is good that Firaxis tries to make AI think about escorting transport ships but this might be also preventing AI from using naval units in Naval city siege operation. I will try to change some of these parameteres to see if this will result in better naval attacks. It seems that now we got some tools for Naval AI, we just need to use them to tune the AI.
     
  15. Siesta Guru

    Siesta Guru Chieftain

    Joined:
    Dec 2, 2007
    Messages:
    487
    Location:
    The Netherlands
    Thanks Lion King!

    What you describe sounds very similar to what I've seen in the couple of games I've ran with AI+. So I suppose that, and the fact that the logs do show that the City Naval Attack Force operation is still running with AI+ sounds like a pretty good confirmation that they still work.

    I've also noticed the settler armies and mentioned it somewhere a few pages back. It seems to have started at the summer patch and it feels like they just straight out removed/broke the operation max unit limits. The minpercentage thing is new afaik and may indicate that some kind of rework happened to the whole operation team limit system. The minpercentage thing doesn't seem to do more than to just require a single unit of the type, so I don't know either why they'd be picked over just simply requiring a single unit.

    Kind of doubting the devs are reading this based on the naval operation implementation, unless they recently started. Naval operations have been a discussion point for a while.
    In case some dev does, please support a lua based override of AI behavior! Some AI related actions can be done, like moving a unit, but the AI ignores the fact a unit is already moved (even if movement points are reduced) so units move twice. Same deal with basically all other types of behavior, either its outright impossible through lua, or if it is possible, the AI will still do its own thing. The information obtainable in lua is pretty good so all it takes it better action control (movement, attacking, worker actions etc. construction, picking policies/research, diplomacy) and the ability to override AI functions to be able to do quite a lot. (a bit of documentation would also help)
    If that'd be too impactful/too much work, is some kind of lua integration possible? Perhaps we could call a lua method in the StrategyConditions, have lua integrations in custom behaviortree nodes or have some condition on operations based in lua. Any of these would massively increase the amount of things we can do
     
  16. Bate1999

    Bate1999 Chieftain

    Joined:
    Dec 22, 2010
    Messages:
    60



    Where can I find the file that has ("Must Have Units" condition) and others as I would like to mess with them myself, please?
     
  17. Lion King

    Lion King Chieftain

    Joined:
    May 24, 2015
    Messages:
    56
    Gender:
    Male
    Location:
    Russia / UK
    Original data is stored in Base/Assets/Gameplay/Data. The two most relevant files will be Operations.xml and Behaviortrees.xml. Operations is quite easy to mess up.
    However, I wouldn't recommend changing BehaviorTrees without good understanding of how the tree works - it is quite easy to break. Also don't change original files - you better use Siesta's mod and delete all files apart from military.xml. This file contains a lot of similar information on operations and teamrequirements.

    Hmm, it is possible, but because of minpercentage=1 I hardly saw any ships attacking cities in the unmodded game. I tried to amend naval superiority tree to force ships to attack cities, however it didn't work. I decided to choose another path and create minimod with additional Naval operation, also amending teamrequirements to increase presence of naval units. Now I clearly see AI building mixed naval/land forces and successfully taking cities by using ships. Would be good to try it with AI+ to see the results.
     

    Attached Files:

  18. Siesta Guru

    Siesta Guru Chieftain

    Joined:
    Dec 2, 2007
    Messages:
    487
    Location:
    The Netherlands
    Thanks! I'll give it a shot to see what happens.

    I noticed your comment that "Max is set because the AI cant handle logistics above a certain number of units"
    While that comment is generally true, there's an important setting to control this you may not have found yet. So just in case:
    In the behaviortrees there's a value set to 2 on the move units node right before they get into the attack city part (the name of the variable escapes me). This variable controls the minimum distance that units need to be at before the game allows moving past that node. It so happens that since it's set to 2, if armies get too big or if there are many mountains, it very frequently fails to get all of its units within that distance of 2. So it never moves past that node and it ends up just standing around the city with its armies while not doing anything. If you set this one to 3, it's much less likely to get stuck and ends up handling big armies a bit better.

    I also noticed you haven't included a particular fix to operations which ends up making it significantly less likely that enemies attack in the lategame. Some of the operations (the city defense and the return worker operations IIRC) dont have an operation type set. This seems to end up interfering with the maximum limit of operation types. If you slap operationtypes on them it ends up launching more city attack operations late game.
     
  19. Bate1999

    Bate1999 Chieftain

    Joined:
    Dec 22, 2010
    Messages:
    60



    Thanks for the info. Okay, so I have not look at that yet since I really do not know what I am doing yet... I wanted to know if you or Siesta Guru were planning to update the changes in one of these mods?
     
  20. Bate1999

    Bate1999 Chieftain

    Joined:
    Dec 22, 2010
    Messages:
    60
    One other thing I have never seen the AI players make any carriers all game long, are the AI players able to use carriers and can the AI players be made to at least look into getting one or two carriers?
     

Share This Page