Diplomacy/AI bit
Most of the above changes are either to help the early AI expansion or to suit my personal preferences but the diplomacy bit may be of interest to other players, plus as i mentioned it needs different people with different play-styles to test that aspect thoroughly.
There are a *lot* of numbers that need to be juggled right to get this to work right. But it might be possible to get a decent-ish diplomacy system with a lot of juggling.
Aim:
I think there are broadly three different play styles:
1. Turtle - try to keep the neighbour AI from bugging you while you potter about building up your cities.
2. Cautious expander - expanding, but slow and steady, biting off small chunks at a time then trying to make peace with everyone again before the next bite.
3. Blitzing - i'll call that reckless expander from now on.
So want i want to achieve is:
1. AI profiles that match those three strategies
2. Switching AI profiles when a faction leader dies.
2. A diplomacy system that fits in with those three playstyles.
I'm aiming for the base three types of profile mentioned above with some variations for faction and era. I want an early set which is heavily influenced by religion and a later set where religion is less critical.
So there'll be "early_defensive_catholic", "early_reckless_islam", "late_cautious_orthodox" etc and they'll be switched over time as the faction leaders change.
The mod is currently set up with all the factions using the latest version of early_defensive. The reckless AI will be pretty much the same as the vanilla default AI. The cautious AI will be a hybrid of defensive and reckless so if I can get the defensive working just right then finishing the others will be easy.
Details
1. An alliance isn't an alliance in the normal sense of the word unless it's a trusted alliance. Otherwise it's just a promise to not attack for 12 turns.
2. A trusted alliance is where both allies are at least "reliable" in reputation and where the faction relationship is at least "very good". The system revolves around this.
3. The defensive AI profile is designed around the AI faction being a turtle type player who uses diplomacy defensively to protect their borders. They aim to maintain their global reputation and standing with pope (if applicable) so they can get and maintain trusted alliances for defensive purposes. Expansion is a secondary motive with this profile.
What the defensive AI will and won't do:
Things that stop them attacking:
Rebels are high priority if at peace, mostly ignored if at war.
Won't attack the pope.
Won't attack their protectorate.
Won't attack a trusted ally.
Won't attack a trusted ally's protectorate.
Won't attack a non-trusted ally for minimum of 12 turns after alliance declared.
Won't attack factions they want as an ally.
If they're down to just one settlement they won't attack anyone but rebels.
Won't attack anyone else if they're already in a war.
Won't attack anyone if their reputation is below very reliable.
Won't attack if they have a cease hostilities from the pope.
Won't attack if they've been excommunicated.
Won't attack for a minimum number of turns after a ceasefire (4 if catholic/islam, 6 if catholic/orthodox or orthodox/islam, 8 if same religion)
Papal states don't attack at all unless they have an excommunicated/islam/orthodox neighbour.
If none of the above list applies then...
Things that make them attack:
1. They are very likely to come help a trusted ally.
2. A faction that has a global reputation of very untrustworthy or worse.
3. A neutral faction they have a "poor" or worse relationship with.
4. A non-trusted ally faction they have a "very poor" or worse relationship with.
5. Small random chance to simulate accidental border dispute type wars (only between neutrals not allies)
They'll attack non-trusted allies if the faction relationship is bad enough (case 3) but they'll wait till their global rep is trustworthy so they can take the reputation penalty for attacking an ally.
If they decide to attack they'll only do so if they think they have 2:1 odds on the frontline except if they're aiding a trusted ally in which case they attack with whatever is available.
Things that make them want peace if they're at war:
If they get two enemies at once
If their reputation drops below mixed
If the pope tells them to.
If they get excommunicated (doesn't seem to happen now but might glitch occasionally)
If they think the frontline odds are 2:1 against them.
Random chance to simulate real-life things like running out of supplies/bad weather etc
Exceptions:
Even with the defensive profile, if a faction gets to 12+ regions they will take a few more risks.
1. Chance of ignoring a papal cease fire.
2. Chance of fighting on for a while if they get excommunicated. Will stop and turtle to recover their rep after a while.
3. Will fight two enemies at once for a while (random chance of wanting ceasefire) but won't do it for long.
4. Higher chance of the random border dispute wars with neutrals.
5. Only need a minimum of a "So So" relationship with a neutral and a "Poor" relationship with a non-trusted ally to consider attacking.
Vassals:
Simplified this as i like vassals and don't like to see factions destroyed completely.
AI factions will accept being a vassal when.
1. They are down to one settlement, at war with a neighbouring faction and out-numbered on the frontline 2:1
2. They are down to two settlements, at war with a neighbouring faction and out-numbered on the frontline either 3:1 or 5:1 (still experimenting with the conditions on this but 5:1 is the maximum neccessary)
Vassals are currently only accepted between same religion and catholic/orthodox. This is to stop factions blocking themselves as the AI doesn't usually expand through their own vassals. Will change this if i can figure out a way to prevent the Turks/Moors potentially blocking themselves in.
Allies:
Still experimenting with this but currently it's very simple
1. Muslim factions seek to ally with muslim factions.
2. Orthodox factions seek to ally with orthodox factions.
3. Up to turn 12 the catholic factions seek to ally with any catholic neighbours.
4. After turn 12 they only seek to ally with any catholic faction where their relations are good or above.
note 1. This doesn't stop you allying with them. This just controls who they ask to be an ally.
note 2. The pope doesn't like it if you ally with a non-catholic. I've done the code that drops your relationship with the papal-states but haven't coded the "break alliance" missions yet.
note 3. I want the early defensive profile to be heavily influenced by religion. If the system is working right then in the early game the AI vs AI fighting should be mostly along the religious borders.
I think that's the basic design in words. I'll keep this post edited with anything I've forgotten.
Gameplay aspects.
What I want is for the system to fit the three play-styles so that
1. If you're turtling it is possible (but not too easy) to keep your neighbours from bugging you using diplomacy.
2. If you're slowly expanding it is possible (but not too easy) to get to fight one faction at a time using diplomacy.
3. If you're blitzing the amount of cash from sacking as you go isn't enough to allow you to use diplomacy to stop the other factions all ganging up on you
Critical levels:
Non-trusted allies may attack if your relations drop below very poor.
Non-trusted allies with 12+ regions may attack if your relations drop below poor.
Neutrals may attack you if your relations drop below poor.
Neutrals with 12+ regions may attack you if your relations drop below so-so.
Trusted allies of a faction you are at war with will usually attack you eventually but not if your relations with them are "very good" or above.
Factions may attack you if your global rep is below "very untrustworthy".
Trusted alliances require both parties to have "reliable" reputations or above and at least a "very good" relationship.
I'll use the third post to detail the numbers being used.
Bookmarks