Results 1 to 30 of 85

Thread: Campaign/Diplomacy AI

Hybrid View

Previous Post Previous Post   Next Post Next Post
  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 06: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 03: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 nikolai1962
    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.




    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>




    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.

    Very good post Nikolai, definitely something worth trying out!

    Question, the invade decision from HRE, won't that prompt an invasion, why would it send a diplomat instead?

    Also, why wouldn't you want to have Milan diplomat around?

  8. #8

    Default Re: Campaign/Diplomacy AI

    SigniferOneVery good post Nikolai, definitely something worth trying out!

    Question, the invade decision from HRE, won't that prompt an invasion, why would it send a diplomat instead?

    Also, why wouldn't you want to have Milan diplomat around?
    I've been trying to get "become a vassal" to work without the two factions being at war as i wanted a "peaceful annexation" type of vassal (for making the end game quicker). But can't seem to get it to work unless they're at war unfortunately.

    So they will attack but they send a diplomat as well because of the "want_offer_protect" bit in their decision and they need to be kept at war until the offer is made. AI diplomats can still operate through a siege so that shouldn't be a problem. Keeping the Milan diplomat away is in case they ask for and get a ceasefire (not sure if this would mess things up or not--just a precaution).
    Last edited by nikolai1962; 11-29-2007 at 02:57.
    It's not a map.

  9. #9

    Default Re: Campaign/Diplomacy AI

    LustedMy Ai has problems with garrisoning and defending well at times, it's something i'm hoping to improve.
    Yeah. I think the AI's defending is a bigger weak spot than it's attacking really. Hence trying to focus on that.
    It's not a map.

  10. #10

    Default Re: Campaign/Diplomacy AI

    CavalryCmdrThe AI behaves differently toward the Slave faction then other factions, any invade type toward the Slave faction will result in attacking as soon as they think they are strong enough. That said, Invade buildup is an agresive stance, and even on buildup the AI will attack other AI factions if they are overwhelmingly powerful. Much like invade immediate will build up thier forces if they are weaker then thier target. Unfortunately the AI will also have a tendency to lauch raid type attacks while on buildup if they do not have more pressing concerns. The best patrol-type defence I've found is invade none, defend deep toward neighbours and invade start, defend raids toward non neighbours. Problem here is they have a tendancy to not intercept invading armies, however they will concentrate more on building thier infrastucture while still recruiting a reasonable amount of troops.

    The ai_db.xml only gives the AI a general 'stance' toward other factions, it dose not actually control the AI, so any invade type besides none is an agresive stance and can result in the AI attacking that faction. This is where manipulation of invade priority is very helpful, the AI will not invade a faction that has a much lower invade priority then another faction. For example if the ai_db gives an invade priority of 1000 toward slaves and only gets up to 400 toward everyone elts they will not attack unless invade_opportunistic is used, even if the only slave setlements left are the ones in america.
    Mine may be working out a bit different because i currently have all the invade priorities mostly the same so the final priority is heavily influenced by faction standing and global standing and the factions just dislike the slave faction more than anyone else at game start. With mine it "seems" that the invade_buildup setting has a specific pause built into it to allow armies to merge. It may just appear that way though.

    What i was mostly doing is trying out the defend settings with a view to how well the AI armies are merged when the faction is at peace with everybody. Usual caveats about how recruitment, unit costs etc may affect different mods but i set all the defend decisions to be the same just to look at the merging.

    Pretty much replicates what CavCmdr says in his page linked at the top and fits what you'd expect but reproducing results never hurts so...

    defend_deep: ok merging (a comparison would be 3-4 stacks of 3-4 units instead of 7-8 stacks of 1-2 units), heavily weighted to the capital or some other central spot they decide on, good garrison in the capital, not so good elsewhere.

    defend_fortified: ok merging, less weighted to the capital so they try and cover more cities and more of them have ok garrisons, big downside is the actual forts they build and the armies staying in them forever. not a problem if you don't mind losing forts but i'd like to avoid doing that if possible.

    defend_frontline: ok

    normal and minimal: pretty useless purely from a merging point of view. The AI doesn't seem to try and merge with these settings.

    advantage of deep is you can expect a big counter-attack stack if you invade. disadvantage is in a faction that is physically large--in terms of area, the counter-attack will take a long time to arrive. fortified is more likely to have a stack on guard but because the AI is trying to cover more places they are likely to be smaller stacks. So overall, purely in terms of defend decisons and merging/garrisons, defend_fortified would be best if it wasn't for the fort glitch.

    Also, geography seems to matter with defend_frontline. In areas with a lot of narrow mountain passes etc the AI seemed to have bigger problems merging.

    However, seems to me though that the majority of the AI's army merging happens as a result of the invade decisons. So currently i'm thinking that's where to look if you want to get the AI to merge more.

    ~~~

    Ran through it quickly again with the default invade mode being invade_start instead of invade_none. This had a lot of interesting effects. Probably confused the AI a bit too but overall this seemed to increase the average level of merging with each setting. They also seemed to hold back a lot more e.g my french faction has 4 starting cities and armies and normally they'd all move out and attack a rebel city each on the 1st/2nd turn with invade_immediate or 2nd/3rd turn with invade_buildup. With invade_start set for all the other factions what happened was two of those starting armies moved to the capital, merged and waited, while the other two did the rebel bashing.

    Worth experimenting with maybe, bearing in mind the points CavCmdr makes about it starting wars you may not want. I'm thinking of maybe randomly switching the AI between invade_none and invade_start with neighbouring factions they're at peace with to see if i can trick them into merging more.
    Last edited by nikolai1962; 11-29-2007 at 04:15.
    It's not a map.

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