Results 1 to 30 of 85

Thread: Campaign/Diplomacy AI

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    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.

  2. #2

    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.

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

    Default Re: Campaign/Diplomacy AI

    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.
    That's pretty much what i thought about those defend settings as well. I use a mix of deep and fortified in my mod but still have garrisoning problems, mainly with some settlements being defended well(i've watched some AI wars in my mod and some of it's been very good), but other times it will only have a couple of units in a settlement. Very frustrating at times. But hopefully matching all invade decisions with a defend decision should help a bit, but i've got to work out why my AI's suddenly gone passive since doing this.

    And something for you guys to ponder over. I'm giving my campaign AI a bit of a go over, and yet it's suddenly become very passive. The only reason i can find for this is the fact that the LGTD log is showing it picking defend_fortified v every faction early in the game. Here are the defend decisions, and as you can see at the bottom is a decision that should make the AI choose defend_normal against non-neighbours.

    Code:
    			<!--
    			<decision_entry>
    					SPECIAL CASE EXISTS HERE IN CODE FOR FORCING want_peace WITH A FACTION UNDER CERTAIN CONDITIONS.  CONTINUES CHECKS FOR SUBSEQUENT DECISIONS
    			</decision_entry>
    			-->
    
    			<decision_entry>
    				<!--
    					DEFAULT: defend normal
    				-->
    				<faction_attitude	defense="defend_normal" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war,
    					then >>> defend fortified
    				-->
    				<min_entry	stance="AtWar"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If trusted ally, defend normal
    				-->
    				<min_entry	trusted_ally="true"/>
    				<max_entry	rand="0.9"/>
    				<faction_attitude	defense="defend_normal" continue="true"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					If we are allied, defend foritfied
    				-->
    				<min_entry	global_standing="0.25"/>
    				<max_entry	num_turns_allied="10" stance="Allied"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					If we are allied, defend foritfied
    				-->
    				<max_entry	num_turns_allied="3" stance="Allied"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If we have agreed to a ceasefire only a medium time ago, defend foritfied
    				-->
    				<min_entry	num_turns_ceasfire="0" stance="Neutral" global_standing="0.25"/>
    				<max_entry	num_turns_ceasfire="10" stance="Neutral"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If we have agreed to a ceasefire only a short time ago, defend normal
    				-->
    				<min_entry	num_turns_ceasfire="0" stance="Neutral"/>
    				<max_entry	num_turns_ceasfire="3" stance="Neutral"/>
    				<faction_attitude	defense="defend_normal" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If we are allied and we are very trustworthy, defend normal
    				-->
    				<min_entry	global_standing="0.5" is_neighbour="true"/>
    				<max_entry	stance="Allied" rand="0.8"/>
    				<faction_attitude	defense="defend_normal" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If we are allied, we like them a lot and we are not untrustworthy, defend normal
    				-->
    				<min_entry	faction_standing="0.5" global_standing="-0.1"/>
    				<max_entry	stance="Allied" rand="0.8"/>
    				<faction_attitude	defense="defend_normal" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If we are allied, we like them a bit and we are not very untrustworthy, defend foritfied
    				-->
    				<min_entry	faction_standing="0.25" global_standing="-0.25"/>
    				<max_entry	stance="Allied" rand="0.65"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If we are allied, we don't mind them and we are not very untrustworthy, defend foritfied
    				-->
    				<min_entry	faction_standing="0.0" global_standing="-0.25"/>
    				<max_entry	stance="Allied" rand="0.5"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If we are neutral and we like them, defend foritfied
    				-->
    				<min_entry	faction_standing="0.5" stance="Neutral"/>
    				<max_entry	stance="Neutral" rand="0.75"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If we are neutral and we like them a bit, defend foritfied
    				-->
    				<min_entry	faction_standing="0.25" stance="Neutral"/>
    				<max_entry	stance="Neutral" rand="0.5"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If we are neutral and we don't hate them, defend foritfied
    				-->
    				<min_entry	faction_standing="0.0" stance="Neutral"/>
    				<max_entry	stance="Neutral" rand="0.25"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If they are our protectorate, defend normal
    				-->
    				<min_entry	is_protectorate="true"/>
    				<faction_attitude	defense="defend_normal" continue="true"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					If they are a protectorate of a trusted ally, defend normal
    				-->
    				<min_entry	trusted_ally_protectorate="true"/>
    				<faction_attitude	defense="defend_normal" continue="true"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					if we're not at war && his frontline strength is more than twice ours && our free strength is greater than his,
    					then >>> fortified defense
    				-->
    				<min_entry	free_strength_balance="1.0"/>
    				<max_entry	frontline_balance="0.5"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && his frontline strength is more than twice ours && our free strength is less than his,
    					then >>> fortified defense
    				-->
    				<max_entry	frontline_balance="0.5" free_strength_balance="1.0"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we are his weakest neighbour && he is not at war elsewhere && we are not at war elsewhere,
    					then >>> fortified defense
    				-->
    				<min_entry	target_weakest_neighbour="true"/>
    				<max_entry	target_num_enemies="0" num_enemies="0"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we are not his weakest neighbour && he is not at war elsewhere,
    					then >>> fortified defense
    				-->
    				<max_entry	target_num_enemies="0" num_enemies="0"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war with anyone else && our frontline strength is more than
    					thrice his && overall superior >>> defend frontline
    				-->
    				<min_entry	frontline_balance="3.0" military_balance="1.0"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	defense="defend_frontline" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we are at war with someone else && our frontline strength is more than 
    					thrice his && we're 2:1 superior overall against these factions >>> defend frontline
    				-->
    				<min_entry	num_enemies="1" frontline_balance="3.0" military_balance_plus_enemies="2.0"/>
    				<max_entry	num_enemies="1"/>
    				<faction_attitude	defense="defend_frontline" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && our frontline strength is more than 
    					twice his && alliance against this faction && alliance is overall superior >>> defend frontline
    				-->
    				<min_entry	frontline_balance="2.0" has_alliance_against="true" alliance_military_balance="1.0"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	defense="defend_frontline" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && our frontline strength is more than
    					1.5 times his && we outproduce him >>> defend fortified
    				-->
    				<min_entry	frontline_balance="1.5" production_balance="1.5"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && frontline superiority && alliance against 
    					this faction && alliance is superior overall && he is strongest neighbour >>> defend fortified
    				-->
    				<min_entry	frontline_balance="1.5" has_alliance_against="true" alliance_military_balance="1.0" strongest_neighbour="true"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && our frontline strength is more than
    					twice his && he outproduces us && he is our strongest neighbour >>> defend frontline
    				-->
    				<min_entry	frontline_balance="2.0" strongest_neighbour="true" target_num_enemies="2"/>
    				<max_entry	num_enemies="0" production_balance="1.0"/>
    				<faction_attitude	defense="defend_frontline"  continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && we outproduce him && he is our strongest
    					neighbour, then >>> defend fortified
    				-->
    				<min_entry	production_balance="1.0" strongest_neighbour="true"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && we outproduce him && he is most desireable, 
    					then >>> defend fortified
    				-->
    				<min_entry	production_balance="1.0" most_desirable="true"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war with anyone else && our frontline strength is more than
    					thrice his && overall superior >>> defend frontline
    				-->
    				<min_entry	frontline_balance="2.0" military_balance="1.0" trusted_ally_enemy="true"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	defense="defend_frontline" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we are at war with someone else && our frontline strength is more than 
    					thrice his && we're 2:1 superior overall against these factions >>> defend frontline
    				-->
    				<min_entry	num_enemies="1" frontline_balance="2.0" military_balance_plus_enemies="2.0" trusted_ally_enemy="true"/>
    				<max_entry	num_enemies="1"/>
    				<faction_attitude	defense="defend_frontline" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && our frontline strength is more than 
    					twice his && alliance against this faction && alliance is overall superior >>> defend frontline
    				-->
    				<min_entry	frontline_balance="2.0" has_alliance_against="true" alliance_military_balance="1.0" trusted_ally_enemy="true"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	defense="defend_frontline" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && our frontline strength is more than
    					1.5 times his && we outproduce him >>> invade buildup
    				-->
    				<min_entry	frontline_balance="1.5" production_balance="1.5" trusted_ally_enemy="true"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	invade="invade_imediate" invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && frontline superiority && alliance against 
    					this faction && alliance is superior overall && he is strongest neighbour >>> defend fortified
    				-->
    				<min_entry	frontline_balance="1.5" has_alliance_against="true" alliance_military_balance="1.0" strongest_neighbour="true" trusted_ally_enemy="true"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && our frontline strength is more than
    					twice his && he outproduces us && he is our strongest neighbour >>> defend fortified
    				-->
    				<min_entry	frontline_balance="2.0" strongest_neighbour="true" target_num_enemies="2" trusted_ally_enemy="true"/>
    				<max_entry	num_enemies="0" production_balance="1.0"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && we outproduce him && he is our strongest
    					neighbour, then >>> defend fortified
    				-->
    				<min_entry	production_balance="1.0" strongest_neighbour="true" trusted_ally_enemy="true"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && we outproduce him && he is most desireable, 
    					then >>> defend fortified
    				-->
    				<min_entry	production_balance="1.0" most_desirable="true" trusted_ally_enemy="true"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && his frontline strength is more than twice ours && our free strength is greater than his
    					then >>> deep defense
    				-->
    				<min_entry	stance="AtWar" free_strength_balance="1.0"/>
    				<max_entry	frontline_balance="0.5"/>
    				<faction_attitude	defense="defend_deep" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && his frontline strength is less than ours && his free strength is greater than ours,
    					then >>> defend fortified
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0" production_balance="1.0"/>
    				<max_entry	free_strength_balance="0.7"/>
    				<faction_attitude	defense="defend_fortified" continue="true"/>
    			</decision_entry>	
    
    			<decision_entry>
    				<!--
    					if we're at war && we've more than five times his frontline strength && we're superior overall &&
    					we outproduce him, && IS NOT OUR SHADOW FACTION >>> defend normal
    				-->
    				<min_entry	stance="AtWar" frontline_balance="5.0" military_balance="1.0" production_balance="1.0"/>
    				<max_entry	target_is_shadow="false"/>
    				<faction_attitude	defense="defend_normal" continue="true"/>
    			</decision_entry>
    			
    			<decision_entry>
    				<!--
    					if we're at war && we've more than five times his frontline strength && we're superior overall &&
    					we outproduce him >>> defend normal
    				-->
    				<min_entry	stance="AtWar" frontline_balance="5.0" military_balance="1.0" production_balance="1.0"/>
    				<faction_attitude	defense="defend_normal" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we've more than twice his frontline strength && he outproduces us && he is 
    					at war with more than one faction, then >>> defend frontline
    				-->
    				<min_entry	stance="AtWar" frontline_balance="2.0" target_num_enemies="2"/>
    				<max_entry	production_balance="1.0"/>
    				<faction_attitude	defense="defend_frontline" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we've more than twice his frontline strength && we outproduce him && alliance
    					against this faction, then >>> defend frontline
    				-->
    				<min_entry	stance="AtWar" frontline_balance="2.0" production_balance="1.0" has_alliance_against="true"/>
    				<faction_attitude	defense="defend_frontline" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we're superior on the frontline && we outproduce him,
    					then >>> defend frontline
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0" production_balance="1.0"/>
    				<faction_attitude	defense="defend_frontline" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we're superior on the frontline && he outproduces us,
    					then >>> defend frontline
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0"/>
    				<max_entry	production_balance="1.0"/>
    				<faction_attitude	defense="defend_frontline" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && his frontline strength is more than twice ours && our free strength is greater than his
    					then >>> deep defense
    				-->
    				<min_entry	stance="AtWar" free_strength_balance="1.0" trusted_ally_enemy="true"/>
    				<max_entry	frontline_balance="0.5"/>
    				<faction_attitude	defense="defend_deep" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we've more than twice his frontline strength && he outproduces us && he is 
    					at war with more than one faction, then >>> defend frontline
    				-->
    				<min_entry	stance="AtWar" frontline_balance="2.0" trusted_ally_enemy="true"/>
    				<max_entry	production_balance="1.0"/>
    				<faction_attitude	defense="defend_frontline" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we've more than twice his frontline strength && we outproduce him && alliance
    					against this faction, then >>> defend frontline
    				-->
    				<min_entry	stance="AtWar" frontline_balance="2.0" production_balance="1.0" has_alliance_against="true"/>
    				<faction_attitude	defense="defend_frontline" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we're superior on the frontline && we outproduce him,
    					then >>> defend frontline
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0" production_balance="1.0" trusted_ally_enemy="true"/>
    				<faction_attitude	defense="defend_frontline" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we're superior on the frontline && he outproduces us,
    					then >>> defend frontline
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0" trusted_ally_enemy="true"/>
    				<max_entry	production_balance="1.0"/>
    				<faction_attitude	defense="defend_frontline" continue="true"/>
    			</decision_entry>		
    
    			<decision_entry>
    				<!--
    					if we're at war && he borders all our groups && his frontline strength is more than thrice as large as ours &&
    					his free strength is more than four times as large as ours, AND IS NOT OUR SHADOW FACTION >>> propose become protectorate
    				-->
    				<min_entry	is_neighbour="true" stance="AtWar" borders_all_our_regions="true"/>
    				<max_entry	frontline_balance="0.3" free_strength_balance="0.3" production_balance="0.5" target_is_shadow="false"/>
    				<faction_attitude	defense="defend_deep" want_peace="true" want_be_protect="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && he borders all our groups && his frontline strength is more than twice as large as ours &&
    					his free strength is greater than twice ours, && IS NOT OUR SHADOW FACTION >>> deep defense, sue for peace
    				-->
    				<min_entry	is_neighbour="true" stance="AtWar" borders_all_our_regions="true"/>
    				<max_entry	frontline_balance="0.5" free_strength_balance="0.5" target_is_shadow="false"/>
    				<faction_attitude	defense="defend_deep" want_peace="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && he borders all our groups && num settlements 1 && his frontline strength is more than thrice as large as ours &&
    					his free strength is more than four times as large as ours, AND IS NOT OUR SHADOW FACTION >>> propose become protectorate
    				-->
    				<min_entry	is_neighbour="true" stance="AtWar" borders_all_our_regions="true" num_settlements="1"/>
    				<max_entry	frontline_balance="0.7" free_strength_balance="0.7" production_balance="1.0" target_is_shadow="false"/>
    				<faction_attitude	defense="defend_deep" want_peace="true" want_be_protect="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && he borders all our groups && his frontline strength is more than thrice as large as ours &&
    					his free strength is more than four times as large as ours, AND IS NOT OUR SHADOW FACTION >>> propose become protectorate
    				-->
    				<min_entry	is_neighbour="true" stance="AtWar" num_settlements="1"/>
    				<max_entry	frontline_balance="0.5" free_strength_balance="0.5" production_balance="0.5" target_is_shadow="false"/>
    				<faction_attitude	defense="defend_deep" want_peace="true" want_be_protect="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if not our neighbour, and we have any settlements, and we are at war, and they are not a trusted allies enemy, use defaults + want peace
    				-->
    				<min_entry	num_settlements="1" stance="AtWar" />
    				<max_entry	is_neighbour="false" trusted_ally_enemy="false"/>
    				<faction_attitude	want_peace="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If they are a protectorate of a trusted ally, ally with them
    				-->
    				<min_entry	trusted_ally_protectorate="true"/>
    				<faction_attitude	want_ally="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If they are an enemy of a trusted ally, don't ally
    				-->
    				<min_entry	trusted_ally_enemy="true"/>
    				<faction_attitude	want_ally="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If alliance against, don't ally, randomised slightly.
    				-->
    				<min_entry	has_alliance_against="true" />
    				<max_entry	rand="0.65" />
    				<faction_attitude	want_ally="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					special case the slaves faction - there are all sorts of things we don't want to do with the slaves
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	defense="defend_normal"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if human, fortified defense
    				-->
    				<min_entry	num_settlements="1"/>
    				<max_entry	target_human="true"/>
    				<faction_attitude	defense="defend_fortified"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					Not interested in factions that are not our neighbour, defend normal
    				-->
    				<min_entry	is_neighbour="false"/>
    				<max_entry	is_neighbour="false"/>
    				<faction_attitude	defense="defend_normal"/>
    			</decision_entry>
    And here is my invaded decisions just incase the problem might be in them:

    Code:
    			<!--
    			<decision_entry>
    					SPECIAL CASE EXISTS HERE IN CODE FOR 'CAN_ATTACK_FACTION', NO INVASION IF SO
    			</decision_entry>
    			-->
    
    			<!--
    			DEFAULT
    			-->
    
    			<decision_entry>
    				<!--
    					DEFAULT: invade_none
    				-->
    				<faction_attitude	continue="true"/>
    			</decision_entry>
    
    			<!--
    			ANALYSIS OF DIPLOMATIC AGREEMENTS AND FACTION STANDING
    			-->
    
    			<decision_entry>
    				<!--
    					By default don't want to ally
    				-->
    				<max_entry	turn_number="10"/>
    				<faction_attitude	want_ally="false" pts_alliance="-5" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					By default don't want to ally
    				-->
    				<min_entry	turn_number="11"/>
    				<max_entry	turn_number="20"/>
    				<faction_attitude	want_ally="false" pts_alliance="-10" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					By default don't want to ally
    				-->
    				<min_entry	turn_number="21"/>
    				<faction_attitude	want_ally="false" pts_alliance="-15" continue="true"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					If trusted ally, there is a 90% chance to use defaults (no invasion), cannot force invade.  allows even trusted allies to occasionally backstab
    				-->
    				<min_entry	trusted_ally="true"/>
    				<max_entry	rand="0.9"/>
    				<faction_attitude	can_force_invade="false"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					If we are allied, are somewhat trustworthy and have only been allied for a medium duration, no invasion set up, cannot force invade
    				-->
    				<min_entry	global_standing="0.25"/>
    				<max_entry	num_turns_allied="10" stance="Allied"/>
    				<faction_attitude	can_force_invade="false"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					If we are allied and have only been allied for a short duration, no invasion set up, cannot force invade
    				-->
    				<max_entry	num_turns_allied="3" stance="Allied"/>
    				<faction_attitude	can_force_invade="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If we have agreed to a ceasefire only a medium time ago and are somewhat trustworthy, no invasion set up, cannot force invade
    				-->
    				<min_entry	num_turns_ceasfire="0" stance="Neutral" global_standing="0.25"/>
    				<max_entry	num_turns_ceasfire="10" stance="Neutral"/>
    				<faction_attitude	can_force_invade="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If we have agreed to a ceasefire only a short time ago, no invasion set up, cannot force invade
    				-->
    				<min_entry	num_turns_ceasfire="0" stance="Neutral"/>
    				<max_entry	num_turns_ceasfire="3" stance="Neutral"/>
    				<faction_attitude	can_force_invade="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If we are allied and we are very trustworthy, there is a 80% chance to use defaults (no invasion), cannot force invade, (we are a trustworthy ally)
    				-->
    				<min_entry	global_standing="0.5"/>
    				<max_entry	stance="Allied" rand="0.8"/>
    				<faction_attitude	can_force_invade="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If we are allied, we like them a lot and we are not untrustworthy, there is a 80% chance to use defaults (no invasion), cannot force invade, (we are a friendly ally)
    				-->
    				<min_entry	faction_standing="0.5" global_standing="-0.1"/>
    				<max_entry	stance="Allied" rand="0.8"/>
    				<faction_attitude	can_force_invade="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If we are allied, we like them a bit and we are not very untrustworthy, there is a 65% chance to use defaults (no invasion), cannot force invade, (we are a friendly ally)
    				-->
    				<min_entry	faction_standing="0.25" global_standing="-0.25"/>
    				<max_entry	stance="Allied" rand="0.65"/>
    				<faction_attitude	can_force_invade="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If we are allied, we don't mind them and we are not very untrustworthy, there is a 50% chance to use defaults (no invasion), (we are a partially friendly ally)
    				-->
    				<min_entry	faction_standing="0.0" global_standing="-0.25"/>
    				<max_entry	stance="Allied" rand="0.5"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If we are neutral and we like them, there is a 75% chance to use defaults (no invasion), (we are a friendly neutral)
    				-->
    				<min_entry	faction_standing="0.5" stance="Neutral"/>
    				<max_entry	stance="Neutral" rand="0.75"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If we are neutral and we like them a bit, there is a 50% chance to use defaults (no invasion), (we are a friendly neutral)
    				-->
    				<min_entry	faction_standing="0.25" stance="Neutral"/>
    				<max_entry	stance="Neutral" rand="0.5"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If we are neutral and we don't hate them, there is a 25% chance to use defaults (no invasion), (we are a partially friendly neutral)
    				-->
    				<min_entry	faction_standing="0.0" stance="Neutral"/>
    				<max_entry	stance="Neutral" rand="0.25"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If they are our protectorate, use defaults
    				-->
    				<min_entry	is_protectorate="true" />
    				<faction_attitude	can_force_invade="false"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					If they are a protectorate of a trusted ally, use defaults
    				-->
    				<min_entry	trusted_ally_protectorate="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If they are the papal states and they like us, use defaults
    					(using their FS instead of ours, else it may not fire since papal states does not try to upset catholics)
    				-->
    				<min_entry	target_faction="papal_states" target_faction_standing="-0.5"/>
    				<max_entry	target_faction="papal_states"/>
    			</decision_entry>
    				
    			<decision_entry>
    				<!--
    					If we have a cease hostilities mission against the target, and we like them above a threshold, and our global standing is reasonable, use defaults
    					(this will stop factions from attacking some targets if it will cause excommunication)
    				-->
    				<min_entry	faction_standing="-0.25" has_ceasehostilities="true" global_standing="-0.25"/>
    			</decision_entry>
    				
    			<decision_entry>
    				<!--
    					If we have a cease hostilities mission against the target, 50% chance to use defaults
    					(this will reduce chance of factions attacking some targets if it will cause excommunication)
    				-->
    				<min_entry	has_ceasehostilities="true"/>
    				<max_entry	rand="0.5"/>
    			</decision_entry>
    		
    			<decision_entry>
    				<!--
    					Not interested in factions that are not our neighbour, use defaults, may be overridden by forced/naval attacks
    				-->
    				<max_entry	is_neighbour="false"/>
    			</decision_entry>
    
    
    			<decision_entry>
    				<!--
    					if we're at war,
    					then >>> invade opportunistic
    				-->
    				<min_entry	stance="AtWar"/>
    				<faction_attitude	invade_priority="1000" continue="true"/>
    			</decision_entry>	
    		
    			<decision_entry>
    				<!--
    					if we're not at war and it is very early in the game, do not invade (grabbing rebel regions instead)
    				-->
    				<max_entry	stance="Neutral" turn_number="10"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && his frontline strength is more than twice ours && our free strength is greater than his,
    					then >>> invade none
    				-->
    				<min_entry	is_neighbour="true" free_strength_balance="1.0"/>
    				<max_entry	frontline_balance="0.5"/>
    				<faction_attitude	invade="invade_none" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && his frontline strength is more than twice ours && our free strength is less than his,
    					then >>> fortified defense
    				-->
    				<max_entry	is_neighbour="true" frontline_balance="0.5" free_strength_balance="1.0"/>
    				<faction_attitude	invade="invade_none" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we are his weakest neighbour && he is not at war elsewhere && we are not at war elsewhere,
    					then >>> frontline defense
    				-->
    				<min_entry	target_weakest_neighbour="true"/>
    				<max_entry	target_num_enemies="0" num_enemies="0"/>
    				<faction_attitude	invade="invade_none" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we are not his weakest neighbour && he is not at war elsewhere,
    					then >>> normal defense
    				-->
    				<max_entry	target_num_enemies="0" num_enemies="0"/>
    				<faction_attitude	invade="invade_none" continue="true"/>
    			</decision_entry>
    
    			<!--
    			ALLY AGAINST
    			-->		
    
    			<decision_entry>
    				<!--
    					if we're at war,
    					then >>> alliance against
    				-->
    				<min_entry	stance="AtWar"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if slaves,
    					then >>> alliance against
    				-->
    				<min_entry	target_faction="slave"/>
    				<faction_attitude	alliance_against="-3" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && we outproduce him && he is our strongest
    					neighbour, then >>> alliance against
    				-->
    				<min_entry	strongest_neighbour="true"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && we outproduce him && he is most desireable, 
    					then >>> alliance against
    				-->
    				<min_entry	most_desirable="true"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && he borders all our groups && his frontline strength is more than thrice as large as ours &&
    					his free strength is more than four times as large as ours, AND IS NOT OUR SHADOW FACTION >>> alliance against
    				-->
    				<min_entry	stance="AtWar" borders_all_our_regions="true"/>
    				<max_entry	frontline_balance="0.3" free_strength_balance="0.3" production_balance="0.5" target_is_shadow="false"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && he borders all our groups && his frontline strength is more than twice as large as ours &&
    					his free strength is greater than twice ours, && IS NOT OUR SHADOW FACTION >>> alliance against
    				-->
    				<min_entry	stance="AtWar" borders_all_our_regions="true"/>
    				<max_entry	frontline_balance="0.5" free_strength_balance="0.5" target_is_shadow="false"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && he borders all our groups && his frontline strength is more than twice as large as ours &&
    					his free strength is greater than twice ours >>> alliance against
    				-->
    				<min_entry	stance="AtWar" borders_all_our_regions="true"/>
    				<max_entry	frontline_balance="0.5" free_strength_balance="0.5"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && his frontline strength is more than twice ours && our free strength is greater than his
    					then >>> alliance against
    				-->
    				<min_entry	stance="AtWar" free_strength_balance="1.0"/>
    				<max_entry	frontline_balance="0.5"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && his frontline strength is less than ours && his free strength is greater than ours,
    					then >>> alliance against
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0" production_balance="1.0"/>
    				<max_entry	free_strength_balance="0.7"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we're superior on the frontline && he outproduces us,
    					then >>> alliance against
    				-->
    				<min_entry	stance="AtWar" frontline_balance="1.0"/>
    				<max_entry	production_balance="1.0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && our frontline strength is more than
    					1.5 times his && we outproduce him >>> alliance against
    				-->
    				<min_entry	frontline_balance="1.5" production_balance="1.5"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && our frontline strength is more than
    					twice his && he outproduces us && he is our strongest neighbour >>> alliance against
    				-->
    				<min_entry	frontline_balance="2.0" strongest_neighbour="true" target_num_enemies="2"/>
    				<max_entry	num_enemies="0" production_balance="1.0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && we outproduce him && he is our strongest
    					neighbour, then >>> alliance against
    				-->
    				<min_entry	production_balance="1.0" strongest_neighbour="true"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && we outproduce him && he is most desireable, 
    					then >>> alliance against
    				-->
    				<min_entry	production_balance="1.0" most_desirable="true"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<!--
    			DECIDE WHO TO INVADE
    			-->
    
    			<decision_entry>
    				<!--
    					if target is non-excommunicated catholic faction, and they don't mind us much, and they are not obviously untrustworthy, minimal defense required
    				-->
    				<min_entry	target_religion="catholic" target_faction_standing="-0.1" target_global_standing="-0.1"/>
    				<max_entry	stance="Neutral" target_religion="catholic" enemy_excommunicated="false" excommunicated="false"/>
    				<faction_attitude	invade_priority="-800" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if target is non-excommunicated catholic faction, and they don't mind us much, and they are not obviously untrustworthy, minimal defense required
    				-->
    				<min_entry	target_religion="catholic"/>
    				<max_entry	stance="Neutral" target_religion="catholic" enemy_excommunicated="false" excommunicated="false"/>
    				<faction_attitude	invade_priority="-800" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war with anyone else && our frontline strength is more than
    					thrice his && overall superior >>> invade immediate
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="3.0" military_balance="1.0"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we are at war with someone else && our frontline strength is more than 
    					thrice his && we're 2:1 superior overall against these factions >>> invade immediate
    				-->
    				<min_entry	is_neighbour="true" num_enemies="1" frontline_balance="3.0" military_balance_plus_enemies="2.0"/>
    				<max_entry	num_enemies="1"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="45" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && our frontline strength is more than 
    					twice his && alliance against this faction && alliance is overall superior >>> invade immediate
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="2.0" has_alliance_against="true" alliance_military_balance="1.0"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="40" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && our frontline strength is more than
    					1.5 times his && we outproduce him >>> invade buildup
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="1.5" production_balance="1.5"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	invade="invade_buildup" invade_priority="35" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && frontline superiority && alliance against 
    					this faction && alliance is superior overall && he is strongest neighbour >>> invade opportunistic
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="1.5" has_alliance_against="true" alliance_military_balance="1.0" strongest_neighbour="true"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	invade="invade_opportunistic" invade_priority="30" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && our frontline strength is more than
    					twice his && he outproduces us && he is our strongest neighbour >>> invade raids
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="2.0" strongest_neighbour="true" target_num_enemies="2"/>
    				<max_entry	num_enemies="0" production_balance="1.0"/>
    				<faction_attitude	invade="invade_buildup" invade_priority="25" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && we outproduce him && he is our strongest
    					neighbour, then >>> plan future invasion
    				-->
    				<min_entry	production_balance="1.0" strongest_neighbour="true"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	invade="invade_buildup" invade_priority="20" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && we outproduce him && he is most desireable, 
    					then >>> plan future invasion
    				-->
    				<min_entry	production_balance="1.0" most_desirable="true"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	invade="invade_buildup" invade_priority="15" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war with anyone else && our frontline strength is more than
    					thrice his && overall superior >>> invade immediate
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="2.0" military_balance="1.0" trusted_ally_enemy="true"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we are at war with someone else && our frontline strength is more than 
    					thrice his && we're 2:1 superior overall against these factions >>> invade immediate
    				-->
    				<min_entry	is_neighbour="true" num_enemies="1" frontline_balance="2.0" military_balance_plus_enemies="2.0" trusted_ally_enemy="true"/>
    				<max_entry	num_enemies="1"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="45" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && our frontline strength is more than 
    					twice his && alliance against this faction && alliance is overall superior >>> invade immediate
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="2.0" has_alliance_against="true" alliance_military_balance="1.0" trusted_ally_enemy="true"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="60" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && our frontline strength is more than
    					1.5 times his && we outproduce him >>> invade buildup
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="1.5" production_balance="1.5" trusted_ally_enemy="true"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	invade="invade_imediate" invade_priority="50" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && frontline superiority && alliance against 
    					this faction && alliance is superior overall && he is strongest neighbour >>> invade opportunistic
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="1.5" has_alliance_against="true" alliance_military_balance="1.0" strongest_neighbour="true" trusted_ally_enemy="true"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="45" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && our frontline strength is more than
    					twice his && he outproduces us && he is our strongest neighbour >>> invade raids
    				-->
    				<min_entry	is_neighbour="true" frontline_balance="2.0" strongest_neighbour="true" target_num_enemies="2" trusted_ally_enemy="true"/>
    				<max_entry	num_enemies="0" production_balance="1.0"/>
    				<faction_attitude	invade="invade_buildup" invade_priority="40" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && we outproduce him && he is our strongest
    					neighbour, then >>> plan future invasion
    				-->
    				<min_entry	production_balance="1.0" strongest_neighbour="true" trusted_ally_enemy="true"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	invade="invade_buildup" invade_priority="35" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're not at war && we're not at war with anyone else && we outproduce him && he is most desireable, 
    					then >>> plan future invasion
    				-->
    				<min_entry	production_balance="1.0" most_desirable="true" trusted_ally_enemy="true"/>
    				<max_entry	num_enemies="0"/>
    				<faction_attitude	invade="invade_buildup" invade_priority="30" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					makes ai more aggressive
    				-->
    				<min_entry	frontline_balance="2.0" is_neighbour="true" production_balance="2.0" military_balance="2.0"/>
    				<faction_attitude	invade_priority="200" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					makes ai more aggressive
    				-->
    				<min_entry	frontline_balance="2.5" is_neighbour="true" production_balance="2.5" military_balance="2.5"/>
    				<faction_attitude	invade_priority="200" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					makes ai more aggressive
    				-->
    				<min_entry	frontline_balance="3.0" is_neighbour="true" production_balance="3.0" military_balance="3.0"/>
    				<faction_attitude	invade_priority="200" continue="true"/>
    			</decision_entry>
    
    			<!--
    			MAKE SURE NOT TOO MANY FRONTS
    			-->
    
    			<decision_entry>
    				<!--
    					Reduce invade priority if at war with more than 1 enemies
    				-->
    				<min_entry	num_enemies="1"/>
    				<faction_attitude	invade_priority="-400" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					Reduce invade priority if at war with more than 2 enemies
    				-->
    				<min_entry	num_enemies="2"/>
    				<faction_attitude	invade_priority="-400" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					Reduce invade priority if at war with more than 3 enemies
    				-->
    				<min_entry	num_enemies="3"/>
    				<faction_attitude	invade_priority="-400" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					Reduce invade priority if at war with more than 4 enemies
    				-->
    				<min_entry	num_enemies="4"/>
    				<faction_attitude	invade_priority="-400" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If human and difficulty easy, less likely to attack.
    				-->
    				<max_entry	target_human="true" difficulty="easy"/>
    				<faction_attitude	invade_priority="-100" alliance_against="-1" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If human and difficulty medium, no difference
    				-->
    				<max_entry	target_human="true" difficulty="medium"/>
    				<faction_attitude	invade_priority="0" alliance_against="0" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If human and difficulty hard, less likely to attack.
    				-->
    				<max_entry	target_human="true" difficulty="hard"/>
    				<faction_attitude	invade_priority="200" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					If human and difficulty very hard, less likely to attack.
    				-->
    				<max_entry	target_human="true" difficulty="very_hard"/>
    				<faction_attitude	invade_priority="400" alliance_against="1" continue="true"/>
    			</decision_entry>
    
    			<!--
    			INVADE DECISIONS
    			-->
    
    			<decision_entry>
    				<!--
    					if we're at war,
    					then >>> invade opportunistic
    				-->
    				<min_entry	stance="AtWar"/>
    				<faction_attitude	invade="invade_opportunistic" invade_priority="55" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && his frontline strength is more than twice ours && our free strength is greater than his
    					then >>> deep defense
    				-->
    				<min_entry	is_neighbour="true" stance="AtWar" free_strength_balance="1.0"/>
    				<max_entry	frontline_balance="0.5"/>
    				<faction_attitude	invade="invade_opportunistic" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && his frontline strength is less than ours && his free strength is greater than ours,
    					then >>> conduct raids
    				-->
    				<min_entry	is_neighbour="true" stance="AtWar" frontline_balance="1.0" production_balance="1.0"/>
    				<max_entry	free_strength_balance="0.7"/>
    				<faction_attitude	invade="invade_buildup" continue="true"/>
    			</decision_entry>	
    
    			<decision_entry>
    				<!--
    					if we're at war && we've more than five times his frontline strength && we're superior overall &&
    					we outproduce him, && IS NOT OUR SHADOW FACTION >>> propose he become vassal, invade immediate.  If not our shadow, also want to offer protectorate
    				-->
    					<min_entry	is_neighbour="true" stance="AtWar" frontline_balance="5.0" military_balance="1.0" production_balance="1.0"/>
    				<max_entry	target_is_shadow="false"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="80" want_offer_protect="true"/>
    			</decision_entry>
    			
    			<decision_entry>
    				<!--
    					if we're at war && we've more than five times his frontline strength && we're superior overall &&
    					we outproduce him >>> propose he become vassal, invade immediate.  If our shadow, do not want to offer protectorate
    				-->
    				<min_entry	is_neighbour="true" stance="AtWar" frontline_balance="5.0" military_balance="1.0" production_balance="1.0"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="80" want_offer_protect="false"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we've more than twice his frontline strength && he outproduces us && he is 
    					at war with more than one faction, then >>> invade immediate
    				-->
    				<min_entry	is_neighbour="true" stance="AtWar" frontline_balance="2.0" target_num_enemies="2"/>
    				<max_entry	production_balance="1.0"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we've more than twice his frontline strength && we outproduce him && alliance
    					against this faction, then >>> invade immediate
    				-->
    				<min_entry	is_neighbour="true" stance="AtWar" frontline_balance="2.0" production_balance="1.0" has_alliance_against="true"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="70" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we're superior on the frontline && we outproduce him,
    					then >>> invade buildup
    				-->
    				<min_entry	is_neighbour="true" stance="AtWar" frontline_balance="1.0" production_balance="1.0"/>
    				<faction_attitude	invade="invade_buildup" invade_priority="65" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we're superior on the frontline && he outproduces us,
    					then >>> invade raids
    				-->
    				<min_entry	is_neighbour="true" stance="AtWar" frontline_balance="1.0"/>
    				<max_entry	production_balance="1.0"/>
    				<faction_attitude	invade="invade_builup" invade_priority="60" continue="true"/>
    			</decision_entry>
    
    			<!--
    			TRUSTED ALLY INVADE DECISIONS
    			-->
    
    
    			<decision_entry>
    				<!--
    					if we're at war,
    					then >>> invade opportunistic
    				-->
    				<min_entry	stance="AtWar" trusted_ally_enemy="true"/>
    				<faction_attitude	invade="invade_opportunistic" invade_priority="55" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && his frontline strength is more than twice ours && our free strength is greater than his
    					then >>> deep defense
    				-->
    				<min_entry	is_neighbour="true" stance="AtWar" free_strength_balance="1.0" trusted_ally_enemy="true"/>
    				<max_entry	frontline_balance="0.5"/>
    				<faction_attitude	invade="invade_immediate" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we've more than twice his frontline strength && he outproduces us && he is 
    					at war with more than one faction, then >>> invade immediate
    				-->
    				<min_entry	is_neighbour="true" stance="AtWar" frontline_balance="2.0" trusted_ally_enemy="true"/>
    				<max_entry	production_balance="1.0"/>
    				<faction_attitude	invade="invade_buildup" invade_priority="75" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we've more than twice his frontline strength && we outproduce him && alliance
    					against this faction, then >>> invade immediate
    				-->
    				<min_entry	is_neighbour="true" stance="AtWar" frontline_balance="2.0" production_balance="1.0" has_alliance_against="true"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="70" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we're superior on the frontline && we outproduce him,
    					then >>> invade buildup
    				-->
    				<min_entry	is_neighbour="true" stance="AtWar" frontline_balance="1.0" production_balance="1.0" trusted_ally_enemy="true"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="65" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					if we're at war && we're superior on the frontline && he outproduces us,
    					then >>> invade raids
    				-->
    				<min_entry	is_neighbour="true" stance="AtWar" frontline_balance="1.0" trusted_ally_enemy="true"/>
    				<max_entry	production_balance="1.0"/>
    				<faction_attitude	invade="invade_opportunistic" invade_priority="60" continue="true"/>
    			</decision_entry>	
    
    			<decision_entry>
    				<!--
    					special case the slaves faction - there are all sorts of things we don't want to do with the slaves
    				-->
    				<min_entry	target_faction="slave"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	invade="invade_opportunistic" invade_priority="1500" can_force_invade="true" continue="true"/>
    			</decision_entry>
    
    
    			<decision_entry>
    				<!--
    					special case the slaves faction - there are all sorts of things we don't want to do with the slaves
    					if we're superior on the frontline,	then >>> invade buildup
    				-->
    				<min_entry	target_faction="slave" frontline_balance="1.0"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	invade="invade_buildup" invade_priority="1500" can_force_invade="true" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					special case the slaves faction - there are all sorts of things we don't want to do with the slaves
    					if we've more than twice his frontline strength, then >>> invade immediate
    				-->
    				<min_entry	target_faction="slave" frontline_balance="2.0"/>
    				<max_entry	target_faction="slave"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="1500" can_force_invade="true" continue="true"/>
    			</decision_entry>
    
    			<decision_entry>
    				<!--
    					special case the slaves faction - there are all sorts of things we don't want to do with the slaves
    				-->
    				<min_entry	target_faction="slave" frontline_balance="1.25"/>
    				<max_entry	turn_number="30" target_faction="slave"/>
    				<faction_attitude	invade="invade_immediate" invade_priority="2000" can_force_invade="true" continue="true"/>
    			</decision_entry>
    			
    			<!--
    			<decision_entry>
    					SPECIAL CASE EXISTS HERE IN CODE FOR FORCING ATTACK ON HUMAN IF AT PEACE WITH EVERYONE FOR TOO LONG (hard = 4 turns, normal = 10 turns, easy = 20 turns)
    			</decision_entry>
    			-->
    Last edited by Lusted; 11-29-2007 at 14:25.

  4. #4

    Default Re: Campaign/Diplomacy AI

    I belive true/false is considered by it's numeric equivilents (0/1) so this entry:
    <decision_entry>
    <!--
    if human, fortified defense
    -->
    <min_entry num_settlements="1"/>
    <max_entry target_human="true"/>
    <faction_attitude defense="defend_fortified"/>
    </decision_entry>
    True > false so it is always returning a true argument, and not continuing. Try entering a min_entry target_human or commenting this argument out compleatly and test. I'd also continue this argument as 'fortified' against a non-neighbour is as confusing for the AI as 'frontline.'

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

    Default Re: Campaign/Diplomacy AI

    True > false so it is always returning a true argument, and not continuing. Try entering a min_entry target_human or commenting this argument out compleatly and test.
    Thanks for the help, i'll give it a go.

    I'd also continue this argument as 'fortified' against a non-neighbour is as confusing for the AI as 'frontline.'
    Shoud be a is_neighbour="true", i had that in a lot of the defense entries but that was causing a crash so i removed mosty of them. Must have forgot to add it back in for that.

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

    Default Re: Campaign/Diplomacy AI

    Hmm, still getting completely passive AI even though that change worked, which is alarming given the fact my AI's gone from very quick early expansion to none at all.

    Here's my system.log.txt if you wan to have a look at it.

    http://uploaded.to/?id=8bymje

  7. #7

    Default Re: Campaign/Diplomacy AI

    Sorry, dial-up, anything much over 1 meg is beyond my capacity to download.

    Is the AI truly pasive or just over cautious?

    Without being able to see the LTGD, I suggest:
    <decision_entry>
    <!--
    special case the slaves faction - there are all sorts of things we don't want to do with the slaves
    -->
    <min_entry target_faction="slave"/>
    <max_entry target_faction="slave"/>
    <faction_attitude defense="defend_normal"/>
    </decision_entry>
    Seperate into is_neighbour and assign defend frontline, otherwise defend minimal. Since the slave faction will not appear on num_enemies, you could also dictate is_neighbour defence to require num_enemise 0 else defend normal, so thier slave neighbours dont take too much of thier attention if they have other enemies.

    I would also assign all slave faction dealings as the first entries for both defence and offence so you know non of your other decisions are applied to the slave faction. I also, in contrast to all other factions, would assign constant invade priority to the slave faction and not use continue at all, or very little. I'd also put at_war="true" on them somewhere, preferably everywhere (read posts 10-12)

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