According to the game guide, an Alliance is an obligation to help with War if your ally gets into one.
However, there are some not obvious cases where conflicting interests might blur the action that should be taken.
Currently, the following code parts exist that deal with this :
1. When the Human Player asks the AI ally to declare war on a target, and they are at war with the target themselves, the AI player will always accept the proposal without a roll (they might demand gold at random, and if the player is low on gold this does cause a refusal, simply try again until they accept without demanding gold).
Starting from RC13 and the latest CoM, there is a slight alteration here : if there is an ongoing Peace Treaty between the two AI wizards, the proposal will be refused, to provide consistency with the below effect and prevent abuse by immediately asking this again once the AI players sign peace.
2. When an AI player is allied with someone, and that someone is at war with someone else, they'll declare war on their ally's enemy at a random chance (or break their treaty if there was one).
This cannot happen if there is a Peace Treaty, or another Alliance between the AI player and the target. This code simulates the AI's willingness to help out allies on their own without a request, as well as serving as a replacement for the AI player's request of war declaration between each other. They'll just do so without being asked.
This part works as intended and needs no changes I believe.
3.When an AI player is allied with another AI player who is at war with a third AI player, they'll declare war immediately.
This one was removed because the previous one does the same thing but better, as it works on everyone, and considers peace treaties.
4.When an AI player is allied with two other AI players, and they are at war with each other, both of those AI players will break the Alliance towards the first.
Now this is one which I have large doubts about.
First, this only works if all parties involved are AIs. The human player can maintain an Alliance with an AI who is allied to their enemy, and neither Alliance breaks. Their enemy will demand to break the Alliance when they want to propose a peace treaty, but that's all, and there is no real reason for the player to ever accept that, and if they want the peace, they can propose it on their own.
So basically, the human player has a huge advantage here, as they are allowed to maintain Alliances under a condition the AI player isn't allowed to. Eventually, they can also demand their ally to break the Alliance towards the other AI player, gaining further advantage, while the AI cannot ask the other AI to break the Alliance towards the player, see 2.
I believe either this check need to be completely eliminated, allowing AI players to maintain alliances with two people who are at war simultaneously, OR the AI players should be able to make each other break the Alliance through "2." in this situation which works against the human player as well. (In which case "4." also serves no purpose as they would break the alliance through "2." instead even between only AI players!)
Additionally, this check is actually buggy. It will only work if the player having the two Alliances has the lowest player ID of the three players involved! You can see in the latest Hadriex video that Flandre is maintaining an Alliance with player 1 and 3, despite them being at war, as she is player 2.
Speaking of Break Alliance and Declare War demands....neither considers the army strength of the target, which might or might not be a good thing.
If you are a lot stronger than AI 1 but much weaker than AI 2, you can force AI 1 to break alliance or declare war on AI 2.
This means that
-You can manipulate other weak AIs to help you against the strongest player, fighting him together, which is generally beneficial to everyone in the world, except the strong wizard of course.
-But also means that a weak AI will turn against someone much stronger than themselves, which is obviously bad for them.
I think it should at the very least consider the army strength when asking for a Break Alliance, and not do so if the ally is stronger, but...if the above changes to "2." and "4." are done, this is meaningless as they would do it anyway at a random chance, pretty much making it a 50-50 for breaking their alliance with the player, or the strong AI. So it might be better to leave this unchanged (giving the player a chance to unite the world against a large threat) and go for the changes to "2." and "4." instead.
Edit :
I've decided to remove "4." because it doesn't work correctly anyway.
I've also decided to implement the army size checks for "Break Alliance" and "Declare War" proposals. It's not fair that the player's army is considered, but the target's is not.
The only remaining question :
Should the AI that holds an alliance with two other players (human or not) who are at war with each other
a., randomly break one of the alliances, and eventually proceed to join the war on one side, fighting against the other
b., do nothing at all and wait it out, why get involved?
"b" would be more beneficial to the AI, and to an extent it also helps the human player (enemies won't be able to turn your allies against you), but it's unfair in a sense as being in this situation as the human player will make the AI allies ask you to break your alliances periodically, potentially making you lose both if no action is taken, whereas AI players don't do this towards each other. On the other hand, the player can force the AI ally to break their alliance eventually, if their army strength gets high enough, without the other AI being able to do the same against the player.
"a" would be fair to all sides, but a major game changer, whichever Alliance the AI breaks will have a huge impact on the chances of the human player to win, and would make Alliances a lot less stable than they are now.
So, in short , do we want the AI to get away with maintaining these conflicting alliances simultaneously, or not?
However, there are some not obvious cases where conflicting interests might blur the action that should be taken.
Currently, the following code parts exist that deal with this :
1. When the Human Player asks the AI ally to declare war on a target, and they are at war with the target themselves, the AI player will always accept the proposal without a roll (they might demand gold at random, and if the player is low on gold this does cause a refusal, simply try again until they accept without demanding gold).
Starting from RC13 and the latest CoM, there is a slight alteration here : if there is an ongoing Peace Treaty between the two AI wizards, the proposal will be refused, to provide consistency with the below effect and prevent abuse by immediately asking this again once the AI players sign peace.
2. When an AI player is allied with someone, and that someone is at war with someone else, they'll declare war on their ally's enemy at a random chance (or break their treaty if there was one).
This cannot happen if there is a Peace Treaty, or another Alliance between the AI player and the target. This code simulates the AI's willingness to help out allies on their own without a request, as well as serving as a replacement for the AI player's request of war declaration between each other. They'll just do so without being asked.
This part works as intended and needs no changes I believe.
3.When an AI player is allied with another AI player who is at war with a third AI player, they'll declare war immediately.
This one was removed because the previous one does the same thing but better, as it works on everyone, and considers peace treaties.
4.When an AI player is allied with two other AI players, and they are at war with each other, both of those AI players will break the Alliance towards the first.
Now this is one which I have large doubts about.
First, this only works if all parties involved are AIs. The human player can maintain an Alliance with an AI who is allied to their enemy, and neither Alliance breaks. Their enemy will demand to break the Alliance when they want to propose a peace treaty, but that's all, and there is no real reason for the player to ever accept that, and if they want the peace, they can propose it on their own.
So basically, the human player has a huge advantage here, as they are allowed to maintain Alliances under a condition the AI player isn't allowed to. Eventually, they can also demand their ally to break the Alliance towards the other AI player, gaining further advantage, while the AI cannot ask the other AI to break the Alliance towards the player, see 2.
I believe either this check need to be completely eliminated, allowing AI players to maintain alliances with two people who are at war simultaneously, OR the AI players should be able to make each other break the Alliance through "2." in this situation which works against the human player as well. (In which case "4." also serves no purpose as they would break the alliance through "2." instead even between only AI players!)
Additionally, this check is actually buggy. It will only work if the player having the two Alliances has the lowest player ID of the three players involved! You can see in the latest Hadriex video that Flandre is maintaining an Alliance with player 1 and 3, despite them being at war, as she is player 2.
Speaking of Break Alliance and Declare War demands....neither considers the army strength of the target, which might or might not be a good thing.
If you are a lot stronger than AI 1 but much weaker than AI 2, you can force AI 1 to break alliance or declare war on AI 2.
This means that
-You can manipulate other weak AIs to help you against the strongest player, fighting him together, which is generally beneficial to everyone in the world, except the strong wizard of course.
-But also means that a weak AI will turn against someone much stronger than themselves, which is obviously bad for them.
I think it should at the very least consider the army strength when asking for a Break Alliance, and not do so if the ally is stronger, but...if the above changes to "2." and "4." are done, this is meaningless as they would do it anyway at a random chance, pretty much making it a 50-50 for breaking their alliance with the player, or the strong AI. So it might be better to leave this unchanged (giving the player a chance to unite the world against a large threat) and go for the changes to "2." and "4." instead.
Edit :
I've decided to remove "4." because it doesn't work correctly anyway.
I've also decided to implement the army size checks for "Break Alliance" and "Declare War" proposals. It's not fair that the player's army is considered, but the target's is not.
The only remaining question :
Should the AI that holds an alliance with two other players (human or not) who are at war with each other
a., randomly break one of the alliances, and eventually proceed to join the war on one side, fighting against the other
b., do nothing at all and wait it out, why get involved?
"b" would be more beneficial to the AI, and to an extent it also helps the human player (enemies won't be able to turn your allies against you), but it's unfair in a sense as being in this situation as the human player will make the AI allies ask you to break your alliances periodically, potentially making you lose both if no action is taken, whereas AI players don't do this towards each other. On the other hand, the player can force the AI ally to break their alliance eventually, if their army strength gets high enough, without the other AI being able to do the same against the player.
"a" would be fair to all sides, but a major game changer, whichever Alliance the AI breaks will have a huge impact on the chances of the human player to win, and would make Alliances a lot less stable than they are now.
So, in short , do we want the AI to get away with maintaining these conflicting alliances simultaneously, or not?