Results 1 to 30 of 121

Thread: Game AI stuff (1.5)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Game AI stuff (1.5)

    10th anniversary update post

    A lot of my earlier posts are only semi-correct as they mostly revolve around observed symptoms of the problem rather than the root cause. I don't want to delete them but to avoid confusion it's best to skip to the most recent update post which is currently post #97, link below.

    https://forums.totalwar.org/vb/showt...post2053771349


    ######

    (Edit: This thread gets gradually more accurate as it goes on. Condensed the map path-finding results so far here: https://forums.totalwar.org/vb/showt...51#post1485851 Will make a seperate condensed post for the non-map related stuff later.)

    ######

    Tested out with a slightly modded vanilla 1.5 and then seemingly confirmed (as much as is possible) in an un-modded vanilla 1.5


    At the start of the game the AI will target one or more regions adjacent to one of its starting provinces. The number of targets depends on its starting armies and positions.

    It will always go for a rebel target first even if you set the faction's core_attitude to rebels to be lower than to a neighbouring faction (maybe not true if it is really far away and has a much larger garrison than best available faction region but very heavily weighted towards preferring rebel regions). In some cases if a faction starts at war with an adjacent faction it may *also* target a faction-held city but it's first target seems to be always rebel and usually the second target also if there is one. Generally, if a faction has a land border with a rebel region and isn't at war with another faction it will always go for the rebel region regardless of core attitudes and starting neutral to rebels.

    The initial target selection seems to be based on the number of ai stacks that have spare units after leaving behind a garrison. So each large enough stack will move to a target. If the moving units are deemed too small for a target then they move towards one of the settlements that has been targeted by a big enough stack (even if on other side of faction terriotory). The original targets are *always* the same for the same starting conditions. If none of the starting moveable stacks are deemed big enough the faction waits while it builds units. The ai rarely seems to join existing armies first and then attack. If a bunch of starting stacks move towards a target they will stop and re-assess the situation when the first one reachs and besieges it.

    If another faction targets the same province and reachs and besieges it first then if the moving faction is hostile they will often attack the besieger and start a faction war. If they are allied/non-hostile they usually sit and wait for the outcome of the siege. Sometimes the whole faction stalls at this point. Mostly the faction doesn't stall but often/usually the stack that moved to the target will stall, even if the the other faction loses its assault and the target becomes free to attack later. The stack will eventually unstick but it may take many turns. This can cripple a faction if it is a small faction's main force.

    Also if the attacking stack reaches its target and loses its assault then that stack will often stall until something else happens to unstick it. Small factions with only one initial moving army will then be stuck until they build a new force or another force that was already moving to the target sieges it. Small factions can be completely stalled by this too.


    The determinants of target regions:

    1) Size of ai stack after leaving behind a garrison
    2) Distance
    3) Target garrison
    4) AI attitude to faction_creator specified in descr_strat e.g can make ai switch choice between intiial target if faction is allied to faction-creator of one target and hostile to faction_creator of a another.
    5) Clear line of sight between settlement/stack and target settlement. This doesn't mean FOW, spies etc *seeing* the settlement. It seems to require an unblocked straight line between stack/settlement and settlement. Hills, mountains, wonders block this, maybe woodland too.

    How the determinants balance against each other is too hard to work out i.e how important faction_creator is compared to garrison size etc. All i can be sure of is one ai faction would always go for the closer of two rebel settlements (with the exact same garrison) if both targets had the same faction_creator but would always target the further one if i made the faction_creator of that city a faction they were more hostile to.


    The factor that outwieghs all the others is LOS. If there are low hills etc between a target city and all the adjacent faction regions/stacks then they will ignore it completely at game start. This is not surprising when you consider that unconquerable settlement mods do it by surrounding the settlement with hills. (Didn't occur to me until i saw it though.)


    Palmyra on the vanilla map is an example of this. Factions don't seem to target it unless they already have arabia or bostra. The hills between palmyra and the starting positions in the other adjacent regions seem to prevent it being targeted.

    The vanilla seleucids are a good example of how this effects the game. They don't attack the obvious targets of Halicarnasus or Palmyra early on. Halicarnasus because the nearby stack isn't big enough, Palmyra because they don't have a clear LOS (placing spies at start does't help this). So the region they select as their first target is dumatha/arabia because it is closest (in a straight line not in the amount of time it takes to reach) from their stack in seleucia. Because it is so far away from the start location of the seleucid units by the time they get a stack close to attacking it Parthia has usually already got there and egypt, pontus and armenia have already expanded and started to look for new targets.

    This initial target selection cripples the seleucids from the start and makes the big yellow steamroller almost certain every game. Re-arranging the initial seleucid start location to either make the garrison at sardis big enough to move against halicarnasus or placing some seleucid units on the other side of the hills so they see and target palmyra makes sure the seleucids have a good chance of grabbing those two regions before the inevitable multiple attacks start. Usually you still get a big yellow steam roller but it takes a lot longer and isn't a foregone conclusion.


    Anyway, from a general modding point of view some suggestions.

    1) Always have an island or remote faction somewhere for testing how the ai performs.
    2) Run the game with FOW off and find each factions starting targets, then watch for:

    a) Factions picking a target very far away because of LOS issues.
    b) Starting stack just big enough to target a rebel city but too small to consistently win the siege. Small factions may stall here.
    c) Small starting stacks that set off for a target city regularly hitting rebel stacks that are too big to defeat or which cause too many casualties. Sometimes the ai stack will stall here, sometimes it may go on to lose the siege (cos of casualties from rebel battle) and then bounce off and stall.
    d) Two factions picking the same initial target and then getting into an early war because of it.
    e) Generally, small (and possibly all) factions will start off better if set up with one main army and several small garrisons rather than lots of small armies as they seem to decide what to do on a per stack basis and lots of small armies will assault, lose and stall a lot.

    The other big ai problem is path-finding.

    After fixing any problems with the ai faction's initial targeting run some long games with your island test faction where you just click end turn a lot and watch for those regions the AI has trouble reaching. Any kind of impassable terrain can cause the ai problems often depending on what direction they are expanding from, river crossings, mountains, hills, wonders etc. Sometimes it will be fine from the region to the west of a target but not the south etc. Simple map tweaks can often fix these. Eventually you'll get a situation where the AI stalls far less often which will make the game a lot more challenging i think.

    A seemingly surefire way to know a faction has a path-finding problem is if you see a large cluster of single-unit stacks not moving over a number of turns. Working out why it is stuck is another question :) Sometimes it is obvious though.

    Core-attitudes, "prefers naval invasion" etc

    These seem to have limited (or very limited) effect. The reason seems to be that initially the ai will target rebel regions. Eventually they'll run out (though you can deliberately make them ignore some regions by moving the settlement far away) and then they'll decide to attack somewhere else. Core attitudes etc may play a part here although the main determinant seems to be relative strength/weakness. However once a war starts between two factions both sides seem to give massive weight to any adjacent enemy region until the war ends. At that point core-attitudes etc may briefly come back into play again until the next war starts. (Maybe if a core-attitude is set to be 600 i.e the same as being at war it will have more effect).

    In other words the core attitudes have an effect but only really when the ai faction is at peace and thinking about its next move.

    The ai will mostly make naval invasions when it doesn't have an available land target. This happens mostly when they are blocked in by allies/protectorates that they don't want to attack. In this case they'll land quite far away if neccessary. Some landings never seem to take place from certain directions (LOS again i think) e.g factions holding greece never seem to land on crete, though they will on cyrene occasionally, whereas egypt will land on crete sometimes if they get blocked in by alliances. Again, i *think* it is to do with the hills/mountains from different angles. One settlement will have a clear LOS to a region while another won't so only a faction holding the right regions will consider it. There does seem to be a distinction here between whether the region is rebel-held or faction-held. Rebel regions with no clear LOS from anywhere (like the original iberian capital if it goes rebel) can remain rebel the rest of the game, whereas if it is faction-held it is less likely.

    The presence of the senate over-rides some of these problems in the vanilla game. Also the 3-family split makes the romans consider naval landings more because the scipii and brutii are blocked in from the start by their roman allies. A unified roman faction has more problems because it is not blocked in unless it makes an ally/protectorate of the gauls.

    (I haven't got BI as none of my fave mods use it yet but i wonder if they've simplified the LOS between regions and that is what improves the ai.)


    Some simple regions/settlements modding stuff that works.

    1) Make a huge sahara that touchs the sea between egypt and carthage terriotory so their border region lies along the sahara edge. Then move the sahara settlement so that it is a long way west but close to its northern border with the coastal african regions. The distance between settlements east/west makes carthage/egypt ignore each other completely but the settlement is still close enough to the coast for any faction that holds one of the coastal regions to target sahara (or move it to bottom left corner so both carthage and egypt ignore it and let it stay rebel).

    2) Have long vertical steppe regions with the settlements in the far north. The short distance between settlements east/west makes the steppe factions fight over them but the large distance north/south makes the armenians (for example) ignore them and expand south instead. The steppe factions will still come south when they run out of targets and the settled factions will still come north if they conquer all the southern regions but not until they have no closer alternative targets. Otherwise factions like the armenians waste their time (imo) sending infantry armies (very very slowly) way up north instead of fighting over richer southern terriotory.

    3) After watching where the ai gets stuck with rivers, add a ford.


    General things:
    Read somewhere the ai never moves its capital. It does in 1.5

    The settlements of regions specified in the victory conditions are visible when playing that faction (which is neat imo).
    Last edited by nikolai1962; 01-03-2018 at 19:22.
    It's not a map.

    Member thankful for this post:



  2. #2
    Finder of Little Oddities Senior Member Makanyane's Avatar
    Join Date
    Jan 2006
    Posts
    2,220

    Default Re: Game AI stuff (1.5)

    Great research, thanks for this.

    Hadn't realised importance of faction_creator, will have to re-look at our descr_strat!

    Re: pathfinding, do you know if there tend to be more problems with large blocks of impassable terrain or with scattered obstacles?

    Re: BI, unforunately can't remember vanilla results but have since been playing with adapted Icetorques/Bare Bones map (which is much larger than vanilla) map and AI factions don't seem to target rebel provinces in Norway/Sweden peninsula or Ireland (200 turns plus & all other provinces occupied).
    Not used mods before? Looking for something small and fun?!
    Download the:

  3. #3

    Default Re: Game AI stuff (1.5)

    faction creator is in the descr_regions - the faction creator in the strat just takes care of the way the province looks on the strat map/battle map - i have been using a combination of victory conditions and region creator yo guide the ai into where i want it to attack from the start. it works very well (i dont have any rebel provinces in at the moment to make things complicated)

    works well :)

  4. #4

    Default Re: Game AI stuff (1.5)

    Quote Originally Posted by shaggy1973
    faction creator is in the descr_regions - the faction creator in the strat just takes care of the way the province looks on the strat map/battle map - i have been using a combination of victory conditions and region creator yo guide the ai into where i want it to attack from the start. it works very well (i dont have any rebel provinces in at the moment to make things complicated)

    works well :)

    I'll check this again as i have a habit of changing the creator in both regions and strat so they match.
    It's not a map.

  5. #5

    Default Re: Game AI stuff (1.5)

    Great research!
    This will be very useful:)
    Thaanks


    The Fourth Age: Total War - Map Manager, Editor and Coder

  6. #6

    Default Re: Game AI stuff (1.5)

    the ai isnt obsessed with rebels. ive put alot of rebel factions along the border of gaul and they still come for italy. need to use province owner/creator and victory stats and they still go where you want them to. oh and the rebel garrisons are all really strong.

  7. #7

    Default Re: Game AI stuff (1.5)

    Quote Originally Posted by Makanyane
    Great research, thanks for this.

    Hadn't realised importance of faction_creator, will have to re-look at our descr_strat!

    Re: pathfinding, do you know if there tend to be more problems with large blocks of impassable terrain or with scattered obstacles?

    Re: BI, unforunately can't remember vanilla results but have since been playing with adapted Icetorques/Bare Bones map (which is much larger than vanilla) map and AI factions don't seem to target rebel provinces in Norway/Sweden peninsula or Ireland (200 turns plus & all other provinces occupied).
    I'm going to experiment more both with the path-finding and the target selection but at the moment it seems like the ai tries to figure a straight line path and doesn't like situations where they have to move away from a target to reach it e.g going round a big block of dense forest or moving along a river to a ford if it means getting further from the target.

    Some rebel regions can stay rebel for sure. All the ones I've seen so far are either islands or have some other path-finding issue. Garrison size and distance must be (?) taken into account too but i think the anti-rebel priority is quite high so the distance/garrison need to be large to outweigh this.
    It's not a map.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO