Results 1 to 15 of 15

Thread: AI Generals: using, behavior, armies...

  1. #1

    Default AI Generals: using, behavior, armies...

    Hi


    How does AI use his generals?
    I have noticed that AI prefers not to use his generals on strategic map when he has enough troops - he uses his captains instead.
    The generals just sit in their towns and castles during a war.
    Is there any way to make AI use his generals more often?

    What does control AI generals' behavior in a battle?
    Also I have noticed another thing - it is quite often that AI general charges with the rest of his troops and dies after first minute of fighting.
    How can I change AI generals behavior to make it more careful?
    How can I make him retreat when it is obvious that he is loosing?

    How does AI build his armies?
    It is quite irritating when half of strategic map is covered with hordes of little "armies" led by faceless captains.
    How to make AI build big strong armies led by generals?


    I would be grateful for any kind of help, thank you.

  2. #2
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: AI Generals: using, behavior, armies...

    Moved from text editing workshop










  3. #3

    Default Re: AI Generals: using, behavior, armies...

    1. You cannot, at least no one has yet found a way. AI will spawn Generals if needed to lead smaller armies but for whatever reason will generally not use them for 'real' armies.
    2. Mostly it's due to the fact that generals units have 2 hp, the AI over-estimates how powerful that makes them (this is also why the AI tends to keep only generals in towns for a garrison.) Additionally config_ai_battle can be modified to make all cavalry more cautious, which will effect the general
    3. It's rather complicated really. The AI will recruit whatever, then assemble armies. Most of the 'little "armies" led by faceless captains' are trying to assemble into a coherent force influenced by the personality in descr_strat, but has a tendency to recruit whatever is available, which leaves many units that are not immediately needed for an army. Modding descr_character.txt:
    Code:
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    starting_action_points 11999 ; default value for all characters and pathfinding calculations
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    and making sure the AI dose not use defend_raid or invade_raids in the descr_campaign_ai_db.xml will help but not fix the problem. For the best results Generals and Captains should have just enough movement to go from one settlement to any given neighbor settlement. Obviously this is nearly impossible, modding the map is pretty much essential to help this, but you will never be able to fix it completely.

  4. #4

    Default Re: AI Generals: using, behavior, armies...

    For the best results Generals and Captains should have just enough movement to go from one settlement to any given neighbor settlement.
    So as I understand it the main problem for scattered squads is that they are unable to gather due to the big distance between settlements... Thank you very much, I'll try to manage it with mapping.

  5. #5
    bitterhowl's Avatar Campidoctor
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    1,695

    Default Re: AI Generals: using, behavior, armies...

    Quote Originally Posted by siebenbürgen View Post
    Hi


    How does AI use his generals?
    I have noticed that AI prefers not to use his generals on strategic map when he has enough troops - he uses his captains instead.
    The generals just sit in their towns and castles during a war.
    Is there any way to make AI use his generals more often?
    Did anybody solved this?

    My sister, do you still recall the blue Hasan and Khalkhin-Gol?
    Russian warship is winning. Proofs needed? Go find yourself!

  6. #6
    z3n's Avatar State of Mind
    took an arrow to the knee

    Join Date
    Aug 2011
    Posts
    4,640

    Default Re: AI Generals: using, behavior, armies...

    Not that I know of, I suspect invade_buildup decision would be the most likely to create an opportunity for the AI to pull a general out of a town and use them instead but you can't really prove that.


    Invade_immediate is the most aggressive and one I like to use most. M2TW AI at *minimum* will take 2 turns to attack an undefended town that it can reach by going outside of its own town.

    First it has to hop out of its own town, sit there for a turn, then next turn it will move toward it if it doesn't wait for reinforcements first by moving to its own border of the enemy town and waiting.
    The AI Workshop Creator
    Europa Barbaroum II AI/Game Mechanics Developer
    The Northern Crusades Lead Developer
    Classical Age Total War Retired Lead Developer
    Rome: Total Realism Animation Developer
    RTW Workshop Assistance MTW2 AI Tutorial & Assistance
    Broken Crescent Submod (M2TW)/IB VGR Submod (BI)/Animation (RTW/BI/ALX)/TATW PCP Submod (M2TW)/TATW DaC Submod (M2TW)/DeI Submod (TWR2)/SS6.4 Northern European UI Mod (M2TW)

  7. #7
    bitterhowl's Avatar Campidoctor
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    1,695

    Default Re: AI Generals: using, behavior, armies...

    As for battle behavior - making general avoid attack is making by this parameter

    Code:
    <melee-manager>
    
    <open>
              
          <general_unit>
                    <max-engage-dist>10</max-engage-dist>
                </general_unit>

    My sister, do you still recall the blue Hasan and Khalkhin-Gol?
    Russian warship is winning. Proofs needed? Go find yourself!

  8. #8
    bitterhowl's Avatar Campidoctor
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    1,695

    Default Re: AI Generals: using, behavior, armies...

    Here are results of hotseat method tests of my Westeros submod AI. Turn 300+
    Spoiler Alert, click show to read: 

    Another test turn 200+
    Spoiler Alert, click show to read: 







    Another test
    Spoiler Alert, click show to read: 




    Looks like plenty armies or reds but it's their last regions


    Blue are defeated and are vassals of browns

    Active warfare here)


    Yellow are defeated and vassals of browns too

    Most active actions are here

    And here all is done


    So we can see many armies led by named_characters. I use beermugcarl's recomendations about fixing general's behavior. AI that I use in my submod is mixture of PiterAI and beermugcarlAI + my manual fixes.
    Last edited by bitterhowl; May 19, 2020 at 06:34 AM.

    My sister, do you still recall the blue Hasan and Khalkhin-Gol?
    Russian warship is winning. Proofs needed? Go find yourself!

  9. #9

    Default Re: AI Generals: using, behavior, armies...

    So we can see many armies led by named_characters. I use beermugcarl's recomendations about fixing general's behavior.
    Bitterhowl, could you post a link to these recommendations please?

    BTW, do you know guys what make the ai use generals in its armies in a smarter way? I have some of the armies without any generals and then other armies with 2 or more generals. Is there any way that would make ai have all the big armies with generals?
    Last edited by Macaras; May 08, 2022 at 05:08 PM.

  10. #10
    bitterhowl's Avatar Campidoctor
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    1,695

    Default Re: AI Generals: using, behavior, armies...

    Quote Originally Posted by Macaras View Post
    Bitterhowl, could you post a link to these recommendations please?

    BTW, do you know guys what make the ai use generals in its armies in a smarter way? I have some of the armies without any generals and then other armies with 2 or more generals. Is there any way that would make ai have all the big armies with generals?
    https://www.twcenter.net/forums/show...ht=beermugcarl

    My sister, do you still recall the blue Hasan and Khalkhin-Gol?
    Russian warship is winning. Proofs needed? Go find yourself!

  11. #11

    Default Re: AI Generals: using, behavior, armies...

    Hello,


    Any news about these recommendations?
    I tried to create a hidden trait like beermugcarl according to the difficulty level of the campaign but my trait is engaged at each whatever the difficulty level..


    my edct file :
    Spoiler Alert, click show to read: 

    ;------------------------------------------
    Trait General_AI_Boost
    Characters family
    Hidden

    Level Hidden
    Description Hidden_desc
    EffectsDescription Hidden_effects_desc
    Threshold 1


    Effect Command 2
    Effect TroopMorale 1
    Effect LineOfSight 4
    Effect HitPoints 2
    Effect MovementPoints 20
    Effect Combat_V_Faction_Slave 5
    Effect SiegeEngineering 20




    ;------------------------------------------
    Trigger General_AI_Boost_Medium
    WhenToTest CharacterTurnStart


    Condition I_EventCounter DifficultyLevel = 2
    and IsGeneral
    and not FactionIsLocal


    Affects General_AI_Boost 1 Chance 100

  12. #12
    z3n's Avatar State of Mind
    took an arrow to the knee

    Join Date
    Aug 2011
    Posts
    4,640

    Default Re: AI Generals: using, behavior, armies...

    You need a campaign script with a check for difficulty level.
    The AI Workshop Creator
    Europa Barbaroum II AI/Game Mechanics Developer
    The Northern Crusades Lead Developer
    Classical Age Total War Retired Lead Developer
    Rome: Total Realism Animation Developer
    RTW Workshop Assistance MTW2 AI Tutorial & Assistance
    Broken Crescent Submod (M2TW)/IB VGR Submod (BI)/Animation (RTW/BI/ALX)/TATW PCP Submod (M2TW)/TATW DaC Submod (M2TW)/DeI Submod (TWR2)/SS6.4 Northern European UI Mod (M2TW)

  13. #13
    Jadli's Avatar The Fallen God
    Gaming Emeritus

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    8,528

    Default Re: AI Generals: using, behavior, armies...

    BTW, one note to making difficulty scripts, not sure if I already posted it here somehwere...

    Its applies only to a faction, not campaign wide, all other factions are on normal. Which can be issue especially in hotseat mode (and thus also for testing). Not sure if in SP the difficulty you set applies for the AI or not... but its definitely the best for if you are creating the DifficultyLevel on turn 1, to check it only during the first faction, and then terminate it.

  14. #14
    bitterhowl's Avatar Campidoctor
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    1,695

    Default Re: AI Generals: using, behavior, armies...

    Oh, and how about descr_campaign_ai_db and difficulty condition?

    My sister, do you still recall the blue Hasan and Khalkhin-Gol?
    Russian warship is winning. Proofs needed? Go find yourself!

  15. #15
    Jadli's Avatar The Fallen God
    Gaming Emeritus

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    8,528

    Default Re: AI Generals: using, behavior, armies...

    What condition?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •