Page 1 of 3 123 LastLast
Results 1 to 30 of 85

Thread: Campaign/Diplomacy AI

  1. #1

    Default Campaign/Diplomacy AI

    Thought I'd start a thread on this as I'm currently messing with it.

    Will post anything I come up with.

    edit: removed first point until i get a chance to retest :)

    ~~~~

    Lots of very useful info on this subject in this link posted by CavalryCmdr

    http://rtw.heavengames.com/cgi-bin/f...t&f=9,6718,,10

    (only a couple of posts down but wanted to stress the value :) )
    Last edited by nikolai1962; 12-06-2007 at 05:00.
    It's not a map.

  2. #2

    Default Re: Campaign/Diplomacy AI

    Second thing...

    May be obvious to people but just in case it isn't--if you want a faction to start as a vassal of another faction then you can rig the campaign AI file to make them do it in the first turn.

    Say you wanted milan to be a vassal of hre for example.

    1. Make a copy of the "catholic" profile in the campaign AI file
    2. Rename it "catholic_milan"
    3. Assign milan the ai_label "catholic_milan" in the strat file.
    4. Add this clause at the top of the "catholic_milan" profile's <defend decisions> bit.


    <decision_entry>
    <min_entry stance="AtWar" target_faction="hre"/>
    <max_entry stance="AtWar" target_faction="hre" turn_number="4"/>
    <faction_attitude want_peace="true" want_be_protect="true" defense="defend_deep"/>
    </decision_entry>
    4. Repeat the process for hre, copy the catholic profile, rename the copy and assign it to hre.
    5. Add this clause to the top of the new "catholic_hre" profile's <attack decisions>


    <decision_entry>
    <min_entry stance="AtWar" target_faction="milan"/>
    <max_entry stance="AtWar" target_faction="milan" turn_number="4"/>
    <faction_attitude invade="invade_immediate" invade_priority="1500" want_offer_protect="true"/>
    </decision_entry>
    6. Start hre and milan at war.
    7. Make sure there's no milan diplomats around.
    8. Start an hre diplomat next to milan
    9. Job done.


    edit: The order in which the two factions move may matter. The faction you want to be a vassal needs to have one turn to process their decison entries and decide they want to be a protectorate. So if the boss faction moves first their diplomat will be turned down on turn 1 (turn 0 in the code). Not sure if that would affect things. If you want it to definitely happen on the first turn then the "vassal" faction has to have their turn first.
    Last edited by nikolai1962; 11-27-2007 at 02:48.
    It's not a map.

  3. #3

    Default Re: Campaign/Diplomacy AI

    Finally, someone elts doing and posting proper research on this subject. I've been searching all the forums for info on this for quite some time and have made alot of progress myself. I have a sticky at TotalWar Haven that contains information you may find helpful, but this thing tells me I cant add a link until after I've made one post already, so I'll try again.

  4. #4

    Default Re: Campaign/Diplomacy AI

    M2TW AI Modification: An Interactive Essay
    There, now I can link it.

    Anyway, all this is relevent to M2 1.2 but not been updated to Kingdoms as I dont own it yet.

    If you want to see my research in action there is a link in my sig on that site to my Medimod. As I have only dial-up I am unable to download/upload large files, so Medimod is quite small.

  5. #5

    Default Re: Campaign/Diplomacy AI

    @CavalryCmdr

    *Very* useful info. I'll add your link to the first post. Thanks a lot. I'll check out your mod too to see what you've done.

    ~~~

    3rd Thing.

    The conditions like "strongest_neighbour" in the campaign ai file seem to glitch when the target faction's regions are split up.

    Example: I had all the catholic factions set up to want to ally to their strongest_neighbour if catholic at game start. Milan and Venice allied with HRE as expected but not Sicily and Hungary. Took me a while to realise this was because neither Sicily nor Hungary border all the HRE's region groups whereas both Milan and Venice do.

    Diplomats from Sicily and Hungary did both move to an HRE city (and stayed there) but no alliance was made.

    Just an odd thing that may be relevant in some situations.

    ~~~

    4th Thing.

    descr_faction_standings

    The "Forgiveness" event that supposedly triggers for "each" 100 florins given to a faction seems to only trigger once per event. So giving 4000 has no more effect than giving 100.

    The GiveMoney event works fine if it is a single payment but if it is part of a regular tribute then it seems to double-count in some way such that giving 4000 as a single payment has a much lower effect than a tribute of 1000 for 4 turns. There's almost an exponential efect involved which messes me up quite a bit. Most annoying.
    It's not a map.

  6. #6

    Default Re: Campaign/Diplomacy AI

    Another point I think I left out in my essay post, there is a bug where if the AI attempts a forced invasion (Naval at least so 'forced' is more a guess) and a standard invasion from and to the same regions all invasions are cancelled. This is why if you look at the ai_db in Medimod you will see a strange entry...
    <decision_entry>
    <!--
    cancelation of invasions override
    -->
    <min_entry is_neighbour="true" borders_all_our_regions="true"/>
    <max_entry is_neighbour="true" borders_all_our_regions="true" num_settlements="3"/>
    <faction_attitude can_force_invade="false" continue="true"/>
    </decision_entry>
    I have set a max number of settlements because it almost never happens with larger factions. Strangely it also seems not to happen if they have multiple settlement blocks (borders_all_our_regions.)

    This also brings up another interesting phenomenon (aka bug) wherein somehow it is posible on occasion for borders_all_our_regions to be true when the two in question are not even neighbors. Thus my use of both.

  7. #7

    Default Re: Campaign/Diplomacy AI

    Quote Originally Posted by CavalryCmdr
    This also brings up another interesting phenomenon (aka bug) wherein somehow it is posible on occasion for borders_all_our_regions to be true when the two in question are not even neighbors. Thus my use of both.
    Haven't noticed your first thing but the second fits in with a theory of mine. From looking at map path-finding problems it seemed to me the game can glitch on map.rwn creation. Some regions that are adjacent don't seem to be recognized as such. A consistent (I think) clue that this has happened is when a faction mounts a naval landing against an adjacent land region e.g scotland landing in York on the vanilla map.

    More relevant to your point is I don't think all naval landings are forced. I think some coast->coast, coast->island etc paths count as neighbours, but only a few. Not sure if the cases you mentioned were coastal ones or interior ones.

    Up until recently i've mostly been wrestling with the AI's map problems and I had an "attack rebels only" AI profile. There were only two invade decisions:

    if slave faction: is_neighbour, attack immediate, force_invade=false

    and

    if any other faction: invade_none, force_invade=false

    Interestingly some naval landings still happened e.g Tunis->Sardinia when the moors took Tunis. Sicily went Naples->Durazzo but otherwise never did their usua naval landings. So i think where the naval paths exist they count as neighbour and don't require a forceinvade but CA added a few forced naval landings in specific places where they weren't happening but were needed e.g Sicily.

    Maybe.

    Maybe some other reason.
    It's not a map.

  8. #8

    Default Re: Campaign/Diplomacy AI

    The problem I've had with invasions being cancelled happend multiple times, if you run the LTGD log for say a 10 turn stretch it would happen say 3 times total. The only one I particularly remember nailing down the cause was Venice attacking Durazzo from Ragusa. So you could be right that it was infact two normal invasions attempted by the same army via diferent routs, which would also explain why it would cancel all invasions, the AI 'got confused.'

    It would show up in the LTGD log as
    LTGD: invasions cancelled this turn.
    as the very last entry for that faction after naval invasions and global modifiers (which I have set to 0)

    It is posible it is a bug created by my rather unique format wherein the AI is actually told to attack everyone, invade_priority is then based on a number of individual factors, the AI will then plan invasions on it's higher priorities based on resources available. This allows a suprisingly flexible though (for now) rather unstable AI capable of effectively fighting multi-front wars, multiple coordinated invasions against a single opponant, even multi-faction coordinated invasions of a single opponant. Major problem I'm having at the moment is that want_peace cannot be assignd a numerical value.


    The problem with alliance_against, I just discoverd on revewing some recent work, is that it is comulative over multiple turns, or decision runs. So a condition that has 'alliance_against="1"' over the course of 5 turns would result in a 5, add any multiple runs for a single turn (alliances made, wars declared, peace accepted, etc) and you can have the number jumping 10 or more points in five turns from a single decision entry giving a value of one. I've not seen any other vaues carry over in this manner, though I strongly suspect 'pts_alliance' which oddly dose not show in the LTGD log.

  9. #9
    blaaaaaaaaaarg! Senior Member Lusted's Avatar
    Join Date
    Feb 2005
    Posts
    1,773

    Default Re: Campaign/Diplomacy AI

    With alliance_against, i found in my AI which i based off of vanilla but heavily modded, i had to add in a decision entry to give negative points for alliance_against v slaves because otherwise i was seeing loads of early game alliances which i didn't want.

    And i also added in quite large negative pts_alliance values for catholic decisons on islamic factions and vice versa to reduce the number of alliances they make, but they still do it against common enemies etc.

    It is posible it is a bug created by my rather unique format wherein the AI is actually told to attack everyone, invade_priority is then based on a number of individual factors, the AI will then plan invasions on it's higher priorities based on resources available.
    I could definitely see something like that causing problems if you're telling the AI to attack everyone and then modifying the AI priority from there. I've had a bad enough time just trying to sort out the AI after adding continue="true" to the vanilla AI and then adding in some decision entries, let alone doing the major changes you have in your AI file.

  10. #10
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: Campaign/Diplomacy AI

    I had a weird "invasions canceled" case when testing a minimal AI flavor (only attack rebels immediately, defend fortified) without providing at_war in the faction attitude for the rebels. Basically, the factions in question would not attack at all if you don't use at_war in the slave defend decision
    Last edited by alpaca; 11-21-2007 at 20:05.

  11. #11

    Default Re: Campaign/Diplomacy AI

    I will happen occasionally, but I've never known them not to attack at all. Regardless, I also use a simple check at the begining of defence decisions;
    <decision_entry>
    <!--
    At war call
    -->
    <min_entry stance="AtWar"/>
    <max_entry stance="AtWar"/>
    <faction_attitude continue="true" at_war="true"/>
    </decision_entry>
    Though this is more to help num_enemies be more consistant.

  12. #12

    Default Re: Campaign/Diplomacy AI

    Lusted With alliance_against, i found in my AI which i based off of vanilla but heavily modded, i had to add in a decision entry to give negative points for alliance_against v slaves because otherwise i was seeing loads of early game alliances which i didn't want.

    And i also added in quite large negative pts_alliance values for catholic decisons on islamic factions and vice versa to reduce the number of alliances they make, but they still do it against common enemies etc.
    The negative "pts_alliance" thing is useful to know. I'd stopped using "alliance_against" because you can get silly alliances forming.

    CavalryCmdr The problem with alliance_against, I just discoverd on revewing some recent work, is that it is comulative over multiple turns, or decision runs.
    Useful to know.

    Alpaca I had a weird "invasions canceled" case when testing a minimal AI flavor (only attack rebels immediately, defend fortified) without providing at_war in the faction attitude for the rebels. Basically, the factions in question would not attack at all if you don't use at_war in the slave defend decision
    I had that with my first "attack rebels only" testing profile. Had to add "atwar=true" to the decision. Odd. Forgotten about that.

    CavalryCmdr The problem I've had with invasions being cancelled happend multiple times, if you run the LTGD log for say a 10 turn stretch it would happen say 3 times total. The only one I particularly remember nailing down the cause was Venice attacking Durazzo from Ragusa. So you could be right that it was infact two normal invasions attempted by the same army via diferent routs, which would also explain why it would cancel all invasions, the AI 'got confused.'
    Does fit my more observational experience. There's a lot of odd things going on with naval landings. A few of the naval paths are perfectly smooth and don't require any help i.e they happen even with force_invade switched off e.g Tunis->Sardinia, Denmark->York (i think those are two of them it's been a while since i tested this) and then a bunch of others that don't happen unless force_invade is switched on. It's definitely easy to imagine how a forced invasion might interfere somehow with the campaign AI's processing.

    You can (sometimes) create the smooth kind of naval landings by accident or trial and error by moving towns/ports around but it i've never managed to pin it down. Monkwarrior (i think) had a theory it was related to the closest region in a direct x or y direction which i think may be true but with some other factor involved, related to the town/port location i assume.
    Last edited by nikolai1962; 11-22-2007 at 05:09.
    It's not a map.

  13. #13

    Default Re: Campaign/Diplomacy AI

    Couple of minor things reminded of a thread question elesewhere:

    1. in descr_faction_standings there's a "religion catholic" condition. Contrary to my and i imagine most people's assumptions "religion orthodox" and "religion islam" aren't implemented but you can use stuff like factions { russia, byzantium } instead for the same effect.

    2. There's a factionstanding command in descr_faction_standings.txt and a FactionStanding condition in the docudemons. For probably obvious reasons it doesn't seem like the condition works in triggers in descr_faction_standings.txt. The GlobalStanding condition works.


    ~~~

    CavalryCmdr Another point I think I left out in my essay post, there is a bug where if the AI attempts a forced invasion (Naval at least so 'forced' is more a guess) and a standard invasion from and to the same regions all invasions are cancelled. This is why if you look at the ai_db in Medimod you will see a strange entry...
    Thinking about it more I think i have seen that hundreds of times but put it down to a path-finding glitch. Would possibly explain a common problem with naval landings especially those where a faction makes a landing on a region they are actually adjacent to but don't seem to realize they are.

    So i think where the naval paths exist they count as neighbour and don't require a forceinvade but CA added a few forced naval landings in specific places where they weren't happening but were needed e.g Sicily.
    Quoting myself here. Just wanted to clarify I don't mean that some coast/coast, coast/island paths would fit an "isneighbour=true" condition in the ai file just that they are a kind of halfway "sea neighbour" and the AI behaves a bit differently with them.
    Last edited by nikolai1962; 11-22-2007 at 05:10.
    It's not a map.

  14. #14

    Default Re: Campaign/Diplomacy AI

    Just wanted to clarify I don't mean that some coast/coast, coast/island paths would fit an "isneighbour=true" condition in the ai file just that they are a kind of halfway "sea neighbour" and the AI behaves a bit differently with them.
    Ah, there are times when is_neighbour="false" but borders_all_our_regions="true" according to the LTGD log, and indeed apears to act accordingly. Do you think this is caused by these 'semi-border' regions? I suppose why is more just a curiosity as we really cant do anything about it except to include is_neighbour="true" with any borders_all_our_regions="true" decision entry.

  15. #15

    Default Re: Campaign/Diplomacy AI

    Interesting thought now you mention it. Sounds possible.

    I really need to get into this log business instead of just guessing what is going on.

    Trying to recall the vanilla region-pairs that had "automatic" naval landings. IIRC Stockholm->Stettin was one, Denmark->York, Tunis->Sardinia, Crete->Rhodes, umm... been too long since i was using the plain vanilla map. (nb they don't always go both ways so that adds another complication.)

    Something to ponder.

    I suppose why is more just a curiosity as we really cant do anything about it except to include is_neighbour="true" with any borders_all_our_regions="true" decision entry.
    Not sure. Personally I don't really like land-bridges so if it was consistent in the ai file and you could create a "semi-neighbour" naval path for say, asia minor to constaninople, then you could use those conditions to give a higher priority in those cases instead of say, the turks, taking the long land route round the black sea.

    Not that there's anything wrong with land-bridges i just like to see the AI doing naval stuff.
    Last edited by nikolai1962; 11-22-2007 at 06:01.
    It's not a map.

  16. #16

    Default Re: Campaign/Diplomacy AI

    Not sure. Personally I don't really like land-bridges so if it was consistent in the ai file and you could create a "semi-neighbour" naval path for say, asia minor to constaninople, then you could use those conditions to give a higher priority in those cases instead of say, the turks, taking the long land route round the black sea.
    Ah, so it could actually be usefull to use is_neighbour="false" and borders_all_our_regions="true" in decision entries; if these semi-border reagions are in-fact responsible for that occurance.
    I'll keep notes on when, exactly, I see this occuring. Though I tend to read the log at 10 turn intervals or when something specific happens I'm trying to eliminate or reproduce, so it's sometimes hard to know what reagions were involved. I dont really think this is important enough to really dedicate research to atm, maybe if I get bored.

    A little something I've noticed but not really worked with, I'm sure most have noticed this one already.
    In descr_regions.txt there are some hidden resources regarding guilds. In those setlements the AI will usually build that guild while all settlements without a guild resource usually get the thieves guild. Basically I'm wondering if those hidden resources work as a flag for the AI.

  17. #17

    Default Re: Campaign/Diplomacy AI

    Quote Originally Posted by CavalryCmdr
    Ah, so it could actually be usefull to use is_neighbour="false" and borders_all_our_regions="true" in decision entries; if these semi-border reagions are in-fact responsible for that occurance.
    I'll keep notes on when, exactly, I see this occuring. Though I tend to read the log at 10 turn intervals or when something specific happens I'm trying to eliminate or reproduce, so it's sometimes hard to know what reagions were involved. I dont really think this is important enough to really dedicate research to atm, maybe if I get bored.
    Same here. Now you've made me think it's possible I might look into it more if/when i get round to removing to removing the land bridges. Assuming i can make the replacement naval paths of course which is iffy.


    Quote Originally Posted by CavalryCmdr
    A little something I've noticed but not really worked with, I'm sure most have noticed this one already.
    In descr_regions.txt there are some hidden resources regarding guilds. In those setlements the AI will usually build that guild while all settlements without a guild resource usually get the thieves guild. Basically I'm wondering if those hidden resources work as a flag for the AI.
    I'm sure they do. I think the reason the AI gets so many thieves guilds is cos they spam spies. I have agent limits on everything so they only get one spy per town. Haven't actually checked if that made a difference though.

    Also, recently added (but not tested yet) putting assassin_city, merchant_city etc on the starting towns for egypt/byzies to control their agent recruitment and hopefully get them to get the specialist guilds. Which i thought was a nifty idea (if it works).
    It's not a map.

  18. #18

    Default Re: Campaign/Diplomacy AI

    I have agent limits on everything so they only get one spy per town.
    Ofcourse, I cant belive I hadnt thought of that, I knew the cause.

    Also, recently added (but not tested yet) putting assassin_city, merchant_city etc on the starting towns for egypt/byzies to control their agent recruitment and hopefully get them to get the specialist guilds. Which i thought was a nifty idea (if it works).
    I must be missing something, if they are flags the AI is then programmed to look for them, so you wouldnt be able to just make-up flags for it. Are you using these to increase the agent limit, for example a building that would require these hidden resources?
    However I would say adding 'merchants_guild' is likely to be recognized as a flag though it dose not appear in the vanilla descr_regions but other _guilds are, so perhaps they made a flag for all of them.

    These hidden resources also have the same name (exactly, minus the guild_ at the begining) as the building tree name for that guild (as per export_descr_buildings.txt) I'm wondering if the AI is, instead of programmed to look for 'guild flags,' will recognize any building tree name and increase the priority for that building in that settlement, though I suspect most likely (as the name dose not include the guild_) that it will only work for guilds.

    I'll definately be experimenting with this tommorow.

  19. #19
    blaaaaaaaaaarg! Senior Member Lusted's Avatar
    Join Date
    Feb 2005
    Posts
    1,773

    Default Re: Campaign/Diplomacy AI

    The main reason the AI spams thieves Guilds is because of how easy they are to get, i modified the Guild file so now the AI and player see a more varied amount of Guilds which i achieved by changing the amount of points recruiting various agents and units gave, and by making it so that when a guild of a particular type is built, the overall faction score for that Guild is lowered in order to reduce the chances of more of the same Guild being built.

    The negative "pts_alliance" thing is useful to know. I'd stopped using "alliance_against" because you can get silly alliances forming.
    Well with my file i've now got it so factions generally ally against common enemies or against strongest neighbours, the only slight wierdness in it is the amount of catholic and islamic alliances which i could probably solve by increasing the negative pts_alliance value for the decisions i've set up to make those factions not want to ally.
    Last edited by Lusted; 11-22-2007 at 09:11.

  20. #20

    Default Re: Campaign/Diplomacy AI

    One thing I've noticed about M2TW is that the AI acts a lot like it did in MTW.

    In MTW the AI would have most of it's army guarding a province and some guarding the settlement. This made sense since when you entered the province you automatically had to fight the AI army in the province and if you won the army would retreat to the settlement, giving it a larger force to defend the settlement (should you attack it). However in M2TW the player can avoid enemy armies in the province and attack the settlement directly. Thus the AI's tactic of sending out most of it's army to guard the province works against it.

    Any ideas about how to make the AI to keep its soldiers garrisoned unless they want to attack a faction.
    4 Seasons (6 Empires battle for supremecy); 3.0 version
    Total War Eras (start at 970, 1080, 1200, 1300, 1400, or 1500); 2.4 version
    Eras Total Conquest (start at 1230, 1346, 1547); 1.2 version

  21. #21

    Default Re: Campaign/Diplomacy AI

    which i could probably solve by increasing the negative pts_alliance value for the decisions i've set up to make those factions not want to ally.
    Indeed, that will work provided you do not allow the alliance_against value to get too high.

    One thing I've been wondering is if the pts_alliance value holds any sway when an AI faction is forced to chose between allies? With it not showing on the LTGD it's hard to say.

    Any ideas about how to make the AI to keep its soldiers garrisoned unless they want to attack a faction.
    It can be done usnig defend_fortified then disabling forts. Acceptable in vanilla IMO, but, with a little work, it appears forts can be considerably more usefull with the kingdoms.exe. Ironically, the AI is not too bad a fort placement, so they did consider that when they failed to consider so much about the campaign map, this also makes this option less desireable.

  22. #22
    blaaaaaaaaaarg! Senior Member Lusted's Avatar
    Join Date
    Feb 2005
    Posts
    1,773

    Default Re: Campaign/Diplomacy AI

    Indeed, that will work provided you do not allow the alliance_against value to get too high.
    That's the difficult thing. I likehaving the AI form alliance blocks against common enemies, but i want to limit how much Islamic and Catholic factions ally which proves difficult when they have common enemies that it is sensible for them to ally against.

    It can be done usnig defend_fortified then disabling forts.
    Yeah defend_fortified without disabled forts can result in some interesting AI garrisons, but still overall better garrisoning by the AI compared to vanilla. I've been watching a war in the latest campaign in my mod with interest given the big stacks the AI is using to invade and defend settlements with.

  23. #23

    Default Re: Campaign/Diplomacy AI

    That's the difficult thing. I likehaving the AI form alliance blocks against common enemies, but i want to limit how much Islamic and Catholic factions ally which proves difficult when they have common enemies that it is sensible for them to ally against.
    I'm going to script alliances to last 10 turns rather then indefinate and see how the AI handles that. It's an easy, but long, script so it will take me awhile to finish it.

    Yeah defend_fortified without disabled forts can result in some interesting AI garrisons, but still overall better garrisoning by the AI compared to vanilla.
    Major problem with not disabling forts is that AI armies tend to get stuck inside the fort. Highly annoying when you capture thier last city with a full-stack army three steps away just sitting there watching. This can be helped with changing defend types, depending on different situations, particularly switching to frontline when ready to attack and deep when very weak, but it still happens occasionally.

  24. #24

    Default Re: Campaign/Diplomacy AI

    The merchant_city, assassin_city for the byzies was to add to their recruitment line in the EDB so they'd specialize their agent recruitment in particular cities and maybe beat the player to the guild HQ for once. But Lusted's idea seems like it may work better.

    ~~~

    Update on post #5 point:

    GiveMoney seems to trigger ten times a turn when it's regular tribute.

    ~~~

    other people may have noticed this ages ago but i only noticed it recently. Your power rating label (supreme, weak, average) on the diplomacy screen effects what the AI will offer for trade rights etc. If you have a high power rating they generally offer something in exchange for trade rights. If you're weak they're more likely to demand payment for trade rights. Doesn't seem to be relative to their label just yours. Alliances increase it.

    May be of interest as it probably affects a lot of things diplomatically. Especially so as your modding may have changed how likely it is for factions to be one thing or the other. For example in mine i have cheap units but low recruitment so the armies are quite big at the beginning and most of the factions counted as supreme quite early even though they were actually still quite weak. I've increased the points for each label in the descr_diplomacy.xml so there is more of a spread between the factions and the more powerful factions are percieved as such.


    ~~~

    LustedThat's the difficult thing. I likehaving the AI form alliance blocks against common enemies, but i want to limit how much Islamic and Catholic factions ally which proves difficult when they have common enemies that it is sensible for them to ally against.
    It was the excessive catholic-islamic alliances early game that put me off alliance_against. I'm doing alliances by how much the factions like each other now as you can control that a lot more with all the faction_standings triggers.

    ~~~

    Definitely need to try that defend_fortified thing.


    ~~~

    CavalryCmdrThese hidden resources also have the same name (exactly, minus the guild_ at the begining) as the building tree name for that guild (as per export_descr_buildings.txt) I'm wondering if the AI is, instead of programmed to look for 'guild flags,' will recognize any building tree name and increase the priority for that building in that settlement, though I suspect most likely (as the name dose not include the guild_) that it will only work for guilds.

    I'll definately be experimenting with this tommorow.
    Haven't done much with guilds yet but i recall reading a very informative tutorial on them somewhere. Worth looking for if you haven't come across it already.
    Last edited by nikolai1962; 11-23-2007 at 06:15.
    It's not a map.

  25. #25

    Default Re: Campaign/Diplomacy AI

    Quote Originally Posted by CavalryCmdr
    It can be done usnig defend_fortified then disabling forts. Acceptable in vanilla IMO, but, with a little work, it appears forts can be considerably more usefull with the kingdoms.exe. Ironically, the AI is not too bad a fort placement, so they did consider that when they failed to consider so much about the campaign map, this also makes this option less desireable.
    Are there any guides on how to edit defend_fortified and siable forts? Alternatively are there some ready made files I can download that will do this for me?
    4 Seasons (6 Empires battle for supremecy); 3.0 version
    Total War Eras (start at 970, 1080, 1200, 1300, 1400, or 1500); 2.4 version
    Eras Total Conquest (start at 1230, 1346, 1547); 1.2 version

  26. #26

    Default Re: Campaign/Diplomacy AI

    Are there any guides on how to edit defend_fortified and siable forts? Alternatively are there some ready made files I can download that will do this for me?
    defend_fortified as a defend decision in descr_campaign_ai_db.xml, the closest thing to a guid I know of for that file is the link on the top post.

    Easiest way to disable forts that I know of is to edit descr_cultures.txt
    fort_cost 500
    to say
    fort_cost 100000
    Thus making forts cost 100000. Just remember each culture has a seperate fort_cost line.

    As for ready made files, Medimod 0.9 uses that method.

  27. #27

    Default Re: Campaign/Diplomacy AI

    Prompted by a question in a thread.

    If you want factions to have a marriage alliance from the start of the game:

    1. Have a decision entry that makes the factions want to ally, in mine i currently have:

    Code:
    <decision_entry>
    <min_entry	stance="Neutral" target_religion="catholic" is_neighbour="true"/>
    <max_entry  stance="Neutral" target_religion="catholic" turn_number="12" trusted_ally_enemy="false" target_is_shadow="false"/>
    <faction_attitude	can_force_invade="false" want_ally="true" pts_alliance="1"/>
    </decision_entry>
    This makes all the catholic factions want to ally with any neighbouring catholic faction up to turn 12 (while they're rebel-bashing).


    2. Start princesses close to settlements of the faction you want the marriage alliance with.

    3. Make sure the factions don't have any diplomats nearby to make the alliance.

    4. Should get a marriage alliance.

    Alternatively if you just want two specific factions to do this then use the method in post #2 and make separate profiles with a specific entry.

    The princess should be within one turn away from the target faction in case their heir gets a marriage offer straight away. Probably best if you use a princess from the faction that moves first to ensure the target faction's heir doesn't get a marriage offer before the princess can move.
    It's not a map.

  28. #28

    Default Re: Campaign/Diplomacy AI

    AI army merging.

    Problem: AI not merging their armies and particularly the times when they have lots of little stacks all standing round close together not doing anything.

    Been trying to figure this out for my defensive AI profile, in particular looking at the the problem in light of two of the points CavalryCmdr makes in his page (listed above) viz

    1. The attack and defend decisions needing to be in sync
    2. The AI needing a point to mergo on e.g if it's defending it's frontline it needs to have a frontline (explained below)

    Currently using defend_deep as the basis for testing the merging--may not be the best choice overall but it is fine for just testing this aspect.

    Had three bits of progress (I think)...

    1.
    The AI is set to always be defend_minimal to the slave faction but various other things to the other AI factions depending on circumstances. In my simple profile it was initially either defend_deep if at peace and defend_frontline if at war.

    I found the AI merging quite nicely as they expanded against neighbour rebels but going into multi-stack mess mode when they'd taken all the rebel regions and were still at peace with all their neighbour factions.

    Because they were still at war with the non-neighbouring rebel regions they were still at defend_minimal towards the slave faction while being set to defend_deep with their neighbouring factions.

    Changing the defend decison towards the slave faction to be the same as the other AI factions seemed to make the AI merge much better in those situations as they are in the same defense mode for all factions including slave. In my case that meant making the defend decisions towards the slave faction being defend_frontline if a neighbour and defend_deep if not, so the AI faction being processed was defend_deep to everybody in that case.

    2.
    The merging would also go wrong during crusades. In my simple AI profile I originally just had defend_frontline when at war but the AI usually won't have a frontline during crusades/jihads so i think that confused it. Adding a second decison so it was defend_deep when at_war but not a neighbour, and defend_frontline when at_war with a neighbour seems to have fixed that.

    3.
    There was also a third case more specific to my mod but another example of the attack and defend decisions being out of sync.

    I'd set the AI to normally be defend_frontline when at war but to switch to defend_deep when they wanted a ceasefire (as a visual clue when playing). I also have very tight agent limits and few towns so there aren't many diplomats. So often what would happen is an AI faction would go into want peace mode and defend_deep but their single diplomat was on the other side of the map. So the faction would have defend_deep set in the defend decisons but still have invade_immediate or something in the attack decisons because they were still at war. This usually made them go into multi-stack mess mode.

    Not sure how i'll fix that in mine but it is another example of how, if the attack and defense decisions don't fit together then the AI gets confused and they don't merge their armies.

    ~~~

    Currently with defend_deep and everything in sync the AI is merging very nicely most of the time except when case 3 arises. They also seem to always keep a very big garrison in their capital--which is a nice improvement.

    The improved merging may not even be because of the defend_deep bit, it may just be that now the decisons are in sync the AI isn't getting confused as much. I'm going to try setting them to be all defend_normal or something else just to see if it's the being out of sync that messes it up more than which actual defend decision it is using.

    ~~~

    Also the AI sometimes seems to get confused when their group of regions got into a weird shape e.g in my test the english AI expanded right through the centre of the french regions so the french regions ended up in a kind of U shape. That seemed to confuse the french AI a bit, which is sort of understandable as you could see how that might make it hard for the AI to know what central point to defend.

    ~~~

    Also, high brigand spawns made it merge a little bit less effectively as the individual mini-stacks would be chasing rebels instead of merging. I think most mods reduce the brigand spawn rate so that is probably only a minor thing.

    ~~~

    A separate minor thing (maybe not minor in some situations)

    If you start two factions at war they aren't counted in the num_enemies entry used in the campaign AI, (can't remember if CavCmdr mentioned that in his page or not). Might affect some things. Possibly why you have to have the "at_war"="true" bit with the slave faction.
    It's not a map.

  29. #29

    Default Re: Campaign/Diplomacy AI

    There was also a third case more specific to my mod but another example of the attack and defend decisions being out of sync.

    I'd set the AI to normally be defend_frontline when at war but to switch to defend_deep when they wanted a ceasefire (as a visual clue when playing). I also have very tight agent limits and few towns so there aren't many diplomats. So often what would happen is an AI faction would go into want peace mode and defend_deep but their single diplomat was on the other side of the map. So the faction would have defend_deep set in the defend decisons but still have invade_immediate or something in the attack decisons because they were still at war. This usually made them go into multi-stack mess mode.
    Effectively you need to link invade and defend decisions, using the same triggers as the 'defend deep' when wanting peace, switch invade to 'buildup,' 'start,' or even 'none.' This should (mostly) solve the small army issue. Invade decisions will overide defend, so the AI is attempting to follow it's invade orders without an intermediate merge point (such as 'frontline') so the armies have no reason to merge until they reach thier goal. Changing the invade to one of these three leaves only the defend target point, so the AI's armies wil merege there instead.

  30. #30
    blaaaaaaaaaarg! Senior Member Lusted's Avatar
    Join Date
    Feb 2005
    Posts
    1,773

    Default Re: Campaign/Diplomacy AI

    That's something i did with my AI - have a defend decision for every invade decision and vice-versa, so that the AI builds up better. Though i think that's got slightly out of sync with recent changes i've made.

    Also, nikolai, have you managed to make your AI aggressive whilst using defend_deep?

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO