Questionable behaviour: the AI builds too many spearman for city attack duties.
I've seen the AI attack with stacks with 6 spearmen, 2 axemen and 1 swordsman. I saw the same behaviour when I was continuing my game today and I thought I'd report it. I do have some horse based units (chariots), but not that many, so there's no reason to build that many spearmen. Below are two screenshots where you can see the relatively large amount of spearmen. Both screenshots are from the same year but a different empire (both stacks are there to kill me). I've seen worse than this, but I'd say that even in these stacks, there are too many spearmen.
My guess is that the AI views the spearman as a better city attack unit. Both units can get city attack upgrades. One has strength 4 and a 100% bonus against a specific unit and the other strength 5 and a 50% bonus against a specific unit. The AI probably doesn't look any further. However, the 100% bonus is against units that rarely defend cities because these units (mounted units) don't get defensive bonusses.
So maybe you could code something that when buiding units for city attack purposes that a specific bonus against units that don't get defensive bonusses is not considered valuable. So the 100% bonus against mounted units from the spearman is not considered interesting for city attack purposes because it is a bonus against units that don't get defensive bonusses.
Of course, spearmen are still needed as stack defence units.
Maybe the AI builds that many spearmen for a different reason. I'm just guessing here.
Spearmen for city attack 1.JPG
Spearmen for city attack 2.JPG
I added the bold. That is exactly right. It is a tricky problem to solve, if you do not allow yourself to know that melee and archer units are what is likely to be defending cities.
I know Blake was working on the problem, but I also know that it is not trivial to solve if you want your solution to work with mods as well.
-Iustus
As I said in the impressions thread, I think some sort of 'auto peace' or war limit needs to be added back in. Without that, the AIs run the risk of running themselves into the ground in stalemated conflicts.
As I said in the impressions thread, I think some sort of 'auto peace' or war limit needs to be added back in. Without that, the AIs run the risk of running themselves into the ground in stalemated conflicts.
With all the glibness of someone who isn't going to do the programming, nor understands the difficulty of implementing his suggestions, perhaps instead of making it a simple hard-coded time of 30 turns, maybe make it a variable time -- something between 25 - 50 turns or something like that?
The declaration of peace should not be related to the length of the war, but to the success rate of the war. If after 30 turns of fighting, neither side has captured a city, then the war is not going to be a profitable one.....
The problem with coding this is probably keeping track of the right statistics of the war (lost cities, captured cities, lost units, killed units, war weariness, relative military strength) and then deciding what to do based on these statistics. Please do not let the AI sign a peace treaty when it has a huge stack in front of a lightly defended city. Good luck with coding something reasonable.
I disagree with both these ideas. The declaration of peace should not be related to the length of the war, but to the success rate of the war. If after 30 turns of fighting, neither side has captured a city, then the war is not going to be a profitable one. If the war weariness is becoming intolerable, then peace should be a preferred option, even if the war has only lasted a few turns. If the war has cost many units, but also many cities were captured and war weariness is still tolerable, then the war should be continued.
Well, that's the rub, isn't it? I'm not referring to player versus AI wars, but rather to AI vs AI wars. I have seen on multiple occasions an AI player get bogged down in a war with another AI player, where a couple of cities will change hands, and then things will just sputter to a halt. But the war continues along with the negative effects attendant (skewed production/tech priorities, lack of trades, etc.) I would much prefer the AI to act as you describe but it sounds as though this would be something that perhaps should wait until Better AI 2.0 or 3.0 given the difficulty of the programming task. All I was suggesting was that in the interim, a variable "auto-peace" solution might avoid the AI "always war" stagnation effect.
Well sure, if thats possible that would be great. But if something like that cant be easily rigged, then I'd vote to have the AI more likely to make peace than they are now.
As jkp1187 noted, the AI to AI wars are often extremely long and drawn out and indecisive after a while. And that has a decidedly negative effect on the AI's growth. So, its not 'smart' to keep fighting an inconclusive war and pop-rushing troops and being subjected to pillaging and whatnot.
I think in many cases people focus on the AI to player relations but the AI to AI interactions are just as important (and in fact since they are more constant, the AI to AI relations might be MORE important). So its critical to make sure that these increased numbers of wars and the longer durations arent simply making things EASIER for the player be wearing the AIs down fighting each other.
Perhaps it can be tied to personalities? For example, Monty or Toku could be more inclined to continue in a war for 30 + turns even though it has not proven to be beneficial. Where as Gandhi would be willing to talk after 2 turns even if the war is going well for him
On the whole I agree with what you're saying Roland, but there are times that AI's should engage in fruitless wars. It would present a decent simulation of real life where both sides refuse to end the attrition even though neither is benefiting from ti. Clearly, if it can not continue to happen at the rate that it is otherwise the game would not be fun.
Perhaps it can be tied to personalities? For example, Monty or Toku could be more inclined to continue in a war for 30 + turns even though it has not proven to be beneficial. Where as Gandhi would be willing to talk after 2 turns even if the war is going well for him.
I disagree with both these ideas. The declaration of peace should not be related to the length of the war, but to the success rate of the war. If after 30 turns of fighting, neither side has captured a city, then the war is not going to be a profitable one. If the war weariness is becoming intolerable, then peace should be a preferred option, even if the war has only lasted a few turns. If the war has cost many units, but also many cities were captured and war weariness is still tolerable, then the war should be continued.
The problem with coding this is probably keeping track of the right statistics of the war (lost cities, captured cities, lost units, killed units, war weariness, relative military strength) and then deciding what to do based on these statistics. Please do not let the AI sign a peace treaty when it has a huge stack in front of a lightly defended city. Good luck with coding something reasonable.
By the way, I'm usually able to sign a peace treaty after I've defeated some attacking stacks of the AI. And most AI wars are also not indefinite in nature.
Well, that's the rub, isn't it? I'm not referring to player versus AI wars, but rather to AI vs AI wars. I have seen on multiple occasions an AI player get bogged down in a war with another AI player, where a couple of cities will change hands, and then things will just sputter to a halt. But the war continues along with the negative effects attendant (skewed production/tech priorities, lack of trades, etc.) I would much prefer the AI to act as you describe but it sounds as though this would be something that perhaps should wait until Better AI 2.0 or 3.0 given the difficulty of the programming task. All I was suggesting was that in the interim, a variable "auto-peace" solution might avoid the AI "always war" stagnation effect.
Well sure, if thats possible that would be great. But if something like that cant be easily rigged, then I'd vote to have the AI more likely to make peace than they are now.
As jkp1187 noted, the AI to AI wars are often extremely long and drawn out and indecisive after a while. And that has a decidedly negative effect on the AI's growth. So, its not 'smart' to keep fighting an inconclusive war and pop-rushing troops and being subjected to pillaging and whatnot.
I think in many cases people focus on the AI to player relations but the AI to AI interactions are just as important (and in fact since they are more constant, the AI to AI relations might be MORE important). So its critical to make sure that these increased numbers of wars and the longer durations arent simply making things EASIER for the player be wearing the AIs down fighting each other.
Yes, it might be very hard to code this. But as long as I haven't heard that it is too hard (by the betterAI team), I'll vote for the harder solution where the arguments for peace and war are taken into account.
The BetterAI team has removed the 'peace after 30 turns' rule and the AI are still capable of signing peace treaties. I don't know exactly why they sign them and according to your descriptions they sometimes sign them too late. But I don't think they sign them at random. I think there is some coding logic behind the signing of peace treaties. At least when an AI is attacking me and has lost a whole lot of units, then it typically wants to sign a peace treaty. That at least seems reasonable to me. Maybe the logic isn't perfect yet and needs some refining so that the AI will sign peace treaties sooner in some cases.
If you think that in one of your games an AI-AI war is taking too many turns without any success, then maybe you should upload some savegames of these two AI's at war and suggest some improvent.
Something like: France and Spain went to war in 1305 and stayed in that war for 50 turns while no cities exchanged hands. Both their power graphs dropped dramatically and their cities shrunk through massive drafting. You should provide some savegames at various points in the war.
That kind of data might help the team refine the code that governs the signing of peace treaties. If I see some endless inter AI wars, I'll try to do the same.
I think thats the way it was before the change...each leader had a different 'timer' (but I'm not sure...someone from BetterAI would have to confirm).
I think it's reasonable that Montezuma and Tokugama and other crazy warmongerers would find a higher level of war weariness acceptable than Gandhi. And of course, a warmongerer should find it more interesting to continue a war when it captures cities. Such things could give them personality. Still the general idea that high levels of war weariness and a stalemate war would result in a bigger chance of peace seems reasonable.
AI_endWarVal
{
EndWarValue = 100
EndWarValue = EndWarValue + (CountOurCities + CountTheirCities) * 3);
EndWarValue = EndWarValue + (CountOurPopulation + CountTheirPopulation);
EndWarValue = EndWarValue + (WarSuccessThemVsUs * 20)
EndWarValue = (EndWarValue * (TheirPower + 10)) / (OurPower + TheirPower + 10)
if (weAreNotHuman and our power is at least 20% higher)
{
if DaggerStrategy then reduce EndWarValue to (90% * TheirOurPowerRatio)
if We Own 20% more Land than Them then reduce EndWarValue by (90% * TheirOursLandRatio)
if we in financial trouble // warmonger war to solve finances factor
{
if TotalWar and (Dagger or (maxWarRand < 100)) reduce EndWarValue by (70% * power ratio factor)
if LimitedWar and (limitedWarRand < 100) reduce EndWarValue by (70% * power ratio factor)
if DogpileWar and (dogpileWarRand < 100) reduce EndWarValue by (70% * power ratio factor)
}
}
if total war and the aggressor is non-human, double EndWarValue
if total war and the aggressor is non-human, increase EndWarValue by 50%
round to the nearest 10 (actually using "DIPLOMACY_VALUE_REMAINDER" from GlobalDefines.xml)
if human and less than 10, set it to 10.
}
<Define>
<DefineName>WAR_SUCCESS_DEFENDING</DefineName>
<iDefineIntVal>3</iDefineIntVal>
</Define>
<Define>
<DefineName>WAR_SUCCESS_ATTACKING</DefineName>
<iDefineIntVal>4</iDefineIntVal>
</Define>
<Define>
<DefineName>WAR_SUCCESS_UNIT_CAPTURING</DefineName>
<iDefineIntVal>1</iDefineIntVal>
</Define>
<Define>
<DefineName>WAR_SUCCESS_CITY_CAPTURING</DefineName>
<iDefineIntVal>10</iDefineIntVal>
</Define>
<Define>
<DefineName>WAR_SUCCESS_NUKE</DefineName>
<iDefineIntVal>10</iDefineIntVal>
</Define>
Many of these things are already being tracked. If you turn on chipotle, you can see the value an AI puts on peace, which is how it determines if it is winning or losing a war.
-Iustus
I found a big bug, war is declared much much much more often than they should be. In updating the chipotle code to use the new percentages (based on a change made recently to declare war more when AI is paying high unit support costs), I found a bug in that code. When it thinks it should have a 5% chance of declaring war, it actually has a 95% chance for declaring war.
So, your observations that the AIs are always at war is not in error. I think this was also in the 1/30 build, but perhaps I am mistaken about that.
Expect a fix soon.
-Iustus