Page 8 of 11 FirstFirst 1234567891011 LastLast
Results 141 to 160 of 204

Thread: Understanding MTW2/Kingdoms.exe Pathfinding, XML and the AI

  1. #141
    z3n's Avatar State of Mind
    Moderator Emeritus

    Join Date
    Aug 2011
    Posts
    4,640

    Default Re: Understanding MTW2/Kingdoms.exe Pathfinding, XML and the AI

    @CavalryCmdr/@Granto (or anyone else who wants to theorize on this point)

    After you said that distance plays a role in the AI's attacks I've been forming a theory as to what could possibly control that (other than invasion priority), I've come to suspect that the 'pathfinding calculations' within the descr_character file could play a large role. I'm curious whether any of you have seen different invasion behaviour (targets/settlements) after changing this value? I have but I'd really prefer having some outside input.
    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)

  2. #142
    GRANTO's Avatar Domesticus
    Join Date
    Dec 2010
    Location
    glastonbury uk
    Posts
    2,207

    Default Re: Understanding MTW2/Kingdoms.exe Pathfinding, XML and the AI

    Quote Originally Posted by z3n View Post
    @CavalryCmdr/@Granto (or anyone else who wants to theorize on this point)

    After you said that distance plays a role in the AI's attacks I've been forming a theory as to what could possibly control that (other than invasion priority), I've come to suspect that the 'pathfinding calculations' within the descr_character file could play a large role. I'm curious whether any of you have seen different invasion behaviour (targets/settlements) after changing this value? I have but I'd really prefer having some outside input.
    movement points for the AI are like its eyes,it can see to the full range of its movement points on the campaign map.

  3. #143

    Default Re: Understanding MTW2/Kingdoms.exe Pathfinding, XML and the AI

    Sorry I've not been around. Spring to Fall I am very busy and do not spend much, if any, time on the computer, nevermind the internet.

    More specifically I think it's the default movement point:
    Code:
    starting_action_points 11999 ; default value for all characters and pathfinding calculations
    Which is another reason that the AI works better with these settings, there is basically no target they cannot 'see.' Note that the AI is oblivious to some factors, such as not being able to pass through ZOC unless it's within it's immediate movement (apparently it's designed to anticipate ZOC moving, which to an extent makes sense as most ZOC are mobile armies.) This is why 'choke points' on the map can cause AI armies to simply move back-and-forth rather then go around of force it's way through. This is also why towns should be placed with an extra 'square' around them and any obsticles, most specifically the coast as an AI will not hesitate to land an army in a ZOC area, but, if there is more then one step to a ZOC free space, the army will simply sit there and wait for the ZOC to move which, if it's a town, obviously is not going to happen.

  4. #144

    Default Re: Understanding MTW2/Kingdoms.exe Pathfinding, XML and the AI

    This is amazing and in-depth, it will take some time to get a handle on this information.

  5. #145

    Default Re: Understanding MTW2/Kingdoms.exe Pathfinding, XML and the AI

    I'm sorry if this is not the place to post the message; if so, I'll delete it and look more closely.


    Which is right now the best AI that could be installed to a mod? It's clear that anyone will be better than vanilla... but what works best in your experience?

  6. #146
    z3n's Avatar State of Mind
    Moderator Emeritus

    Join Date
    Aug 2011
    Posts
    4,640

    Default Re: Understanding MTW2/Kingdoms.exe Pathfinding, XML and the AI

    The files included in EBII are pretty good http://www.twcenter.net/forums/forum...-Barbarorum-II (they are mine though so I'm biased)



    For battle AI: other AI mods (3) are by Taijii, Germanicus and XAI.

    For campaign AI: CavalryCmdr may have released a mod (but I believe he mainly only wrote tutorials which are *very* helpful but not on twcenter they are on heavengames), there is also one by GrandVizier, an XAI one and one by Piter.
    Last edited by z3n; February 20, 2018 at 03:15 PM.
    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. #147

    Default Re: Understanding MTW2/Kingdoms.exe Pathfinding, XML and the AI

    Thank you!

    1) And the best one to add to my own mod?
    2) Are them free to use?
    3) And easy to implement?

    Thank you!

  8. #148
    z3n's Avatar State of Mind
    Moderator Emeritus

    Join Date
    Aug 2011
    Posts
    4,640

    Default Re: Understanding MTW2/Kingdoms.exe Pathfinding, XML and the AI

    All the implementing part is means copying and pasting certain files contents into your own.

    I have a walk through of how to do it here, and a possibly updated version of the battle and campaign AI.
    http://www.twcenter.net/forums/showt...5596-Skynet-AI
    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)

  9. #149

    Icon5 Re: Understanding MTW2/Kingdoms.exe Pathfinding, XML and the AI

    Is there some more explanation how each of these particular parameters below actually influence AI?
    The values vary wildly across the mods, hence the question. And does it also affect CAI?

    config_ai_battle.xml
    Code:
            <battle-analyser>
    1.            <!-- ratio of friendly to enemy strength to be considered more powerful -->
                <friendly-to-enemy-strength-ratio>1.0</friendly-to-enemy-strength-ratio>
    
    
    2.            <!-- ratio of friendly to enemy melee strength to be considered overwhelmingly powerful -->
                <enemy-melee-strength-multiplier>2.0</enemy-melee-strength-multiplier>
    
    
    3.            <!-- ratio of friendly strength to enemy melee strength to force attack -->
                <friendly-melee-strength-divisor>0.9</friendly-melee-strength-divisor>
    
    
    4.            <!-- ratio of enemy to friendly ranged strength to be considered overwhelmingly powerful -->
                <friendly-ranged-strength-multiplier>3.0</friendly-ranged-strength-multiplier>
    
    
    5.            <!-- ratio of friendly strength to enemy ranged strength to force attack -->
                <friendly-ranged-strength-divisor>5.0</friendly-ranged-strength-divisor>
    
    
    6.            <!-- distance behind the defensive line the enemy must reach to be considered to have broken through -->
                <enemy-position-buffer-distance>50</enemy-position-buffer-distance>
            </battle-analyser>
    Ad.1 This one seems quite clear to me. Values <1 makes AI bolder, >1 more cautious.
    Ad.2 Not sure here, but I swear the bigger the value, the bigger armies CAI assembles to overcome you
    Ad.3 Not sure.
    Ad.4 Not sure either, but it seems the general consensus is the value should be quite substantial.
    Ad.5 Same as above and even more so.
    Ad.6 Not sure, but Lusted mentioned it affects the morale. In my tests, it seems the bigger the value, the more panicky the soldiers?

    It would be awesome if this mystery could be solved
    Last edited by Just let me post; August 28, 2020 at 07:57 AM.

  10. #150
    z3n's Avatar State of Mind
    Moderator Emeritus

    Join Date
    Aug 2011
    Posts
    4,640

    Default Re: Understanding MTW2/Kingdoms.exe Pathfinding, XML and the AI

    I never really looked too closely at those values honestly or tested them to much extent.

    However, I don't think it's the case the the config_battle_ai influences the CAI. Rather, the only thing that directly influences the CAI in that way are the descr_campaign_db modifiers. There are some for force strength required before it attacks in that file.
    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)

  11. #151

    Default Re: Understanding MTW2/Kingdoms.exe Pathfinding, XML and the AI

    I see, I've seen several notions regarding this file affecting CAI but my tests weren't conclusive at all. It's possible any "influence" I noticed was just wishful thinking and confirmation bias.

    You are saying you haven't tested it much, but could you tell why did you choose value of 100 in <enemy-position-buffer-distance> for example?



    Also regarding descr_campaign_db.xml, I found an old quote of yours (thanks ) that helped me figure out
    <str_limit_weak float= and
    <str_limit_strong float=
    modifiers (as the rest of the modifiers are obvious) so just reposting my other post here in case it's useful to anyone:

    Spoiler Alert, click show to read: 
    For the record, I figured out why these two settings have varying usefulness:

    descr_campaign_db.xml
    <str_limit_weak float= (0.99 in DAC, too high)
    min ideal strength ratio modifier for determining when an army is far too weak for an attack

    <str_limit_strong float= (0.99 in DAC, too low)
    max ideal strength ratio modifier for determining when an army is far too strong for a fair attack

    Quote Originally Posted by z3n View Post
    Those two variables don't do very much, they are stored in a float data type and don't have much bearing on anything important apart from calculations of strength vs a settlement/target. You can make the AI kamikaze targets with the right settings but never act entirely reasonable with any consistent success due to the high level forced invasion parameters which override those variables. Now you could simply turn off forced invasions but that would probably mean fewer invasions and possibly inefficient naval invasions as those are forced.
    So while it doesn't matter much in mods like DAC or EBII most of the time, in less strict AIs like Lands to Conquer lowering weak value makes a huge difference, as AI actually goes out and attacks rebels/poorly defended settlements. 0.75 seems to be the most universally adopted value used in most mods (vanilla game has 0.50 I think).

    <str_limit_strong float= doesn't seem to have any effect at all in any enviroment I tested it, whether set to extremely high or low value. But going by it's description, I increased the value to 99.0 just to be safe (it's the vanilla one IIRC).
    Last edited by Just let me post; August 29, 2020 at 06:08 AM.

  12. #152
    z3n's Avatar State of Mind
    Moderator Emeritus

    Join Date
    Aug 2011
    Posts
    4,640

    Default Re: Understanding MTW2/Kingdoms.exe Pathfinding, XML and the AI

    Honestly, I think I added that value just to see if it did affect morale (when soldiers were completely outflanked by the enemy) or not.
    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. #153
    bitterhowl's Avatar Campidoctor
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    1,695

    Default Re: Understanding MTW2/Kingdoms.exe Pathfinding, XML and the AI

    Already posted it somewhere around

    http://rtw.heavengames.com/cgi-bin/f...718&st=5#post6

    Pretty good article.

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

  14. #154
    Jadli's Avatar The Fallen God
    Gaming Emeritus

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    8,528

    Default Re: Understanding MTW2/Kingdoms.exe Pathfinding, XML and the AI

    Found an unpleasant thing.

    I was testing what AI does, when there are vassal factions (using EOP). And it appears that AI vassal factions are pretty much inactive. In like 95% cases, they dont even expand against rebels (they dont even enter their territory), and are not doing generally anything. I think its not caused by EOP somehow, but simply by the vassal mechanics (perhaps thats why the devs didnt give us any option for vassals in decr_strat). Is there perhaps somewhere within descr_campaign_ai_db a part that would cause this vassal behavior, or could it possibly be added?

  15. #155
    z3n's Avatar State of Mind
    Moderator Emeritus

    Join Date
    Aug 2011
    Posts
    4,640

    Default Re: Understanding MTW2/Kingdoms.exe Pathfinding, XML and the AI

    Not that I know of. I believe that is hardcoded behaviour and can't think of a viable solution. Maybe you can but I have not the faintest clue as to how it could be resolved.

    The devs probably thought the games wouldn't last long enough past the point a vassal faction became a vassal.
    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)

  16. #156
    Jadli's Avatar The Fallen God
    Gaming Emeritus

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    8,528

    Default Re: Understanding MTW2/Kingdoms.exe Pathfinding, XML and the AI

    Yea, I tried making a double of each your decision entry and into the min and max entry lines I literally wrote "is_protectorate=true" but unsurprisingly didnt fix it ...

  17. #157
    Jadli's Avatar The Fallen God
    Gaming Emeritus

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    8,528

    Default Re: Understanding MTW2/Kingdoms.exe Pathfinding, XML and the AI

    BTW, I have seen this in Westeros descr_campaign_db and I was curious if anyone knows whether this division based on difficulties actually works and if it could be perhaps used for other lines in the file as well? (such as rebellions, autoresolve, agent chances... would be useful for pretty much everything)

    Code:
    <ai>
            <!--PRIEST CONTROLLER -->
            <priest_religion_min float = "0.5"/><!--if religion < religion_min then region needs a priest -->
            <priest_religion_max float = "0.6"/><!--if religion >= religion_max then a priest can be taken from this region for other missions -->
            <priest_heresey_min float = "0.05"/><!--if heresey >= heresey_min then region needs a priest -->
            <priest_heresey_max float = "0.3"/><!--if heresey >= heresey_max then region needs a priest with highest priority -->
            <priest_religion_export float = "0.5"/><!--if my religion in foreign region < religion_export then then we will export our religion in this region -->
            <priest_max_prod_turns float = "5.0"/>
            <easy>
                <att_str_modifier float = "1.0"/><!--modifies the effective attackers strength when determining the priority of making attack decision (i.e. att_def_strength_ratio = ((att_str*att_str_modifier)/def_str) -->
                <siege_att_str_modifier float = "0.65"/><!--modifies the effective sieging attackers strength when determining the priority of making attack decision -->
                <crusade_att_str_modifier float = "1.0"/><!--modifies the effective crusading sieging attackers strength when determining the priority of making attack decision -->
                <sally_att_str_modifier float = "0.75"/><!--modifies the effective sallying attackers strength when determining the priority of making attack decision -->
                <ambush_att_str_modifier float = "1.3"/><!--modifies the effective ambushing attackers strength when determining the priority of making attack decision -->
                <str_limit_weak float = "0.10"/><!--min ideal strength ratio modifier for determining when an army is far too weak for an attack ( att_def_strength_ratio < (ideal_str_ratio*str_limit_weak) ) -->
                <str_limit_strong float = "99"/><!--max ideal strength ratio modifier for determining when an army is far too strong for a fair attack ( att_def_strength_ratio > (ideal_str_ratio*str_limit_strong) ) -->
                <merchant_min_survival_acquire int = "80"/><!--the minimum survival chance for a merchant to consider attempting an acquisition -->
            </easy>
            <medium>
                <att_str_modifier float = "0.90"/><!--modifies the effective attackers strength when determining the priority of making attack decision (i.e. att_def_strength_ratio = ((att_str*att_str_modifier)/def_str) -->
                <siege_att_str_modifier float = "0.50"/><!--modifies the effective sieging attackers strength when determining the priority of making attack decision -->
                <crusade_att_str_modifier float = "1.0"/><!--modifies the effective crusading sieging attackers strength when determining the priority of making attack decision -->
                <sally_att_str_modifier float = "0.80"/><!--modifies the effective sallying attackers strength when determining the priority of making attack decision -->
                <ambush_att_str_modifier float = "1.2"/><!--modifies the effective ambushing attackers strength when determining the priority of making attack decision -->
                <str_limit_weak float = "0.10"/><!--min ideal strength ratio modifier for determining when an army is far too weak for an attack ( att_def_strength_ratio < (ideal_str_ratio*str_limit_weak) ) -->
                <str_limit_strong float = "99"/><!--max ideal strength ratio modifier for determining when an army is far too strong for a fair attack ( att_def_strength_ratio > (ideal_str_ratio*str_limit_strong) ) -->
                <merchant_min_survival_acquire int = "80"/><!--the minimum survival chance for a merchant to consider attempting an acquisition -->
            </medium>
            <hard>
                <att_str_modifier float = "0.80"/><!--modifies the effective attackers strength when determining the priority of making attack decision (i.e. att_def_strength_ratio = ((att_str*att_str_modifier)/def_str) -->
                <siege_att_str_modifier float = "0.50"/><!--modifies the effective sieging attackers strength when determining the priority of making attack decision -->
                <crusade_att_str_modifier float = "1.0"/><!--modifies the effective crusading sieging attackers strength when determining the priority of making attack decision -->
                <sally_att_str_modifier float = "0.85"/><!--modifies the effective sallying attackers strength when determining the priority of making attack decision -->
                <ambush_att_str_modifier float = "1.1"/><!--modifies the effective ambushing attackers strength when determining the priority of making attack decision -->
                <str_limit_weak float = "0.10"/><!--min ideal strength ratio modifier for determining when an army is far too weak for an attack ( att_def_strength_ratio < (ideal_str_ratio*str_limit_weak) ) -->
                <str_limit_strong float = "99"/><!--max ideal strength ratio modifier for determining when an army is far too strong for a fair attack ( att_def_strength_ratio > (ideal_str_ratio*str_limit_strong) ) -->
                <merchant_min_survival_acquire int = "65"/><!--the minimum survival chance for a merchant to consider attempting an acquisition -->
            </hard>
            <very_hard>
                <att_str_modifier float = "0.75"/><!--modifies the effective attackers strength when determining the priority of making attack decision (i.e. att_def_strength_ratio = ((att_str*att_str_modifier)/def_str) -->
                <siege_att_str_modifier float = "0.30"/><!--modifies the effective sieging attackers strength when determining the priority of making attack decision -->
                <crusade_att_str_modifier float = "1.0"/><!--modifies the effective crusading sieging attackers strength when determining the priority of making attack decision -->
                <sally_att_str_modifier float = "0.90"/><!--modifies the effective sallying attackers strength when determining the priority of making attack decision -->
                <ambush_att_str_modifier float = "1.0"/><!--modifies the effective ambushing attackers strength when determining the priority of making attack decision -->
                <str_limit_weak float = "0.10"/><!--min ideal strength ratio modifier for determining when an army is far too weak for an attack ( att_def_strength_ratio < (ideal_str_ratio*str_limit_weak) ) -->
                <str_limit_strong float = "99"/><!--max ideal strength ratio modifier for determining when an army is far too strong for a fair attack ( att_def_strength_ratio > (ideal_str_ratio*str_limit_strong) ) -->
                <merchant_min_survival_acquire int = "65"/><!--the minimum survival chance for a merchant to consider attempting an acquisition -->
            </very_hard>
        </ai>

  18. #158
    z3n's Avatar State of Mind
    Moderator Emeritus

    Join Date
    Aug 2011
    Posts
    4,640

    Default Re: Understanding MTW2/Kingdoms.exe Pathfinding, XML and the AI

    Probably not
    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)

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

    Default Re: Understanding MTW2/Kingdoms.exe Pathfinding, XML and the AI

    <str_limit_strong float= doesn't seem to have any effect at all in any enviroment I tested it, whether set to extremely high or low value. But going by it's description, I increased the value to 99.0 just to be safe (it's the vanilla one IIRC).
    Wanna thanks again for those findings. I'm working on AI files for BellumCrucis 6.3 submod on a local forum and had to make a separate ai_label for Mongols - since other factions act very well on PiterAI mongols are a bit passive with 3-4 regions capturing after horde spawn.

    With my proavtive changes for them according their unit stats they have 15-20 regions. But in my test with 5.0 str_limit_strong instead of 99.0 they became rather passive again with only 10 regions captured.

    So seems that this parameter is sensible for strong factions and can limit temp of expansion - if target is 10 times weaker mongols will ignore it at 5.0 str_limit_strong, and it's not so rare situation for them.

    Maybe this parameter isn't useless, it can let AI avoid too weak targets (1-2 unit enemy stacks for fullstack army) and make AI more effective in targeting. Testing with 15.0 now.

    And a question - military_balance counts only unit numbers or unit numbers + their stats? Seems that first variant because military_balance 0.85 for mongols makes them deadly effective.

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

  20. #160
    Jadli's Avatar The Fallen God
    Gaming Emeritus

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    8,528

    Default Re: Understanding MTW2/Kingdoms.exe Pathfinding, XML and the AI

    btw, I havent seen it mentioend anywhere in the thread... I think a useful information is, that its possible to change campaign AI label mid game via a script command "link_faction_ai faction_name ai_label" When one thinks about it, it could be used for very interesting resutls for sure.
    Last edited by Jadli; March 06, 2021 at 01:52 PM.

Posting Permissions

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