The AI is going to betray you sooner than later. Sometimes alliances hold if the AI has better things to do with his armies than fight against you. Keeping large garrisons on the mutual border discourages the AI from breaking the alliances.
For example I saw that the byzantines where coming to my territory. I quickly hired as much mercenaries as I could and hired more troops. Once the AI saw this they returned to their territory. We where allied but he clearly wanted to attack me.
If you have strong carrisons the AI wil go around this normally by blocking your harbour. Sometimes this feateure seems very stupid like the AI didn't even mean to start the war but he just had to block my harbour.
The diplomacy itself is quite easy. When making peacefull propositions allways try to get the proposition to balanced. If you have generous or very generous suggestion add a regular tripute to it and you can make a very good income for several turns. The only thing that might prevent this is that the other nation is broke during that turn. Wait for the next one.
Also you cannot make alliances with someone if you are already allied with their enemy. The AI will allways refuse it.
If you can't make a deal in ther first proposition and get toally turned down wait for the next turn. AI seems to allways reject the second proposition too.
When making peace try to get more military power to the enemy's territory than he has. That makes him very willing to make peace and even give you regions if the AI calculates that he has no other choice. If you are attacking with only one army you will most likely get turned down.
Bookmarks