Page 6 of 11 FirstFirst 1234567891011 LastLast
Results 101 to 120 of 204

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

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

    Works pretty much the same as against neighbor, blockade and land small (3-6 unit) armies that's about it. The best way I've found for naval invasions is to increase invade_priority for non neighbor factions with invade_immediate.
    Makes sense, thanks.




    Quote Originally Posted by beermugcarl View Post
    do you think it is possible to have some kind of script fired ai switcher?

    I just mean that as far as consolidation after wars (and when to consolidate) and how to fight the human/other ai players goes i want one thing, but when it comes to early expansion and rebel settlements i want another thing entirely.
    You wouldn't need an AI switcher if you can write effective code.
    For example the turn limit route, priorities based on enemy count or settlements owned.
    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. #102
    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

    @CavalryCmdr ... can you run one more test and add this as the personality ... fortified sailor craftsman bureaucrat comfort trader religious balanced Caesar henry napoleon stalin genghis mao smith
    and report your findings ..thanks.

  3. #103

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

    Quote Originally Posted by z3n
    You wouldn't need an AI switcher if you can write effective code.
    For example the turn limit route, priorities based on enemy count or settlements owned.
    Quite right, to expand on this, you also have options for if the target is human or not which allows you to basically tell the AI that the human player is the biggest threat (especially while at war) you can adjust the AI based on whatever relation they have with other factions and even their own or the target faction's global reputation.

    That's all in the campaign_ai_db though, so there are limitations
    Most importantly you cannot adjust the str_limit settings for human vs ai opponants and I'm pretty sure there is no way to link a 'switcher' to the campaing_db. Also, I do not believe there is any way to adjust build and recruitment personalities mid-game, in fact I don't believe any such changes are even save game compatible, much less able to be changed during the game.

    However, the campaign_ai_db is the single most powerful file to influence AI behavior and it pretty much has options for any viable conditions and can be included into one profile with no 'switch' needed. My own AI has an early game 'rebel land grab' as well as a more aggressive setting later in the game, so they will attempt to grab as much land as possible early on without attacking another faction, then give themselves time to 'build up' that land before starting any major wars.

    Now if you want to go extreme you can use 'link faction ai' in the campaign script so under certain circumstances you can give the AI an entirely new personality. For example, I used to have a 'kill the human' mode where all AI factions would basically ally with eachother and attempt to kill the human player if they attempted to blitz too early in the game. However, unless you want something that specific and extreme you should be able to do it all in one AI.

    Quote Originally Posted by GRANTO
    can you run one more test and add this as the personality ... fortified sailor craftsman bureaucrat comfort trader religious balanced Caesar henry napoleon stalin genghis mao smith
    and report your findings ..thanks.
    Will do, I'll give you a 50 and 100 turn report using the same set up I used for the previous tests tomorrow.

  4. #104

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

    On Build personalities:
    The AI's set to do nothing but build, so as to minimize uncontrollable variables, with the same excelerated city growth as before so the AI has to choose it's buildings rather then have time to build everything regardless.
    I set up a test for 100 turns with 'unlimited' money (50000 at start, 15000 for kings purse)
    I set up a test for 100 turns with 'normal' money (5000 at start, 1500 for kings purse)
    I set up a test for 100 turns with 'low' money (1000 per settlement at start, 0 for kings purse)

    For each of these I ran through 3 personalities, checking each building constructed in 39 different settlements. There is no appreciable difference in the different personalities with any of these three situations. Obviously there is a large difference between the 'unlimited' money and the 'low' money, but not the personalities at the same level. We are talking 3 to 4 total (as in all 39 towns added together) levels difference at most!

    Bottom line: I am fairly confident in saying build personality (balanced, religious, trader, etc.) has no valuable effect on what buildings the AI constructs over the course of 100 turns. This is a tedious and time consuming process, with no noteworthy results, unless someone has some valuable info to change my mind, or there is significant interest, I am done testing build personalities as anything that dose not garnish results in 100 turns is not worth messing with IMO.

    Actually 'no noteworthy results' in not quite true, the AI built the 'best' most well balanced towns with the 'normal' money levels, it seems the AI is well aware of income and with a 'kings purse' of 15,000 it had no need to build any income into their cities, they also neglected 'happiness' buildings. Unfortunately they did not use this extra time on military buildings either as they would have 1 or 2 of them maxed out with usually nothing built in the other 2 or 3 (out of Stable, Barracks, Range and Siege.) With 'normal' money they all tended to be closer with only a few settlements per faction building siege. To give a more clear understanding, 'unlimited' had a level 1 Stable and a 5 Barracks (with 0 for range and siege) while 'normal' had a level 2 stable, 3 barracks, 2 range and 2 siege. Also, 'normal' was much more likely to build higher level smiths so their lower end units would generally have armor upgrades.
    However, the 'unlimited' money did have a tendency to max out their Ports and more importantly Walls (core buildings) while the 'normal' still tended to be a level or rarely two levels lower in each then they 'could' have been. Perhaps strange, 'normal' money had a much higher rate for building 'special' buildings (caravan, bull ring, jousting lists, bank etc) then 'unlimited.'
    Unfortunately 'normal' also had much higher (total) levels of 'Inn' buildings, usually level 2-4 in each city, while the 'unlimited' tended to have level 1-3 in fewer cities. I have absolutely no idea why this is.
    Also, 'normal' universally had a 'balanced' budget, consistently making a couple hundred more then they were spending per settlement (so factions with 8 settlements would have 2000-3000 income, while a faction with 2 would have 500 to 700 or so) while 'low' tended to barely brake even or sometimes loose money per turn regardless of how many settlements they had.

    Edit: It is probably important to note that I have a completely re done buildings for my mod, eliminating 'castles' and incorporating those buildings into 'cities.' So this may or may not have some influence on these tests, I cannot be sure.
    Last edited by CavalryCmdr; March 09, 2016 at 07:23 AM.

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

    Hi, can you post an example of "kill the human" settings please?

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

  6. #106
    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 CavalryCmdr View Post
    On Build personalities:
    The AI's set to do nothing but build, so as to minimize uncontrollable variables, with the same excelerated city growth as before so the AI has to choose it's buildings rather then have time to build everything regardless.
    I set up a test for 100 turns with 'unlimited' money (50000 at start, 15000 for kings purse)
    I set up a test for 100 turns with 'normal' money (5000 at start, 1500 for kings purse)
    I set up a test for 100 turns with 'low' money (1000 per settlement at start, 0 for kings purse)

    For each of these I ran through 3 personalities, checking each building constructed in 39 different settlements. There is no appreciable difference in the different personalities with any of these three situations. Obviously there is a large difference between the 'unlimited' money and the 'low' money, but not the personalities at the same level. We are talking 3 to 4 total (as in all 39 towns added together) levels difference at most!

    Bottom line: I am fairly confident in saying build personality (balanced, religious, trader, etc.) has no valuable effect on what buildings the AI constructs over the course of 100 turns. This is a tedious and time consuming process, with no noteworthy results, unless someone has some valuable info to change my mind, or there is significant interest, I am done testing build personalities as anything that dose not garnish results in 100 turns is not worth messing with IMO.

    Actually 'no noteworthy results' in not quite true, the AI built the 'best' most well balanced towns with the 'normal' money levels, it seems the AI is well aware of income and with a 'kings purse' of 15,000 it had no need to build any income into their cities, they also neglected 'happiness' buildings. Unfortunately they did not use this extra time on military buildings either as they would have 1 or 2 of them maxed out with usually nothing built in the other 2 or 3 (out of Stable, Barracks, Range and Siege.) With 'normal' money they all tended to be closer with only a few settlements per faction building siege. To give a more clear understanding, 'unlimited' had a level 1 Stable and a 5 Barracks (with 0 for range and siege) while 'normal' had a level 2 stable, 3 barracks, 2 range and 2 siege. Also, 'normal' was much more likely to build higher level smiths so their lower end units would generally have armor upgrades.
    However, the 'unlimited' money did have a tendency to max out their Ports and more importantly Walls (core buildings) while the 'normal' still tended to be a level or rarely two levels lower in each then they 'could' have been. Perhaps strange, 'normal' money had a much higher rate for building 'special' buildings (caravan, bull ring, jousting lists, bank etc) then 'unlimited.'
    Unfortunately 'normal' also had much higher (total) levels of 'Inn' buildings, usually level 2-4 in each city, while the 'unlimited' tended to have level 1-3 in fewer cities. I have absolutely no idea why this is.
    Also, 'normal' universally had a 'balanced' budget, consistently making a couple hundred more then they were spending per settlement (so factions with 8 settlements would have 2000-3000 income, while a faction with 2 would have 500 to 700 or so) while 'low' tended to barely brake even or sometimes loose money per turn regardless of how many settlements they had.

    Edit: It is probably important to note that I have a completely re done buildings for my mod, eliminating 'castles' and incorporating those buildings into 'cities.' So this may or may not have some influence on these tests, I cannot be sure.
    Another fascinating result, this could indicate the AI preferring happiness buildings for tax income or rates. The lack of change in regards to buildings suggests that it could simply control the ratio of automanaged buildings under a certain profile. They may even be slightly tweaked AI specific profiles which explains the lack of differences in buildings. It could also explain why troop distribution was different, perhaps they indicate the factions defensive strategy for its troops (stack troops in cities that need comfort, prioritize high income trade cities as trader, sailor defend any cities by the sea). Alternatively it could have an effect in regards to where the AI expands toward and what it prioritizes in a city it expands into.


    I suspect the last option as it would explain why (as an example) thrace had the sailor profile and the results with many different armies. Thoughts?
    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. #107

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

    Quote Originally Posted by z3n
    I suspect the last option as it would explain why (as an example) thrace had the sailor profile and the results with many different armies. Thoughts?
    This is definitely worth investigating. Now that you mention the possibility I have noticed a distinct difference in troops arrangement even with an inactive AI. Balanced, obviously, placed it's armies one step outside the city, while 'craftsman' stationed troops to one border, sometimes over that border. Also 'religious' had more troops stationed inside the city, and 'trader' also had troops stationed outside their own territory. However, I was not really paying attention to such since I was focused entirely on buildings.
    I have, in the past, noticed different performance of some factions based on their build personality, I had always assumed it was related to what buildings they were constructing, but after this last set of tests I'm thinking it was something else.
    This could also explain some of my tests with no/multiple personalities (more on that further down.)

    On a side note, I finally found my problem with my inactive AI, I can't believe this, but I had forgotten to put 'invade_priority="-1"' in it...

    Quote Originally Posted by bitterhowl
    Hi, can you post an example of "kill the human" settings please?
    This is from an older version.
    Spoiler Alert, click show to read: 

    Code:
     <faction_ai_label name="kill_human">  
      
      <defend_decisions>
      
       <decision_entry>
        <!--
         Never give up never surrender!
        -->
        <min_entry target_human="true"/>
        <max_entry target_human="true"/>
        <faction_attitude defense="defend_minimal" want_peace="false" want_be_protect="false" continue="false"/>
       </decision_entry>
      
       <decision_entry>
        <!--
         The enemy of evil is my friend
        -->
        <min_entry target_human="false"/>
        <max_entry target_human="false"/>
        <faction_attitude defense="defend_minimal" want_peace="true" want_ally="true" pts_alliance="10"/>
       </decision_entry>
      </defend_decisions>
     
      <invasion_decisions>
      
       <decision_entry>
        <!--
         The enemy of evil is my friend
        -->
        <min_entry target_human="false"/>
        <max_entry target_human="false"/>
        <faction_attitude can_force_invade="false" at_war="false" invade="invade_none" invade_priority="-1" continue="false"/>
       </decision_entry>
       <decision_entry>
        <!--
         KILL THE HUMAN!!!!!!!!!
        -->
        <min_entry target_human="true" borders_all_our_regions="true"/>
        <max_entry target_human="true" borders_all_our_regions="true"/>
        <faction_attitude can_force_invade="false" at_war="true" invade="invade_immediate" invade_priority="2500" alliance_against="20" continue="false"/>
       </decision_entry>
       <decision_entry>
        <!--
         KILL THE HUMAN!!!!!!!!!
        -->
        <min_entry target_human="true" borders_all_our_regions="false"/>
        <max_entry target_human="true" borders_all_our_regions="false"/>
        <faction_attitude can_force_invade="true" force_invade="true" at_war="true" invade="invade_immediate" invade_priority="2500" alliance_against="20" continue="false"/>
       </decision_entry>
      </invasion_decisions>
     </faction_ai_label>

    Note the 'invade_priority' against humans should be set to whatever your max is in the first one and 500 higher then that for the second. The reason for the first one is that the AI will occasionally lock up an army that attempts a naval invasion from a neighboring province. However, I'm not sure that is necessary any more since z3n's pathfinding trick seems to fix most AI army 'lockups'
    The reason the second section want's to be higher then your max is to offset the hardcoded reduction in invade priority based on distance.
    This is a very basic AI, do not expect anything other then launching attacks on the human player, no fancy maneuvers or well constructed armies, the AI will simply attack with whatever it has on had whenever it can.

    Quote Originally Posted by GRANTO
    can you run one more test and add this as the personality ... fortified sailor craftsman bureaucrat comfort trader religious balanced Caesar henry napoleon stalin genghis mao smith
    and report your findings ..thanks.
    Ok, when I started this, I did have some idea's about how things were going to work and was expecting lackluster results. I WAS WRONG. I had to run the full test a second time just to make sure I hadn't dreamt the first set of results in some sort of twisted nightmare!

    Now, on my 'no personality' test the AI did pretty much what I had expected, recruiting pretty much whatever and throwing them together into 'armies' that lacked form or cohesion. I would not recommend 'no personality' to anyone for this reason and that the AI has a liking for militia and peasant troops on top of that.

    With my 'dual' recruitment personalities the AI did quite well overall with various single unit armies covering the map. (on top of just being poor strategy, it also created a very noticeable increase in turn times.)

    Honestly, I was expecting some strange mixture of the two.

    I was not all wrong, the AI still recruited whatever (meaning everything in this case) and made them into armies, however, unlike 'no personality' these armies were completed and well formed armies with intent. Also, like with dual personalities, there were many small armies running around, however unlike there these were generally half dozen or more units going to rendezvous with like groups of different unit types to form said armies with intent.

    That said, the AI went totally insane, in a good way I suppose. Lesser performing and weak factions were eliminated mercilessly, unless they managed to become a vassal first, which happened only twice in all 6 runs. Atleast one faction was eliminated by turn 50 every time and usually 3 or 4 by turn 100. There were crazy numbers of full stack, well formed armies everywhere from every faction that wasn't already beat down. AI aggression was off the charts, and there was no backing down, a faction reduced to one region would have 4 or 5 full stacks defending and 4 or 5 more attacking (15k kings purse will allow that) and if they didn't its because they were dead.
    It was not a total free-for-all, alliances were still made and, generally, honored, however not always. Any sign of weakness and the other factions would jump like a pack of starving hyenas, allies would either save them, die with them, or join the pack and eat them.

    And, the cream-a-la-cream, of the two occasions factions actually managed to become vassals, one went in-active as usual, the other, however, still built and maintained armies and joined in their 'masters' wars, in the 9 years of M2 I have never seen that before.

    Now, there were a couple disappointments, though it was hard to find them since such factions generally did not live very long. Hungary always started strong, but was reduced to very little or nothing by turn 100. The Turk factions decided all missile (missile infantry at that) armies were a good idea, and would thus be crushed once they encountered real armies. Sicily started weak, but, if they survived, finished strong. Sicily and Byzantium were still obsessed with their heavy infantry, though not to the extent as in other personalities. And Milan always managed to just survive, but they never did better then that (they were one of the two 'vassal' factions, and they were the active one at that, which resulted in the most active and effective Milan out of all 6 runs, a vassal of Spain BTW, whose job apparently was to stop the Moors ally Egypt from helping them against Spain.)

    Note here, I was just 'looking in' on turns 50 and 100, but from the way the AI played this looks like it would be a fun mod to play. I will be trying this system with 'normal' rules applied to the AI factions, and if they do anywhere near as well, this will likely become my default.
    Last edited by CavalryCmdr; March 09, 2016 at 10:10 PM.

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

    @Cavalrycmdr , Did you notice the naval activity with that multiple?

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

    @z3n , im going to release an aggressive CAI submod for eb2 based on the multiple personalities ,
    which wont interfere with your work.

  10. #110

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

    Quote Originally Posted by GRANTO
    @Cavalrycmdr , Did you notice the naval activity with that multiple?
    I assume you are referring to naval invasions, to be honest, they were slightly less satisfying then my normal, but that's not saying they were bad. They used naval invasions decisively landing large forces and attacking effectively. However, they were also 'direct' by which I mean, to be expected point A to point B attacks, which is fine. But my AI with normal personality settings, being less aggressive, would generally be more, I guess 'discrete' might be the best word. With the direct aggressive nature of this personality setting the point of invasion is generally predictable and anticipated, any human player would be prepared for an attack of this nature, if they were anticipating any form of attack from that faction (well maybe not veteran M2 players, but they'd learn quickly enough.) The less direct attack my AI normally uses looks for a weak point for invasion rather then just the closest. This makes them harder to anticipate and plan for.
    However, I must admit, if your looking for an aggressive AI, it's more then worth the trade off, and the direct approach would probably be more satisfying to the type of player who really want's an aggressive AI anyway.

  11. #111
    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 CavalryCmdr View Post
    I assume you are referring to naval invasions, to be honest, they were slightly less satisfying then my normal, but that's not saying they were bad. They used naval invasions decisively landing large forces and attacking effectively. However, they were also 'direct' by which I mean, to be expected point A to point B attacks, which is fine. But my AI with normal personality settings, being less aggressive, would generally be more, I guess 'discrete' might be the best word. With the direct aggressive nature of this personality setting the point of invasion is generally predictable and anticipated, any human player would be prepared for an attack of this nature, if they were anticipating any form of attack from that faction (well maybe not veteran M2 players, but they'd learn quickly enough.) The less direct attack my AI normally uses looks for a weak point for invasion rather then just the closest. This makes them harder to anticipate and plan for.
    However, I must admit, if your looking for an aggressive AI, it's more then worth the trade off, and the direct approach would probably be more satisfying to the type of player who really want's an aggressive AI anyway.
    yes , thanks for doing that test.

  12. #112

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

    Oh, I should point out talking about Naval invasions, my mod dose not have any land bridges, so the only way to attack some places is with a naval invasion. It's been so long since I modded an AI using land bridges that I cannot remember the details, but removing them actually helps the AI in naval invasions. The only real draw back as far as the AI goes is the Crusade/Jihad armies just will not get on a ship.

  13. #113
    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 CavalryCmdr View Post
    Oh, I should point out talking about Naval invasions, my mod dose not have any land bridges, so the only way to attack some places is with a naval invasion. It's been so long since I modded an AI using land bridges that I cannot remember the details, but removing them actually helps the AI in naval invasions. The only real draw back as far as the AI goes is the Crusade/Jihad armies just will not get on a ship.
    ah!... yes.

  14. #114
    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 GRANTO View Post
    @z3n , im going to release an aggressive CAI submod for eb2 based on the multiple personalities ,
    which wont interfere with your work.
    No problem, I was planning on taking advantage of it as well although if you're still on the team I can simply attach it to the 2.2 AI release as official with credits to you for the discovery. It is your decision however as I do not mind submods despite having a mild case of creators syndrome from time to time.


    Very impressed with the results, I am actually quite excited to test and confirm myself but not able yet and I'd really like to reach an understanding as to how it works. Do you guys think it simply makes the AI aware that it can use each personality type? Longer turn times indicates a high level (exe based) change, very puzzled however as to how this even works not that I doubt the possibility. It must be something that either the developers intended to be possible or a loophole around the parser which makes it read and use every single personality until it finds the other personality type or until it reads every personality period. I thought it would be picking the first two personalities and ignoring the rest as redundant. Due to your own tests (Granto) and the difference between his (CavalryCmdr) first test and the second and as he no doubt knows the normal behaviour by heart alongside longer turn times, it is safe to say that it works. Now the only question is how?

    So thoughts from both on how it works would be appreciated as I'm trying to figure out whats going on in the exe when we do that. The only reasonable conclusion I can come up with is that the only instructions there are in regards to personalities is to read the data and apply it, no rules attached other than the names being correct.
    Sorry about the long post I am sure I could have consolidated the post but I felt as if I should explain why I did not test it myself yet, I have been very busy with a script rewrite I just finished last night and didn't understand the possibility. Overall I must say that I feel we are truly progressing so thank you all for your contributions. I will point out that it could also apply to RTW.
    Last edited by z3n; March 10, 2016 at 01:27 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)

  15. #115
    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
    No problem, I was planning on taking advantage of it as well although if you're still on the team I can simply attach it to the 2.2 AI release as official with credits to you for the discovery. It is your decision however as I do not mind submods despite having a mild case of creators syndrome from time to time.


    Very impressed with the results, I am actually quite excited to test and confirm myself but not able yet and I'd really like to reach an understanding as to how it works. Do you guys think it simply makes the AI aware that it can use each personality type? Longer turn times indicates a high level (exe based) change, very puzzled however as to how this even works not that I doubt the possibility. It must be something that either the developers intended to be possible or a loophole around the parser which makes it read and use every single personality until it finds the other personality type or until it reads every personality period. I thought it would be picking the first two personalities and ignoring the rest as redundant. Due to your own tests (Granto) and the difference between his (CavalryCmdr) first test and the second and as he no doubt knows the normal behaviour by heart alongside longer turn times, it is safe to say that it works. Now the only question is how?

    So thoughts from both on how it works would be appreciated as I'm trying to figure out whats going on in the exe when we do that. The only reasonable conclusion I can come up with is that the only instructions there are in regards to personalities is to read the data and apply it, no rules attached other than the names being correct.
    Sorry about the long post I am sure I could have consolidated the post but I felt as if I should explain why I did not test it myself yet, I have been very busy with a script rewrite I just finished last night and didn't understand the possibility. Overall I must say that I feel we are truly progressing so thank you all for your contributions. I will point out that it could also apply to RTW.
    yes z3n go ahead with it for eb2 thats fine , it will need testing and balance as it works hand in hand with the rest of the AI codes as well, i will post my thoughts on what i have seen and what i know in the morning when i have more time.

    ps ,..it works on rome as well yes...iv got a very dynamic rs3 test campaign going on atm.
    Last edited by GRANTO; March 10, 2016 at 04:00 PM.

  16. #116

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

    Quote Originally Posted by z3n
    first test and the second and as he no doubt knows the normal behaviour by heart alongside longer turn times, it is safe to say that it works. Now the only question is how?
    Yes, I have been studying this particular AI (applied in descr_campaign_ai_db) for some time, up close and with 100+ turn auto runs, and have never seen anything like this behavior. Like I said, I did the entire test a second time to confirm the results, so 6 consecutive times running for 100 turns each time.

    Now, the longer turn times are quite simply explained, at least to an extent, by the larger number of armies on the map.

    And, I do have a theory as to how, or more specifically why at least. Supplied by yourself:
    Quote Originally Posted by z3n
    It could also explain why troop distribution was different, perhaps they indicate the factions defensive strategy for its troops (stack troops in cities that need comfort, prioritize high income trade cities as trader, sailor defend any cities by the sea). Alternatively it could have an effect in regards to where the AI expands toward and what it prioritizes in a city it expands into.
    Which is why I had stated that it may explain some of my test results.

    First, recruit personality influences unit recruitment to some degree, but more importantly organizes those units into armies. This is fairly obvious to me as with no personality the AI did not build armies so much as slap units together into a stack. A full stack of catapults and trebuchet may be imposing, but it's not likely to win many wars. (I made a mistake here in that I not only had no recruitment personality, but I also had no build personality.) As well as those armies the AI built with all the tests of single personality all with 'balanced' build ('balanced genghis' 'balanced Caesar' 'balanced mao' etc) while they were not always the best, I was able to see the logic of assembling the armies the way they did, I am now quite sure I would have seen more results with mixing up the different build personalities with those recruit personalities, but I was still looking at it as separate tests.
    Build personalities, I now firmly believe as z3n said, determines what the AI wants, so 'craftsman' wants mineable resources, 'seafarer' wants ports, 'comfort' wants population etc. I'm going to go further and say it also assigns resources to achieve those desires within the limits of invade priority put down by the LTGD. (this is important as it also explains my limited results testing build personalities, in those tests I had the AI set to have no invade priority, thus nearly all available resources were used on building, I now strongly suspect I would see more results if I tested them with a fully active AI)
    So while the descr_campaign_ai_db determines 'who' and 'with how much' I think build personality has a lot to say about 'where,' and recruit personality determines 'with what.'
    When I had tested dual personalities I only had one build personality ('balanced napoleon smith' for example) My theory states that the LTGD determined who they were attacking and with how much of it's available resources. The single build personality determined where and what the total available resources were, but the two recruitment personalities were both pushing for their troops to be built. What happened is more troops were recruited then had been assigned to a task so they were just there. Thus many single unit armies that didn't seem to be doing much.
    This explains the massive recruitments the all personalities tests had, all the recruit personalities increasing the 'value' of their units, in short basically all units.
    But what about the aggressiveness?
    Well, that's all the build personalities raising the 'value' of their targets. So while 'craftsman' says 'I want mineable resources' and so on, when you put them all together you get 'I want EVERYTHING'

    This brings me to a final note about the AI that got these test results, it may or may not be of any significance, but I have invade_priority_max set at 9000 while a single invade target will max out around 3000 (unless they are at war with a human player.) I did this in an attempt to make an AI capable of fighting on multiple fronts, with somewhat limited results, but enough so I didn't change it. In the 'all personalities' tests however, the AI was most effectively fighting on multiple fronts, for instance Spain was doing very well fighting in modern day central France against the English in the northwest and the Saxons to the east, while at the same time waging a successful campaign against the Moors in North Africa. Mostly, of course, as is usually the case when fighting on multiple fronts, they did put forth a valiant effort and were fighting effectively, if not so successfully.

    and z3n thought he had a long post...

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

    Ok what iv noticed is that the single ai personality is almost like a shackle or a channel of some kind for the AI
    opening it up to the multiples releases a lot of the shackles , now like CC said it becomes very open to 'everything' but there is a definite intent to its purpose.

    also i believe that it is still being read by the exe. in some sort of priority from left to right because if you change them around you will get noticable differences especially in the CAI,
    so say for instance you use .... bureaucrat trader religious fortified comfort sailor craftsman balanced henry stalin smith Caesar napoleon genghis mao ...against .... fortified sailor craftsman bureaucrat comfort trader religious balanced Caesar henry napoleon stalin genghis mao smith ... you will notice how the AI targets a different end to its means between the two , although both will still be aggresive .

    There is much to test with it still , but on the rome .exe there have been much more naval invasions and even periods of ceasefire and vassalship which have lasted more than the usual 1 turn. {although the rome diplomacy is broken which is a shame}

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

    Im also thinking {out the box as i do lol} and wondering if there are more personalities that we dont know about {that CA left never used or forgot to mention} like Hannibal or peaceful etc...hmmm.

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

    Although i will say in all my testing si far i have this one {or slight variations on it} to be the best ... fortified sailor craftsman bureaucrat comfort trader religious balanced Caesar henry napoleon stalin genghis mao smith

  20. #120

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

    Quote Originally Posted by GRANTO
    also i believe that it is still being read by the exe. in some sort of priority from left to right because if you change them around you will get noticable differences especially in the CAI,
    That makes sense, basically an order of priority. I suspect the 'best' would not be universal at all. After the weekend I will test different orders for different factions, putting what I think would be the best personality first, the second best second etc, to see if I get any noticeable differences.

Posting Permissions

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