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 Re: Game AI stuff (1.5)

    Just a '2 cents' worth on my part, and a thanks to all those who contributed to this thread.....one of the things I really 'took up on' from the ideas in here was the problem of the AI factions being able to 'see' the target they were interested in, and their ability to continue 'seeing' it. I've been working on a Mod for quite some time, on the Mundus Magnus3 map, and was not happy with the way the AI was building hundreds of little stack of armies, sending them off somewhere, and then stranding them all there forever. This was particularly evident in Egypt's case, as they tried going after the few Rebel settlements in Arabia after they too Petra. They build close to 40 little 1/3 to half stack armies, sent them off into Arabia, and stranded so many there they had to move around to make room for each other. Not one ever continued on to a target.
    I corrected this by changing the 'starting_action_points' in descr_character.txt from the default 80 to 160. This one small change eliminated all the little stacks and impressed upon me that the AI was originally 'seeing' it's target from a settlement across the Red Sea...a short distant....but when the stacks got up and just past Petra, they lost 'sight' of whatever it was they were sent to attack.
    Oddly enough (and I had always wondered about this, the doubled distance had no adverse affect on anything. The AI could move further, but they still had 'objectives' and didn't pass them up because they could. Also, I saw a tremendous increase in creation of FULL stacks. This leads me to believe that all the 'stuck' little stacks are actually 'destroyed' as far as the AI knows, which explains why they never merge into bigger stacks.
    So I would advise that at the very least, this single value should be increased greatly, especially on the very large maps. I currently have a setting of 200 on the Europa270 map, and it works fine...the AI even manages to get past the 'bendy' roads without too much difficulty.
    "...then came the ensigns encompassing the Eagle, which is at the head of every Roman Legion; the King, and the strongest of all birds, which seems to them a signal of dominion, and an omen that they shall conquer all against whom they march....." Flavius Josephus

  2. #2
    TW Modder Since 2005 Member DaVinci's Avatar
    Join Date
    May 2005
    Location
    Hamburg, Germany/EU
    Posts
    848

    Default Re: Game AI stuff (1.5)

    Hi nikolai, you're leading (and has initiated) a great AI behaviour thread, keep it up.
    Monkwarriors threads/observations are as well very true.

    I still can remember as we discussed a few similar things, as you played my RTR submod MRR, and i always was searchin' out ways to balancing + AI-finding its historical preferred targets on the campaign map.

    So i give as little addition my 2 cents atm. only as short hints (as i have not the time to discuss/describe in a full length, or give examples).

    I'm pretty convinced that the AI behaviour has still more parameters/influences to decide where it goes, than the one mentioned in all above threads.

    - One of them is, that you can lure the AI into certain regions (to have interest to conquer), if they get certain advantages through the tech-tree codes (requirements) plus in addition with hidden_resources, ie. exp boni, moral boni, especially any kind of income boni, or just the possible recruitment of units/buildings that would give a significant advantage or disadvantage to potencial enemies, and also to provoke wars in this relation or a rather peaceful behaviour.

    - Second, with descr_regions codes, just due to these hidden_resources, and due to the initial farming income, with the possible harvest codes.

    - In this relation, the start setting of descr_strat, available buildings per region with the possible or impossible recruitment of certain units and the start money, influences the expansion-ability immense (just an important balancing campain part).

    - And i just think, the different AI characters have an, not decisive, but quite important influence, initially rather or especially with the diplomatic behaviour.

    ... maybe i have more thoughts, but not atm., brain-dead due to modding burn-out syndrome.
    Last edited by DaVinci; 10-24-2006 at 08:04.
    TWC Wiki: List of TW Modding Contributions 2005-2011
    Release 12.2012: Third Age TW Realism+
    Release 04.2013: Rise of the Samurai Realism+


    Support: Greenpeace
    LIVING ...WITH... WAR
    What's really more disappointing than dis-information and non-education?
    A certain degree of intentional ignorance paired with obvious stupidy /DV

  3. #3

    Default Re: Game AI stuff (1.5)

    Apologies for not replying to these posts--especially Monkwarriors very detailed one. I accidentally over-wrote the folder I had all my test stuff and my (2/3 perfectly working) vanilla map in and gave up Rome modding for a bit from the shock

    Very interesting posts.

    I did have two conclusions from this earlier experience, one of which mirrors shaggy's, for things you can do which are relatively easy and yet help the AI a great deal in many cases.

    1) Region Boundaries.
    The AI often has path-finding problems when a region has traversable terrain that can't be reached without leaving the region. For example some fertile tiles on the other side of a river without a ford. Simply changing region boundaries can fix a lot of situations where the AI gets stuck through path-finding problems.

    As I'm back modding RTR to suit my preferences I've started doing simple map fixes like this as i see them, (can't stand the thought of all the hours fixing the harder ones lol), and it definitely works without taking too much time.

    I'll take and post some example screenshots of the sort of situations I mean in a bit. It can really make the game much better when the AI is operating as intended and it doesn't take long.

    ~~~

    There are much more tricky ones that involve the situation where somewhere along it's path an AI stack would have to move further away from it's target than where it currently is e.g it is close to a city but with some impassable terrain in the way so it would have to move away from the target to get round the impassable terrain. A good example of this is the bit of land approaching the chersonesus area from the east. AI armies tend to get stuck in that corner instead of going backwards to cross the ford. These problems take a lot of trial and error making terrain changes and testing and are a total pain in the arse. However the region change mentioned above could improve a map by about 50% with minimal effort.


    2) Movement Bugs
    There is definitely a bug where if an AI stack loses a battle and retreats they can sometimes get stuck in that spot. This is related to path-finding in some cases but not all. They can definitely get unstuck in many cases when their movement potential changes e.g if the target region builds roads or they get a movement bonus trait.

    This bug effects roman and greek culture factions less than others because they get a movement trait that triggers from being outside a city (which a stuck army often is).

    Either the problem is related to the total movement points they have, or the AI re-calculates the stack's movement when it's movement potential changes, possibly both. There are two things, either or both of which are definitely worth doing if you are creating or trying to improve AI performance on your map.

    a) Try different amounts of movement points. Personally i don't think higher movement points is the solution as such to the post-retreat bug--I think it depends on the scale of your map. In some cases higher movement points will just mean the AI armies get stuck further away from their target (as they'll retreat further). However I think it will fix other path-finding problems as the AI seems to have less problems when it can reach it's target in one turn.

    As DVK's post mentions if you see the AI with a lot of small stacks clustered together and not moving much then it is always a sign that the faction has a path-finding problem or a stuck army problem. If the faction gets over the problem the AI will combine those stacks and move them to their next target. In his case I think the higher movement points fixed some normally recurring path-finding problem so that the faction didn't get stuck in their normal place. (The multi-stack thing is a symptom rather than a problem in itself.)

    (There are two semi-exceptions to the always. One is if they are land-blocked and have no naval expansion route. In this case they have the same problem. They are stuck. And the same symptom--lots of small stacks standing around. But in this case they cluster around their capital and not around the problem region. The second semi-exception is when they are land-blocked and have a naval expansion route but no ships. In this case the small stacks cluster near the region they'd launch their invasion from if they had a ship.)


    b) Have a trait that adds and removes movement points regularly e.g a winter/summer trait. The constant changing of their movement potential each turn (or each season if you are using 4TPY) may unstick them if indeed the AI re-calculates stuck stacks when their movement changes. Either way it will help in some cases as the extra summer movement points will fix some stuck armies if it means they can then reach their target in one turn.


    I'm not very good with traits personally so if anyone knows of a mod that adds movement in summer turns and subtracts in winter turns I'd be pleased to know of it (so I can steal the code for my mod :) )

    Apologies again for not replying for so long.
    Last edited by nikolai1962; 11-28-2006 at 07:22.
    It's not a map.

  4. #4

    Default Re: Game AI stuff (1.5)

    Hi everybody, I'm new in this forum. I'd like to know whether there are any discussions about the AI behaviour with diplomacy
    I don't know of any discussions as such. The AI diplomacy is not very good imo. One thing that seems to be true when i play is that the stronger you are militarily the more reluctant the AI is to attack you. The other thing is if you have enough cash you can get the AI to agree to anything. The second however is semi-pointless as if you have that much money then you could probably bribe all their cities/armies. You can't really use diplomacy as an *alternative* strategy as the amount of cash it requires would enable you to blitz the map anyway.

    If you see what I mean.
    It's not a map.

  5. #5

    Default Re: Game AI stuff (1.5)

    Forgotten how to take screenshots, so some other AI stuff


    d) One additional requirement for sea invasions is that the AI must have ships in the suitable positions, preferably one float near the boarding zone and one near the landing zone... ...it is important the synchrony between trips of the floats and troops creation. If ships are delayed and the troops are ready, they start to move trying to find a land route to the target. In our case the target is so far that they don’t find a way and return to the boarding point, although boarding is then delayed.
    This can cause permanent stalls too where the armies and fleets are permenently out of step e.g armies in carthage looking for ships while the ships are by icosium waiting for the armies, then after a turn the armies move to icosium and the ships move to carthage. Then back and forth like that for ages.

    I wanted to create a free upkeep ship and spawn one every 20 turns or so to see if it got round this bug. Not sure if you can spawn ships though.


    ~~~

    c) Another important dissuasion factors are walls. Their widespread presence dramatically reduces the aggressiveness of the AI. For a more dynamic campaign, it is necessary to limit walls, both at the beginning (descr_strat) and along the campaign (higher settlement requirements and prices).
    This works the other way too. *Lack* of walls makes the AI more aggressive. So, for example, if you mod a faction to not be able to build walls then the other factions are much more aggressive to them.

    Walls, or the lack of them also effects the size of garrison the AI leaves behind (especially at game start it seems). So if you remove walls from a faction the AI will want to leave a much larger higher percentage of it's starting units behind on the first few turns.

    ~~~

    4- Behaviour parameters

    Finally this parameter seems to have an influence more important than expected. One faction limited by an allied superfaction cannot have the attributes “Caesar”, “Genghis” or “Napoleon” because it will attack to the neighbour superfaction. It seems that parameters such as “smith” or “stalin” are more suitable, as better equilibrium between economy and aggressiveness is obtained. The parameter “sailor” is devoted to ship building, but it doesn’t promote sea invasions.
    I need to look at this more. I thought they only effected build priorities.

    (May however be an indirect side-effect of what type of units they build--see "AI and cavalry" below)

    ~~~

    Some new stuff from trying to make the sarmatians less passive in RTRPE.


    AI and cavalry

    I always thought the AI wouldn't siege if they had an all-cavalry stack but they do. They even build siege equipment although they never use it as they can't assault. They will wait out the siege instead. They very rarely do it because of the way the AI calculates the strength of stacks.

    Numbers count for a lot. Large units are important and cav units are generally smaller. Also it seems high missile attack ratings are wieghted much lower than high melee attack ratings. What this means is that horse archer type factions have a huge differential between how strong their stacks are for auto-calc compared with how strong they are when a player uses them in a battle.

    This doesn't only affect their chances in auto-calc though--it also decides their expansion behaviour. They won't initally attack a target if they calculate the garrison to be too strong for them. (This seems to be initially only. Once they have decided to attack a settlement they'll keep attacking with very weak armies but initially the relative strength of the garrison and their own armies affects them.)

    So cavalry-heavy armies and especially horse-archer factions will be extremely passive unless you give them infantry units too or make the cavalry units much larger etc.

    If you want to set up a faction as primarily horse archer with few or no native infantry units then one thing you can do is create a second version of their standard horse archer unit. Make them unbuildable, max size and zero upkeep and then spawn a bunch of them with a campaign script for AI only. Tweak the number of units until a starting army moves to attack a nearby rebel settlement. (If there's enough of them they will siege.) As they are unbuildable the AI won't get any more and as they lose men taking the rebel settlements they don't unbalance the faction long-term. Eventually they'll take some regions with AOR type infantry so they'll have a chance to expand normally after that.

    This way you can have a very interesting faction for the player, with a very different style (as at the start they have tiny all-cavalry armies) but at the same time the AI version of the faction isn't totally passive.


    ~~~

    Creating campaign timers.

    Inspired by a thread on the EB forum and Monkwarriors stuff on superfactions.

    1) As mentioned the AI is influenced by the strength of garrisons/walls etc whether or not to attack. The strength calculation is very influenced by sheer numbers of enemy soldiers and their melee attack rating.

    2) A number of mods set up immoveable rebel garrisons by having a starting general with a trait that prevents movement.

    3) Normally, if a rebel garrison is very large and their movement is not inhibited by a general's trait they'll move out of the city leaving only a small contingent behind.

    So, by having a very large immobile rebel garrison and tweaking the starting general's age you can create a kind of timer to influence AI expansion.

    For example, you could have some rebel cities where the general is 16 and others where he is 50. If the stack is huge enough to guarantee the AI won't attack then that region will remain as a buffer zone for a very long time. If the starting general's age is set to 50 then it will be shorter.

    I was thinking if you had Messana and Saguntum for example set up as rebel with a strong garrisons, romans as faction creator and a high unrest setting (the "chance" field in descr_rebel_factions.txt), you could set the two general's ages to x number of years before the historical roman intervention in Sicily/Iberia. The general would die at some randon time close to this date, the army would move out of the city meaning nearby factions were more likely to target it. Eventually they'd take it and the unrest number would make a revolt to romans likely. Hence providing the reason for naval re-inforcements.

    (probably easier ways to do this with script)
    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