Page 9 of 11 FirstFirst 1234567891011 LastLast
Results 161 to 180 of 204

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

  1. #161
    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

    This feature is known and already exists in some mods. As for myself I'm planning to link ai_label to faction leader's attributes and fire it on CeasedFactionLeader, when previous leader dies.

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

  2. #162
    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

    Hehe, I had literally the same idea!

    How many you intend to make?

    I was thinking something like:
    Expansionist vs peacemaker
    Chivalrous (keep alliances and help allies) vs backstabber (attacks allies if useful)
    Pious (focuses at enemies of other religion, avoid fighting the same religion) vs ungodly (doesnt care)
    Smart (attacks only when he has sufficient troops etc) vs dumb (attacks ill prepared, with small forces etc)

  3. #163
    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

    Well, same ideas except Pious/ungod.

    And thought about combining Expancionist with Backstabber and Chivalrous with Peacemaker.

    Also think it's notable that such idea appeared only now after 15 years of modding. When it's common known that "AI is dumb and blah-blah-blah".
    Last edited by bitterhowl; March 07, 2021 at 05:33 AM.

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

  4. #164
    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 was surprised to find out that there are several interesting features that seem to have been kinda ignored for a long time, shame people werent willing to look into such things during the height of M2TW popularity... Though some mods definitely used some of the "unknown" areas, but just didnt share what they found I suppose.

    Anyway, yea, I of course intended to combine it all to some variations. So there is a chivalrous/backstabbing/pious/smart/dumb expansionist, and one or two defensive one I suppose. It really depens how deep one intends to go and also mainly whether all your factions already use a joint AI label, or various ones, which would add a lot of work. Though I suppose if one makes a proper system for this, it might be just a matter of adjusting one or two value for each variation based on new FLs.

  5. #165
    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

    Also thought that change ai_label should be only once for one FL, because frequent changes of global
    faction's behavior will be bad for performance. At least two changes - when new leader becomes a leader and maybe at senile age if he will live long enough.

    Maybe moderator should remove those posts somewhere in a separate thread because of offtopic here.

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

  6. #166
    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

    If we'll return to main theme - our local forum tests shows that most important improvements for AI performance are become after beermugcarl's recommendations for starting_action_points, line of sight and movement_points tweaks. Even old AIs, even vanilla AI shows much more smart and dangerous behavior.

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

  7. #167
    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

    By tweaks you mean increasing them? Well, one could easily handle lineofsight and movement_points traits/ancs to AI via triggers, if it helps them

    Quote Originally Posted by bitterhowl View Post
    Also thought that change ai_label should be only once for one FL, because frequent changes of global
    faction's behavior will be bad for performance. At least two changes - when new leader becomes a leader and maybe at senile age if he will live long enough.

    Maybe moderator should remove those posts somewhere in a separate thread because of offtopic here.
    Yea, I meant to do it only once a faction has a new leader. I assume if he ruled for really long time, then for example after 20 years it could be checked again.

  8. #168
    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


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

  9. #169
    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

    Quote Originally Posted by bitterhowl View Post
    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.
    That is a really good question, I thought it was directly related to the same algorithm for faction rankings of military. I think unit strength depends on unit numbers + stats however it is heavily weighted on unit numbers to start unless another stat "makes up" for that e.g. hitpoints which effectively double their unit numbers.

    One way of testing this is implementing a mirror unit with almost equivalent stats, then increasing unit count and seeing whether there is an equivalent increase when attacking another army on the map with 1 unit of the mirror.


    So
    1) Place 2 armies on the map right next to each other via descr strat
    2) Each army has 1 mirror unit (everything the same except 1 thing different)
    3) Make the difference the amount of soldiers in the unit at first, then attack the other army and see the "strength balance"
    4) Try stat changes, significant or not


    I believe from my own observations in the past that unit numbers are very heavily weighted. More than the stats.

    Sadly even if I had time to write this up, I wasn't able to test it. Such is life
    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)

  10. #170
    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

    Got another important question about .xml coding - does the order of conditions in min/max lines matter for engine?

    I mean - are this code
    Code:
    <min_entry stance="AtWar" strongest_neighbour="true" is_target_faction_to_outlive="true" military_balance="1.001" free_strength_balance="1.001" frontline_balance="1.001"/>
    and this one
    Code:
    <min_entry military_balance="1.001"  free_strength_balance="1.001" frontline_balance="1.001"  strongest_neighbour="true"  is_target_faction_to_outlive="true" stance="AtWar"/>
    equal for reading by .exe?

    Or in incorrect order some conditions could be missed because they should go first to read, for example stance="AtWar" in my example will be read only in first variant because it comes first as it should, and in second variant it will be ignored because .exe doesn't expect this condition after military_balance etc.?
    Last edited by bitterhowl; March 10, 2021 at 06:04 AM.

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

  11. #171
    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

    Got another important question about .xml coding - does the order of conditions in min/max lines matter for engine?
    It shouldn't matter, because each token gets matched or if it's a series of if statements within a while loop e.g.

    While (parsing)
    {

    if min entry
    {

    // for AtWar testing
    if AtWar
    {
    Do stuff
    }

    if Military balance > Other Military Balance
    {
    Do stuff
    }

    } // end of min entry checks

    __________________________________________________________________

    if max entry
    {


    if AtWar
    {
    Do stuff
    }

    if Military balance > Other Military Balance
    {
    Do stuff
    }

    } // end of max entry checks

    } // end of the entire while loop

    At some point within a loop like that, the values would still be matched and actions taken.
    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)

  12. #172

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

    Quote Originally Posted by Jadli View Post
    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?
    Did anyone come up with any resolutions for making AI vassal factions more active? I wasn't aware of this state of vassal AI and this is really sad to hear, as it kind of shatters some of my own modification ideas...

  13. #173
    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

    bitterhowl discovered concrete evidence in the ltgd logs that vassals don't use any invasion decisions. (meaning they wont actually invade places normally)

    https://www.twcenter.net/forums/show...1#post15997091
    https://www.twcenter.net/forums/show...1#post15997361
    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)

  14. #174

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

    And a question - military_balance counts only unit numbers or unit numbers + their stats?
    Might be the hidden "unit value" the game calculates from the EDU entries. Both stats and especially numbers influence the total value. Here are some examples of vanilla units (read as: unit, value/solder, unit value):

    Feudal Knights, 18,78, 601
    Hobilars, 6,00, 192
    Peasant Archers, 2,88, 138
    Longbowmen, 6,33, 304
    Viking Raiders, 6,03, 362
    Dismounted Feudal Knights, 21,02, 1009
    Elephant Rocketeer, 131,25, 1575 (highest unit value)
    ME Peasants, 0,47, 28 (lowest unit value)

    vanilla_unit_values.txt

  15. #175
    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

    Quote Originally Posted by Dominick View Post
    Did anyone come up with any resolutions for making AI vassal factions more active? I wasn't aware of this state of vassal AI and this is really sad to hear, as it kind of shatters some of my own modification ideas...
    Welcome to the club

    Implemented it for like 20 factions and then found out its useless...

    Well, so the closest to actual vassal mechanics thing that medieval 2 can offer us is still the papacy I suppose

  16. #176
    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

    Want to join to your revelations of modding secrets with small showdown.

    I discovered that target_faction in descr_campaign_ai_db also has min/max entry. In vanilla it's england as min and slave as max.

    Seems that I already mentioned it somewhere else but didn't find that post.

    All factions in ltgd.log has their number according to descr_sm_factions order. So for vanilla england is 0 and next faction is 1 and so on.

    Why it can be useful? In this example
    Code:
    <decision_entry>
                    <!--
                        if not our neighbour, and we have any settlements, use defaults
                    -->
                    <min_entry    num_settlements="1"/>
                    <max_entry    is_neighbour="false"/>
                </decision_entry>
    wich is described as very useful (it force faction to ignore not neighboring factions and don't plan invasion to far countries). But in this case for example for Scotland - France and Egypt are equal non-neighboring factions, wich leading Scotland to be isolated and minimises interactions between factions in near neighborhood.

    If we'll set interval for each faction or culture type - wich factions not to interact at all if they're not neighboring and wich to interact - campaign could be much more interesting.

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

  17. #177
    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

    I dont get it, please explain

  18. #178
    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

    What bitterhowl may be implying is that since sm_factions is sorted from faction 1 - 10 (for example)

    The minimum entry could be faction number 1, and the max entry faction number 5. This may end up allowing region groups to focus on each other (e.g. regional factions from minimum 1 to maximum 5)

    I wonder if it actually works that way. It certainly sounds possible...


    From what I recall however, culture groups can focus on each other too. Or you can simply manually add a separate decision for each (more work but just copy and paste)

    edit:
    Actually not culture, it was target_religion which exists.
    Last edited by z3n; March 14, 2021 at 05:13 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)

  19. #179
    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

    That's it. I think it's definitely works that way because it written in min/max conditions explanation

    Code:
     min_section
    target_faction="england"                :: target faction label (see descr_sm_factions.txt)
    
    max_section 
    target_faction="slave"
    And ltgd.log shows nubers of factions according to their order in descr_sm_factions.txt

    Once again - this block does not make difference how far this non-neighboring faction is
    Code:
    <decision_entry>                 <!--
                        if not our neighbour, and we have any settlements, use defaults
                    -->
                    <min_entry    num_settlements="1"/>
                    <max_entry    is_neighbour="false"/>
                </decision_entry>
    So for Scotland - France and Mongols and Russia will be equally executed and ignored. For far eastern factions (in case of Scotland) it's good to do. But if we'll include France in Scotland's area of activity, even they're not neighbours for engine, we can coordinate their activities against England using alliance_against, trusted_ally_enemy and so on.

    If we'll speak in terms of Westeros - Lannisters may not be neighbours of Martells, as well as Boltons and Nights Watch. But if igniration of far nothern factions is useful, ignoration of nearst non neighboring faction make gameplay more strait. Maybe this is one of the explanations of allies passivness and weak interactions between factions.

    Making difference between non-neighboring factions we can focus faction's attention to next target more directly and make behavior more diversive and interesting. All we need is to regroup their list in descr_sm_factions in geographical order

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

  20. #180
    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

    Some more important links here.

    This is twc old thread about LTGD logging by GED. https://www.twcenter.net/forums/show...ign-AI-Project
    Maybe it should be replaced into this section.

    This is another good research of Nikolai1962 on Totalwar.org https://forums.totalwar.org/vb/showt...nding-problems

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

Posting Permissions

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