Diplomacy AI Development

I haven't reached it yet, but It is very likely, as they immediately befriended me. I got one strong positive diplo for resurrecting, and another for liberating their capital.

I think that's more or less all they're supposed to do. I don't think being Recalled to Life ever made a civ a vassal.
 
I've pushed some changes to Github. Not fully tested yet as I didn't get the time (hoping someone on Github can run a couple AI test games for me, if not it may be a short while, since I'm away for the weekend).

It'll need beta testing but the focus is on fixing the AI's wacky war logic.

Changelog:
Code:
Removed tons of useless code and five unused memory variables (there was leftover code for "trade agreements" and other untradeable items, plus unused vanilla code, that was taking up around 2,500 lines of code)

AI should no longer agree to start additional wars if they are already doing badly in an existing war or in general (very unhappy, bankrupt, lost their capital)

AI now has an aggressor flag in memory that sets whether or not they WANTED to start the wars they're currently involved in. So if they declare war, it is set to true. If they were planning on it and you declare war on them first, it is also set to true.
- Aggressor flag decreases reluctance to conquer cities and makes the AI less likely to make peace

AI now has a function to identify "phony wars" that they have no interest in waging, especially if they were declared on rather than the other way around. If it considers itself to be in a phony war it will agree to make peace at the earliest opportunity.

Completely rewrote coop war logic for saner, cleaner code
- Removed exploits where you could chain coop wars to avoid war weariness: you are now capped at 15 turns where you cannot make peace, and when the lock is set your war duration is subtracted from those 15 turns.

- When a coop war agreement is made, you will automatically declare war after 10 turns has passed (no prompt to back out). If one of you goes to war before then, both of you will (regardless of whether you or your target declared). While this slightly sacrifices player choice, it's more consistent, much less exploitable and more strategic of a choice. The AI will benefit from this a lot.

- You can still back out of a coop war agreement by ending your DoF, denouncing or declaring war on your ally - or by making a DoF or DP with the target. All of these will be treated as breaking your promise and apply a minimum -50 penalty to diplomacy and a reluctance to agree to future coop wars. The person who broke the agreement gets the penalty, of course. If something makes the coop war invalid (like the target becomes a vassal) then it is cancelled automatically with no penalty.

- AIs now start a sneak attack operation against the target when they are preparing a coop war, and are more likely to request that others join their planned war, so you may see alliances of more than 2 civs declaring war at the same time

- Warmonger penalty for coop wars is fixed. No penalty for declaring, and penalty for conquering cities is reduced by 90%.

- You are no longer able to request that AIs declare war on their friends, DPs, or on vassals and other invalid players. The button is disabled (previously it was still enabled but asking would do nothing except potentially get you a penalty with the target AI). AIs also can't request this from you.

- Rewrote coop war desire evaluation. AIs should utilize coop wars more often, be more likely to start coop wars with players that have a track record of agreeing to their requests, and choose targets more wisely. Penalty for refusing to agree also scales based on the AI's Forgiveness flavor now (ranges from -10 to -30 to recent assistance)

Improvements to approach selection
- AI should be AFRAID less often

- AI will be far more reluctant to wage distant wars before they're able to cross the ocean, and more aggressive towards neighbors in the early game

- AIs that have agreed to a coop war or are planning an attack will now always have the WAR approach

- AIs that are NOT *currently* planning an attack will no longer have the WAR approach. This should result in saner, more strategic diplomacy.

All of this is subject to change based on testing, but hope you guys will like it.
 
Last edited:
I think that's more or less all they're supposed to do. I don't think being Recalled to Life ever made a civ a vassal.
Well, I don't know what was the original intent of the vassal system creator. At least some people (including the devs) claim it was supposed to vassalize.
Anyway, it won't hurt if we fix this (not exploitable and makes sense generally). Also resurrected civs will not survive without the liberator's assistance anyway. In my game India already DoWed by 2 civs and I haven't seen a single Indian military unit.

AI will be far more reluctant to wage distant wars before they're able to cross the ocean
How about land distance ? Separation by other civ's lands ?
 
Last edited:
How about land distance ? Separation by other civ's lands ?

It affects land distance too. If AI can't pathfind to a target they don't attack.
 
How do I download the CvGameCore_Expansion2.dll from GitHub to test the updates made.
 
How do I download the CvGameCore_Expansion2.dll from GitHub to test the updates made.

Not that simple, sadly. It'd need to be built and a number of different files updated as I changed a bunch of Lua stuff.
 
"AI should be AFRAID less often"

Never found it that common to start with..

What effect does the afraid status do anyways? I assume they are more willing to give into demands and less willing to war against you?
 
The AI seems to make congress proposal but then votes against their own proposals. Is there any specific reason they could be doing this or is it just poor AI logic?
 
Yeah somethings up with congress proposals but I cant put my finger on it. So for certain votes my vassals will offer me money for both sides of a vote (yes or no) which doesn't make much sense. Also sometimes when trading with my vassal ill put a vote request and they will have no specific offer, but I can just accept and get their vote for free as if they wanted nothing for it. I mean i guess its feasible that they would want nothing for it but ive never seen that before. Not sure if these are bug reports or just new AI stuff so im posting here.
 
Another good improvement on AI: I have vassalized 4 civs, all my continent and was in the process to invade the other where Persia (top dog), German and Iroquais were happily killing each other.

Few turn after I managed to sanction Persia and same turn they sanctioned me. Then Darius went on a killing spree puppetting 8 cities from Germany and Iroquais. It took me off guard. My positioning was bad but anyway hat to rush the attack to get at least a base on the other continent. I can count only on Destroyers as air defense. Still no carriers and AA guns are en route.

Nice decision from him. Last capital i took was still building the Courthouse, my fleet far and my army healing from last assault. It seems he knew for every turn he wait Zulus get stronger.

Now i'm eagerly waiting the next patch for stopping the phony war so I could try a different victory but Domination.
 
Alright, I am not sure if it's been mentioned, I searched a little but it's a huge thread so please excuse me but is there a difference on how warmonger penalty is calculated between map sizes? because capturing one city out of 50 in the world is way more impactful than capturing one out of 150.
Because I feel that AIs in my Huge map games might be a tad too sensitive when it comes to that. If size is accounted for and working as intended nevermind that, but I am just wondering.
 
Alright, I am not sure if it's been mentioned, I searched a little but it's a huge thread so please excuse me but is there a difference on how warmonger penalty is calculated between map sizes? because capturing one city out of 50 in the world is way more impactful than capturing one out of 150.
Because I feel that AIs in my Huge map games might be a tad too sensitive when it comes to that. If size is accounted for and working as intended nevermind that, but I am just wondering.

Doesn't scale with map size. Does scale with era and economic value of the city (compared to the best city in the world).
 
Doesn't scale with map size. Does scale with era and economic value of the city (compared to the best city in the world).
Wouldn't it make sense if it was slightly more forgiving in larger maps? I am not talking about conquering a capital or vassalising a player, I am mostly concerned about the impact of singular city conquests in the grand scale of a huge map game. Has this discussion been done before?
 
Doesn't scale with map size. Does scale with era and economic value of the city (compared to the best city in the world).

Any chance maybe we can add something that takes defensive wars into account? Particularly with the current psychotic AI with the many bribed wars, with weaker civs attacking you... It's more than frustrating when I get sick of it and take a single city and see half of the world see me "leading the world into a new dark age" because of it.

It's actually kind of messed up now because if you plan a late peaceful game your actually better to try to force your neighbors into vassals as soon as medieval starts. It's the only way to "play peaceful". Mostly cause the other civs don't see you do it.

I know you have some changes coming, but I don't think they will do much to prevent this. (from what I see)
 
Wouldn't it make sense if it was slightly more forgiving in larger maps? I am not talking about conquering a capital or vassalising a player, I am mostly concerned about the impact of singular city conquests in the grand scale of a huge map game. Has this discussion been done before?

Any chance maybe we can add something that takes defensive wars into account? Particularly with the current psychotic AI with the many bribed wars, with weaker civs attacking you... It's more than frustrating when I get sick of it and take a single city and see half of the world see me "leading the world into a new dark age" because of it.

It's actually kind of messed up now because if you plan a late peaceful game your actually better to try to force your neighbors into vassals as soon as medieval starts. It's the only way to "play peaceful". Mostly cause the other civs don't see you do it.

I know you have some changes coming, but I don't think they will do much to prevent this. (from what I see)

War is part of the game, I have no plans to make being peaceful an easy task.

There's a lot of feedback that the penalty is too punishing as-is, though, and I agree it should scale with map size and be less punishing if you're defending yourself. I'll look at this.
 
War is part of the game, I have no plans to make being peaceful an easy task.

There's a lot of feedback that the penalty is too punishing as-is, though, and I agree it should scale with map size and be less punishing if you're defending yourself. I'll look at this.

Recursive, not what I said. I suggested that if you take a city in a defensive war maybe you should take less warmongering. The current AI in the currently posted beta is psychotic, but quick to globally hate you if you beat them down back. (I took a single city and the whole world hated me for it in the last game, after almost the entire world was bribed into attacking me...)

Sorry, but it's dumb when you much weaker neighbors agree into a bribed war, but get angry when you fight back. There has to be a less insane middle ground.

It's also sad that the best way to play peaceful is to enslave your neighbors before the other civs can see you do it....
 
Any chance maybe we can add something that takes defensive wars into account?
This is where I would wish for something like civ 6's causus belli system. It's honestly one of the best features imo.
The current AI in the currently posted beta is psychotic, but quick to globally hate you if you beat them down back.
I haven't seen any bribed wars and would say that the AI is doing extremely well this game, maybe it could be a little more aggressive. In my current game I'm playing as shaka, have murdered one of my neighbors and taken the capital and holy city of the other while vassilizing them. I'm leading in nearly everything and a lot of people hate me. But I lead in military, so no one has declared war on me yet. A lot of AIs have declared war on the other leader on the game, Washington. I'm not seeing anything crazy.
 
Recursive, not what I said. I suggested that if you take a city in a defensive war maybe you should take less warmongering. The current AI in the currently posted beta is psychotic, but quick to globally hate you if you beat them down back. (I took a single city and the whole world hated me for it in the last game, after almost the entire world was bribed into attacking me...)

Sorry, but it's dumb when you much weaker neighbors agree into a bribed war, but get angry when you fight back. There has to be a less insane middle ground.

It's also sad that the best way to play peaceful is to enslave your neighbors before the other civs can see you do it....

I misunderstood your post. Yes, I agree that small scale defensive attacks should not get you branded as a warmonger.

This is where I would wish for something like civ 6's causus belli system. It's honestly one of the best features imo.

I haven't seen any bribed wars and would say that the AI is doing extremely well this game, maybe it could be a little more aggressive. In my current game I'm playing as shaka, have murdered one of my neighbors and taken the capital and holy city of the other while vassilizing them. I'm leading in nearly everything and a lot of people hate me. But I lead in military, so no one has declared war on me yet. A lot of AIs have declared war on the other leader on the game, Washington. I'm not seeing anything crazy.

I'd be totally cool with implementing Casus Belli, but the LUA work is beyond my capabilities. I'd need help with that.

I did manage to fix the coop war penalties, though. :)
 
This is where I would wish for something like civ 6's causus belli system. It's honestly one of the best features imo.

Agreed. I made a good effort to try to get into Civ 6, but just couldn't do it. It's large list of reasons to declare war and how it effects how the other civs view you for it was one of the best features of the game. Too bad the rest of the game wasn't as refined.
Obviously Civ 5 is way too simple to have something like this added, but we can adjust the warmonger system to make it a tad less insane. I have been on the fence about defensive wars being treated differently but after having a weak neighbor being bribed to attack me for the 3rd time, just taking out his units wasn't enough. My trade routes kept being taken out and my ability to import luxuries was impossible. I take a single city and the whole world see's me as the bad guy for the rest of the game.

I haven't seen any bribed wars and would say that the AI is doing extremely well this game, maybe it could be a little more aggressive. In my current game I'm playing as shaka, have murdered one of my neighbors and taken the capital and holy city of the other while vassilizing them. I'm leading in nearly everything and a lot of people hate me. But I lead in military, so no one has declared war on me yet. A lot of AIs have declared war on the other leader on the game, Washington. I'm not seeing anything crazy.

This is what I have been saying, the path to peace in the current beta is to be an early game slaver. If you take out and or enslave your neighbors early game, you can play most of the rest of the game peacefully with the rare random war being declared.

There is actually a set of "war messages" the AI gives you when they declare on you that used to be somewhat rare. There seems to be a couple of them but they go somethings like "I may die, but it's better to die in battle." or variations of that. I used to hardly see them because you would only get them if a much weaker civ declared on you. Since the AI has been made to be psychotic I seem them often, way too often now.
 
Back
Top Bottom