Aggressive AI

Your response has nothing to do with the statement you quoted.

G
There's two related conversations going on. I thought that "99% of the time" might be a blanket statement regarding both of them.
 
Let me confirm, the solution for a player who is constantly being attacked by AI who are then crushed repeatedly by the player's existing military is for that player to build more military?

Your response has nothing to do with the statement you quoted.

G

There's two related conversations going on. I thought that "99% of the time" might be a blanket statement regarding both of them.

Yeah this isn't about people who forget to build units; the OP explicitly says that he simply feels that the game is unnecessarily longer than it should be due to hopeless wars the AI starts on him. Implementing a consideration of opponent kill ratio when evaluating their military strength would probably help with that. I think we all agree that players who ignore their military should be declared upon by the AI, but since humans are still significantly better at war, the AI will tend to underestimate the human and thus start hopeless wars which hurts the AI and helps the human (and, in the OP's case, annoys the human). Including the kill ratio consideration seems like an elegant fix that naturally teaches the AI more respect versus the human player if the human deserves it (if he actually is skilled and has demonstrated that in prior wars).
 
That would be great if AI is capable of measure the player warmongering skills. That would stop all those complaints about useless early AI attacks, will suit a broader player base and probably will give AI a better chance at winning.

But how do you do this, easy, without much coding? A simple, but probably unaccurate way could be this:

When PlayerMilitaryScore * PlayerWarmongerSkill > CivMilitaryScore at DoW, player wins. (PlayerWarmongerSkill is set by difficulty).
So, every time the player wins a war, check the values at DoW. PlayerWarmongerSkill should be > CivMilitaryScore / PlayerMilitaryScore.
If it wasn't, then consider that player is more skilled than what AI thought, but leave room for a bit of luck, maybe a 20%.

If player won then
PlayerWarmongerSkill = max(PlayerWarmongerSkill, 0.8*(CivMilitaryScoreAtDoW / PlayerMilitaryScoreAtDoW));

If player lose then
PlayerWarmongerSkill = min(PlayerWarmongerSkill, 1.2*(CivMilitaryScoreAtDoW / PlayerMilitaryScoreAtDoW));

And do nothing if the result is a Stalemate.



This does not account for the player's ability to produce more units than AI during the war, the success of a surprise attack and any joint wars, but it's more dynamic than what we have now. Another side effect is that AI can become too scared to attack the player after some lost wars (maybe not a bad thing if it seeks allies against the player).

I would not use War Score for this valuation, since once you take a city, you can artificially increase your warscore by razing the city.
 
A lot of the complaints in this thread seem to just boil down to people who don't want to improve their play or change their play style and expect the mod to cater to them. The more experienced people in this thread are more than happy to give pointers on how to improve and I think the people who are struggling with aggressive AI would benefit from trying to learn rather than complain.

For the people that complain about constant DoWs throughout the game being annoying:

To reiterate what others have said: It is very possible to play a relatively peaceful game where you are mostly not dealing with wars but you have to purposely make that happen. You have to intelligently use diplomacy and you have to have a decently sized standing army. Intelligently using diplomacy might include purposely not over-expanding, trying really hard to make friends with the right people (which might include making common enemies at times), flat out giving GPT to other civs so that they like you more, bribing others to go to war as a way to distract them from yourself, etc.

For the people that complain about DoWs from the AI that seem hopeless:

The AI is in it to win it, and thankfully so. They probably concluded that you are too close to winning and therefore they must do something, even if that something is a hopeless war. I'd rather have that than an AI that just gives up. Also, if you find yourself so far ahead of the AI that any war they declare in the late game is hopeless, perhaps the real problem is that you are playing too low a difficulty.
 
That would be great if AI is capable of measure the player warmongering skills.

Thing is, doesn't that double penalize a lesser warmonger? A lesser warmongering is already going to take more losses that he has to replace, and has less promoted units. So now the greater warmongering not only has the advantage in war....but also doesn't have to worry about his opponents declaring on him? Seems like a possible snowball to me.

That said, if you were going to do it, is it possible to look at the player's promotions as a factor? If I have 6 level 6 units, than clearly I am good at warmongering. And regardless of past performance, that is going to be a real indicator of my opponent's strength. A human with high level units is exponentially stronger than one with lower level ones.
 
Intelligently using diplomacy might include purposely not over-expanding, trying really hard to make friends with the right people (which might include making common enemies at times), flat out giving GPT to other civs so that they like you more, bribing others to go to war as a way to distract them from yourself, etc.

I really agree with this, and recognize its a weakness in my own play. Playing peaceful is a problem you can throw money at and make go away sometimes. Its ok to throw 20 GPT to an enemy to keep them off your back, especially if you are still building up that military.
 
So now the greater warmongering not only has the advantage in war....but also doesn't have to worry about his opponents declaring on him?
You're looking at this wrong. The better warmonger would be seen as a better warmonger, and the AI would know to make a bigger force before attacking him. As it is now the AI will repeatedly declare the better warmonger and lose war after war.

This isn't meant to deter wars even, just to make the AI more accurately understand enemy strength and correctly play against them. If anything it would make it harder for stronger players because the AI wouldn't deplete it's resources on wars they can't win.

Not sure of the coding way to make it work best, but I feel there's some room for improvement.
 
The AI is in it to win it, and thankfully so
Different issue. The panic mode when AI cannot win is one thing. AI attacking hopelessly skilled players at lower difficulties is another.

Thing is, doesn't that double penalize a lesser warmonger?
How so? The problem comes when a player that is not good with the economy, just know how to fight. Looking at the player strength, AI thinks it's an easy win. This way, AI learns.
Think of a Chieftain player with poor combat skills. AI knows he is bad, and with a small advantage it attacks. AI wins the war. Look at how big the difference was. If AI won with similar forces, the opinion on player's skill does not change. If AI was too strong, then it will attack faster next time. But this only will happen if AI can produce enough units, don't forget that we are talking very low levels, where player has a big advantage at getting techs and producing almost anything. And if the player is not able to do anything to defend against those every time more frequent attacks, then he is not playing at the right difficulty.

That said, if you were going to do it, is it possible to look at the player's promotions as a factor?
I said it was not accurate. You can improve AI valuation on player skills this way too, but this is added complexity. Anyways, if player kept his units alive to level 6, probably he won lattests wars, so he has an increased reputation after all.
 
The AI is in it to win it, and thankfully so.

The problem is that the AI is hurt by starting pointless wars...if the player is approaching victory the AI should band together and attack instead of starting separate useless and likely even beneficial (for the player) skirmishes. For example, I often provoke the AI into declaring on me just so I can save myself the war declaration warmonger malus to have an easier time diplomatically with the other civs. This is not about making the AI less aggressive but about making it use aggression in a smarter way.

Thing is, doesn't that double penalize a lesser warmonger?

Well, war is risky and one really shouldn't lose so much :nono: If the competent warmonger gets declared upon by incompetent and weak civs he will grow more quickly so I think it would probably have more of an anti-snowballing effect, especially since military strength assessment will then lead to his neighbors focusing more on their own military (right?).

But how do you do this, easy, without much coding?

That certainly would make the addition easy to code; however, I worry if there aren't any additional side effects, especially when vassals or DP partners are involved. Is it not the case that a vassal will win the war, even if he was almost obliterated, as long as the master wins? And as you already alluded to with the reference to joint wars, which happen quite often, the DP partner or offensive partner could win just because the victim was mostly busy fighting the player at the same time. I think these effects could really skew the system.
Counting kill ratio would be more complicated but would also suffer much less from these effects, since the war outcome, which is influenced by a great many different things, doesn't play a role but instead the attempt would be to assess only the raw combat skill.
There must be some sort of unit valuation in the game already, since different policies, which give yields per unit killed, vary their yields with a stronger unit giving more (is it simply strength?) so this could be used as a metric to count how much "unit asset value" the player has destroyed and has lost; this measure would then be multiplied by the result of the total asset value involved plugged into a logarithmic function, to give it a "statistical significance" component so that abuse in the sense of starting a war with someone who can't fight back much for whatever reason and sniping a few units to get a good ratio and then offering peace isn't possible. Values from earlier wars are then attenuated to lessen the effect of things like unique unit era for the civ, lucky constellations and any other impact factors that can change over time. What you have now is a factor that can increase of decrease the military score and should probably have less side effects (I think).

So basically:

After each war, no matter whether won, lost or stalemate:

CUVK
is the combined unit value killed
CUVL is the combined unit value lost
SF is the strength factor that depends on the unit values assigned; it is a constant that should scale with era and have the value of about [ 20 * (EraNum / 2) ] typical units (asset value) of that era.

MilitaryScoreMultiplierForCurrentWar = 2 / ( 1 + e ^ -( ln( CUVK / (CUVL + 1) ) * log( ( (CUVK + CUVL) / SF) + 1) ))
(the output here will always be between 0 and 2)

and then for the previous wars, for each the values were stored and are now attenuated toward 1 using the time passed since they occurred:

MilitaryScoreMultiplierFromPreviousWar = 1 + ( (MilitaryScoreMultiplierFromPreviousWar - 1) / ( 1 + (TurnsPassedSinceThatWar / 75) ) )

and then we form an average from all of these but multiply the most current multiplier by the total number of previous-war-multipliers and voila....we now have a factor that is always between 0 and 2 with a strong tendency toward 1 that takes a whole bunch of stuff into account :goodjob:


Have mercy on my soul, I don't create many algorithms :)
Edit: forgot to update my description after I made the actual algorithm...updated 5 mins after posting
Edit2: forgot a minus sign in my logistic function
 
Last edited:
If possible, it'd be great if the AI could take into account the previous success/failure in a.) combat (i.e. units killed vs. lost) AND b.) wars (i.e. previous warscores, captured cities, lost cities,...).
 
If possible, it'd be great if the AI could take into account the previous success/failure in a.) combat (i.e. units killed vs. lost) AND b.) wars (i.e. previous warscores, captured cities, lost cities,...).

Well like I wrote in my post this is really problematic because it means you now have to account for all sorts of edge cases and there is much more room for exploiting the algorithm (just as another small example: I often put one horseman near a city my ally is besieging to have the option of taking it after he dealt with the defenses...is this now super skilled or just luck? I have seen AI do this too, but probably not on purpose since they weren't waiting around...so now I have a real problem with giving the appropriate weight to taking cities).

You’re a fine lot, but none of the ideas presented in this thread are workable from a design standpoint. You’re talking about rewriting the AI, even if you don’t think you seen. No go.

:sad: :cry: :sad:
 
You’re a fine lot, but none of the ideas presented in this thread are workable from a design standpoint. You’re talking about rewriting the AI, even if you don’t think you seen. No go.
This is all us fools without mod experience can do. I was hoping that you would go "Well those specifics are dumb but the idea is good and I've got an idea on how to accomplish this.

It was similar when I suggested the AI's despair factor to declaring war, so I figured the worst I could get is a no can do.
 
You know better, so if there is a way for AI to change player combat skill valuation, then you'll see it.

It's one of those things I'd rather not touch, as it is gamey and/or abusable. Either I'd write it opaque (and it wouldn't help), or you'd know, and players could use it to shape their play.

G
 
Iam still in favor of the "remember previous war"-mechanic.
But with the option to raze cities for a strong increase in warscore, this might be not the best option and truely can be abused, but instead I suggest something else which cant be abused.

I take the idea of lost units from tu_79 and modify it a bit.
The production cost of any enemy unit killed is added into the "KilledUnitsValue" stack. The production cost of any own unit lost is added to the "LostUnitsValue" stack.
The value for each unit is increased by the amount of promotions it has (Killing a unit with a high lvl hurts more than a standard barracks unit.
The "KilledUnits" stack is modified by the comparison of the total population and the comparison of the production modifiers.
Those modifiers are in the calculation to look at the relative damage which was done. A bigger empire can produce and replace units better than a small empire, so more losses are ok till a certain point.
The production modifier is the comparison of the cost reduction (defined by difficulty and era) the 2 fighting nations have. Two AI at same era have always 1. If the human plays against deity AI in the last era (production cost only 25%), its ok for the AI to lose 4 times more units than the human, cause the damage done is relative the same.
And cause gaining cities is the most valuable part of war, we add a strong modifier for conquering cities.

At the end of the war, the likelyhood of declaring another war against the opponent is modified by the outcome of the last war/s:

KilledUnitsValue * (Own population / Enemy population) * (1 / OwnProductionCost) / LostUnitsValue * (1 / EnemyProductionCost) * (gained cities + 1 / lost cities +1 ) = Modifier for Likelyhood of another war declaration


I asked myself where this modifier could be placed, and I have read, based on the difficulty, the AI is evaluating the human military might much greater, the higher the difficulty is.
If this value, based on difficulty isnt fixed but instead a variable, this could be the choke point. Every time a war ends, the simply comparison of 2 values, modified by 2 more values, changes the consideration of the military might of the other nation/player.
To remove some strange circumstances, there should be a limit, how strong one war can influence the modifier, to a maximum of 0,9 to 1,1. And set a minimum of destroyed units (10?), before this modifier is applied.
 
Last edited:
So, some people on this forum have taken what I said personally and decided to attack my playstyle to somehow defend their l33t gaming skills or something. I was just saying I don't enjoy fighting endless AI wars because I don't spam units to my force limit. No need to keep implying I'm a huge noob and should git gud.

I can, and usually do, win wars. It can be harder than vanilla, mainly because ranged units got nerfed, but the AI still isn't some tactical genius. I fend off most AI attacks with 5-7 units per front (Sweden and Songhai are admittedly tough), and can do stuff like buy units or upgrade them, which the AI doesn't seem to take into account. Because they perceive to have some advantage against me, they keep declaring wars and ramming random units into my borders, basically wasting hammers. So every game I have to stop what I'm doing and go kill my neighbor, which I guess is what some would consider the pinnacle of civ experience.

Again, I'm not just salty or inexperienced, I just believe Civ is primarily an empire building game. Compare it to the Total War series, or even the Paradox games and you'll see there's a lot more peaceful stuff to do in Civ. Just compare the amount of screenshots and threads of canal cities against the number of map painting screenshots and threads. Civ is mostly a casual single player game , even the multiplayer community isn't really all that competitive. I personally don't believe having a cutthroat AI, always trying to win is really necessary.

There's no need to be dismissive and call me a noob. Korea would actually have a better game if they built Infrastructure with its hammers instead of those endless crusades against my nation. The AI may be playing to win but it is still pretty bad at it and makes me go kill my neighbor every game. I do enjoy most of the changes brought by the mod, but many of my games end up dragging along and I just don't bother finishing them because of these random wars.
 
It's one of those things I'd rather not touch, as it is gamey and/or abusable. Either I'd write it opaque (and it wouldn't help), or you'd know, and players could use it to shape their play.

G
I mean if the AI could tell exactly how strong a player is they would play better right? If their good play depends on them not understanding the player's power I'd be surprised.

What are people going to do? Game it by winning wars? Lose a war to get the AI to underestimate them? The first sounds like it's intended purpose, the second sounds like a bad strategy.
 
Iam still in favor of the "remember previous war"-mechanic.
But with the option to raze cities for a strong increase in warscore, this might be not the best option and truely can be abused, but instead I suggest something else which cant be abused.

I take the idea of lost units from tu_79 and modify it a bit.
The production cost of any enemy unit killed is added into the "KilledUnitsValue" stack. The production cost of any own unit lost is added to the "LostUnitsValue" stack.
The value for each unit is increased by the amount of promotions it has (Killing a unit with a high lvl hurts more than a standard barracks unit.
The "KilledUnits" stack is modified by the comparison of the total population and the comparison of the production modifiers.
Those modifiers are in the calculation to look at the relative damage which was done. A bigger empire can produce and replace units better than a small empire, so more losses are ok till a certain point.
The production modifier is the comparison of the cost reduction (defined by difficulty and era) the 2 fighting nations have. Two AI at same era have always 1. If the human plays against deity AI in the last era (production cost only 25%), its ok for the AI to lose 4 times more units than the human, cause the damage done is relative the same.
And cause gaining cities is the most valuable part of war, we add a strong modifier for conquering cities.

At the end of the war, the likelyhood of declaring another war against the opponent is modified by the outcome of the last war/s:

KilledUnitsValue * (Own population / Enemy population) * (1 / OwnProductionCost) / LostUnitsValue * (1 / EnemyProductionCost) * (gained cities + 1 / lost cities +1 ) = Modifier for Likelyhood of another war declaration


I asked myself where this modifier could be placed, and I have read, based on the difficulty, the AI is evaluating the human military might much greater, the higher the difficulty is.
If this value, based on difficulty isnt fixed but instead a variable, this could be the choke point. Every time a war ends, the simply comparison of 2 values, modified by 2 more values, changes the consideration of the military might of the other nation/player.
To remove some strange circumstances, there should be a limit, how strong one war can influence the modifier, to a maximum of 0,9 to 1,1. And set a minimum of destroyed units (10?), before this modifier is applied.

The problem is injection. There's nowhere to place this code, or code like it, without it either dominating or having limited impact. Warmonger score (in a way) already does this for us, as warmonger threat tracks a player's successful expansion (the root bonus of war). It's just not necessary. I don't doubt your sincerity here, but I can honestly say that this is a dead-end.

G
 
Top Bottom