New Beta Version - April 17th (4-17)

Status
Not open for further replies.
I've been meaning to ask how is military strength calculated for AIs? Sometimes I have 10x more units and it shows that we have same military strenght on the score in the top right.
P.S. That military strength review that randomly shows at turn start shows it perfectly.

Code:
//   --------------------------------------------------------------------------------
int CvPlayer::calculateMilitaryMight(DomainTypes eDomain) const
{
   int iSum = 0;
   int iLoop;
   for(const CvUnit* pLoopUnit = firstUnit(&iLoop); pLoopUnit != NULL; pLoopUnit = nextUnit(&iLoop))
   {
       if(!pLoopUnit->IsCombatUnit())
           continue;

       if (eDomain != NO_DOMAIN && pLoopUnit->getDomainType() != eDomain)
           continue;

       //we are interested in the offensive capabilities of the player
       int iPower = pLoopUnit->GetBestAttackStrength() / 100;

       //some promotions already influence the combat strength so to prevent double counting only consider the advanced promotions
       int iPromotionFactor = 100;
       if (pLoopUnit->getLevel()>3)
           iPromotionFactor += pLoopUnit->getLevel() * 10 - 30;

       //assume garrisons won't take part in offensive action
       if (pLoopUnit->IsGarrisoned())
           iPower /= 2;

       iSum += (iPower*iPromotionFactor)/100;
   }
 
   return iSum;
}

Note that the value used by the diplomacy AI is different, but this is how military power is calculated, if I'm not mistaken.

Edit: Military power score in the scoreboard is different, as it's your "game score" contributing to victory points
 
Last edited:
@2506 , if I understand correctly, what @Susanooo described is happening in the beginning of the game and AI does not benefit from it - it will gain a crappy city, which will be probably soon conquered by the human player anyway. Sounds like wasted resources to me (and 1 annoyed human on top of it).

It's not completely useless, though. They can be settled as a buffer, or as a sacrifice pawn. If you want to learn about your neighbors, you can tempt them and watch their reactions.

I suggested a new personality trait: boldness. This would measure how fast the player respond to opportunities. This kind of action would serve to measure the boldness of the player.
 
It's not completely useless, though. They can be settled as a buffer, or as a sacrifice pawn. If you want to learn about your neighbors, you can tempt them and watch their reactions.

I suggested a new personality trait: boldness. This would measure how fast the player respond to opportunities. This kind of action would serve to measure the boldness of the player.

There's already a Boldness value, and it already affects likelihood to declare war and conquer cities.
 
It's not completely useless, though. They can be settled as a buffer, or as a sacrifice pawn. If you want to learn about your neighbors, you can tempt them and watch their reactions.

I suggested a new personality trait: boldness. This would measure how fast the player respond to opportunities. This kind of action would serve to measure the boldness of the player.

Not to mention the diplomatic repercussions of it being attacked, like I said before.

Putting aside that the AI seems to be doing it due to a bug in the first 100 turns, I do see some circumstantial value in play like that. Possibly in the first 100 turns, if I had the AI's production capacity, and definitely later in the game, even with my human-player handicap.

Take ridjack's example of Ethiopia building Adwa on an island off Washington's coast. That happens to me almost every game, to the point where I probably would have built there myself to make sure I controlled that sea passage. So every time the AI blocks me with a city, or plants a city within my "sphere of influence," I'm forced to choose between declaring war against someone when it hadn't been in my plans, accepting a thorn in my side that may become infected down the road, or like ridjack, have my mobility seriously hampered.

That doesn't seem like a bad move at all to me. Is it a pain in the ass? Yes, but it should be, coming from a rival. Is it dumb? Only if you assume it has no value. But hindering my progress has inherent value for the AI. In many of these cses, the value comes with an acceptable cost.
 
That doesn't seem like a bad move at all to me. Is it a pain in the ass? Yes, but it should be, coming from a rival
Firstly, a human would never play like this. Why would you harm yourself just to be an annoyance to another?

You say that you can't assume it's a bad move, we're not. The AI is settling cities that are objectively bad from a yields standpoint, I think we agree on that. But what you bring up is that the AI is doing this to be a pain in the ass, to be as annoying as possible. Well, first off, the AI isn't doing this on purpose. It's not thinking, "how can I be as annoying as possible" "I know, I'll settle a bad city!", It's a bug in the code that causes that. The AI isn't smart enough to do that. And even if it was, the AI shouldn't make that type of decision. You said that the AI should make these decisions because they are a hindrance and really annoying. The fact is, that's not how the AI should play. First off, it's not how a human plays. I know that obviously the AI won't play like a human, but this is a strategy that isn't ever used. But mainly, the AI shouldn't strive to be "annoying". The point of the AI is to feel like you have an opponent that is at least making some sort of interesting decision, not that they are just trying to be as annoying as possible. If the AI was like that (thank god they aren't) then they wouldn't accept trade deals with the player, for example. It would be a pain in the ass for the player and would hinder their progress. But it would also just be annoying.

The cost of the city is pretty big, and the benefits of being slightly annoying are very small, and even then, shouldn't be benefits in the first place.
 
Is it dumb? Only if you assume it has no value. But hindering my progress has inherent value for the AI. In many of these cses, the value comes with an acceptable cost.

That's disputable because of opportunity cost. Acting to hinder one rival (who may or may not be a major rival) at your own expense is a questionable strategy when you could be doing many other things that improve your empire, strategically target your main rivals or hinder all of your rivals at once. Additionally, wars cause war weariness, particularly for the losing side, which is never beneficial. And finally, Settlers are more expensive in recent versions...
 
Firstly, a human would never play like this. Why would you harm yourself just to be an annoyance to another?

You say that you can't assume it's a bad move, we're not. The AI is settling cities that are objectively bad from a yields standpoint, I think we agree on that. But what you bring up is that the AI is doing this to be a pain in the ass, to be as annoying as possible. Well, first off, the AI isn't doing this on purpose. It's not thinking, "how can I be as annoying as possible" "I know, I'll settle a bad city!", It's a bug in the code that causes that. The AI isn't smart enough to do that. And even if it was, the AI shouldn't make that type of decision. You said that the AI should make these decisions because they are a hindrance and really annoying. The fact is, that's not how the AI should play. First off, it's not how a human plays. I know that obviously the AI won't play like a human, but this is a strategy that isn't ever used. But mainly, the AI shouldn't strive to be "annoying". The point of the AI is to feel like you have an opponent that is at least making some sort of interesting decision, not that they are just trying to be as annoying as possible. If the AI was like that (thank god they aren't) then they wouldn't accept trade deals with the player, for example. It would be a pain in the ass for the player and would hinder their progress. But it would also just be annoying.

The cost of the city is pretty big, and the benefits of being slightly annoying are very small, and even then, shouldn't be benefits in the first place.

I have done this sort of thing before, and now intend to pursue it as a situational strategy. Maybe we should say you would never play like this, you don't think much of my game play, and move on from there.

I started my end of this conversation saying that the AI is behaving this way because of a bug. That it's likely bug-driven is the biggest problem I have with the status quo. But it has nothing to do with the point I'm making.

I found enough benefits to say it's something I might do. Consequently, if ilteroi found a way for the AI to be more intentional about it, it's not necessarily a bad thing for the AI to be doing. I understand that you disagree with this line of thinking.

That's disputable because of opportunity cost. Acting to hinder one rival (who may or may not be a major rival) at your own expense is a questionable strategy when you could be doing many other things that improve your empire, strategically target your main rivals or hinder all of your rivals at once. Additionally, wars cause war weariness, particularly for the losing side, which is never beneficial. And finally, Settlers are more expensive in recent versions...

I see very little downside to either 1) having my small city strategically blocking a rival's peacetime sea movement or 2) having that rival declare war and damage his diplomatic status and perhaps his territorial integrity, if I have the right DPs in place.

In the first case, where it never leads to war, which happens a good amount of the time, I may have additional slight unhappiness from a small crappy city. Managing the situation is no biggie.

In the second case, I lose the investment of a settler and military unit. To paraphrase tu_79, it's a pawn sacrifice. I don't consider that hammer investment to be a problem by the time DP's come online, if they are part of a strategy to hinder a rival I take seriously. Likewise, war weariness isn't going to be all that crushing since, in the example being discussed (Adwa), my homeland isn't contiguous to the rival, and I'm unlikely to really "lose" the war. Much more likely, given that the rival is fighting with my allies as well, he settles with me for very little.

Can I imagine scenarios where it's not so beneficial? Sure. That's why I view it as situational.
 
Using 15-5 DLL, came across two weird bugs.
1-Zulu fusiliers upgraded from Impis perform a ranged attack before the melee one.
2-Melee naval units stationed in cities cannot attack enemy naval units if they are in the tile immediately adjacent to the city.
 
Using 15-5 DLL, came across two weird bugs.
1-Zulu fusiliers upgraded from Impis perform a ranged attack before the melee one.
2-Melee naval units stationed in cities cannot attack enemy naval units if they are in the tile immediately adjacent to the city.
#2 is intentional and not mentioned in the version changelog (it was already reported on GitHub). I personally dislike it and want it reverted.
 
With Zulus it seems intended. Always was like this.

Here i am wrong.
 
Last edited:
With Zulus it seems intended. Always was like this.
The spear throw promotion clearly states that it's lost with upgrade.


#2 is intentional and not mentioned in the version changelog (it was already reported on GitHub). I personally dislike it and want it reverted.

I have no idea why was this changed, i don't recall anyone complaining about it at all.
 
I will say that I do use forward settling as a tactic against AI. Controlling the borders to cut off access to parts of the map can be a very useful strategy. In such cases, my primary consideration for the spot is defensibility. The area needs to be able to hold off a large assault, as I assume the AI will attack it, and it will be far enough away that I won't have a majority of my army present.

So if the AI is forward settling in a strong defensive position, than honestly that's just good play. If its just settling in open space with no benefits, than yes that's bad behavior and should be adjusted.
 
I see very little downside to either 1) having my small city strategically blocking a rival's peacetime sea movement or 2) having that rival declare war and damage his diplomatic status and perhaps his territorial integrity, if I have the right DPs in place.

In the first case, where it never leads to war, which happens a good amount of the time, I may have additional slight unhappiness from a small crappy city. Managing the situation is no biggie.

In the second case, I lose the investment of a settler and military unit. To paraphrase tu_79, it's a pawn sacrifice. I don't consider that hammer investment to be a problem by the time DP's come online, if they are part of a strategy to hinder a rival I take seriously. Likewise, war weariness isn't going to be all that crushing since, in the example being discussed (Adwa), my homeland isn't contiguous to the rival, and I'm unlikely to really "lose" the war. Much more likely, given that the rival is fighting with my allies as well, he settles with me for very little.

Can I imagine scenarios where it's not so beneficial? Sure. That's why I view it as situational.

I can agree that it may be situationally useful for the human player. I don't think the AI could use it effectively, for a few reasons:


1) Due to memory and performance limitations, the tactical AI can't "remember" where all of a player's units are unless it can see them, and I don't think it has the ability to estimate unit density in an area it can't see that well either. It can evaluate a city's defensive potential to some degree, but this isn't perfect. This is something humans can inherently use better through superior memory and intuition.

2) A strategy often used by humans is to intentionally prolong a war to inflict war weariness on the opponent and cripple them.

3) Diverting forces to defend the crappy city weakens the AI's ability to fight other opponents. The AI isn't really programmed to just abandon their cities AFAIK.

4) Settler costs scale and also cost population (a higher cost later in the game when more Food is required per Population). Even if you consider the investment trivial, 5-10 turns of lost Production is still worthwhile. AIs don't receive bonuses towards Settler production, either.

5) Diplomacy fluctuates and alliances change. It may be a good idea with one set of DPs, but a single change could make it a bad or even terrible idea to provoke another player, especially if they're stronger than you. It doesn't always ruin a player's diplomacy to declare war and capture a city, and razing barely has an impact on relations with other civs (other than the civ whose cities you razed).

6) Each city you own increases the cost of tech and policies, in addition to the potential unhappiness and diplomatic repercussions.

Either way, it may be situationally useful, but I don't think it's likely to be a viable AI tactic. Settling well-placed, defensible cities near another civ's borders is a different matter.

Another couple notes:


1) I intend on programming the AI to be more likely to DoW other players who settle poorly-defended, isolated cities near them at some point (taking into account strength, DPs, defensibility, etc. of course).

2) AI does try to use DPs strategically for bloc building the way a human would, as well. It could still use improvement, and my interaction rework will aim to make progress there.
 
I can agree that it may be situationally useful for the human player. I don't think the AI could use it effectively, for a few reasons:

1) Due to memory and performance limitations, the tactical AI can't "remember" where all of a player's units are unless it can see them, and I don't think it has the ability to estimate unit density in an area it can't see that well either. It can evaluate a city's defensive potential to some degree, but this isn't perfect. This is something humans can inherently use better through superior memory and intuition.

2) A strategy often used by humans is to intentionally prolong a war to inflict war weariness on the opponent and cripple them.

3) Diverting forces to defend the crappy city weakens the AI's ability to fight other opponents. The AI isn't really programmed to just abandon their cities AFAIK.

4) Settler costs scale and also cost population (a higher cost later in the game when more Food is required per Population). Even if you consider the investment trivial, 5-10 turns of lost Production is still worthwhile. AIs don't receive bonuses towards Settler production, either.

5) Diplomacy fluctuates and alliances change. It may be a good idea with one set of DPs, but a single change could make it a bad or even terrible idea to provoke another player, especially if they're stronger than you. It doesn't always ruin a player's diplomacy to declare war and capture a city, and razing barely has an impact on relations with other civs (other than the civ whose cities you razed).

6) Each city you own increases the cost of tech and policies, in addition to the potential unhappiness and diplomatic repercussions.

Either way, it may be situationally useful, but I don't think it's likely to be a viable AI tactic. Settling well-placed, defensible cities near another civ's borders is a different matter.

Another couple notes:


1) I intend on programming the AI to be more likely to DoW other players who settle poorly-defended, isolated cities near them at some point (taking into account strength, DPs, defensibility, etc. of course).

2) AI does try to use DPs strategically for bloc building the way a human would, as well. It could still use improvement, and my interaction rework will aim to make progress there.

Agreed!
 
Can barbarians now raid for more yields than the city they are raiding produces? Just had a pair of barbarians raid a secondary city for 9 food (the per turn produced in that city) and 16 culture (the city produces 4 per turn; my entire civ produces 32 at this point). If that's as intended so be it; makes defending those border cities all the more vital.
 
Can barbarians now raid for more yields than the city they are raiding produces? Just had a pair of barbarians raid a secondary city for 9 food (the per turn produced in that city) and 16 culture (the city produces 4 per turn; my entire civ produces 32 at this point). If that's as intended so be it; makes defending those border cities all the more vital.

Yes - if I recall correctly, it steals yields equal to X turns of output.

To everyone discussing city settling logic, ilteroi has a question on this issue, which you can respond to here: https://github.com/LoneGazebo/Community-Patch-DLL/issues/6621

there seem to be two issues being mixed up here.
  1. AI is settling in bad places from a yield perspective. This is a fine line, how do you define an acceptable site? What is a good plot, and how many do you need? Does it depend on tech level? Map settings?
  2. AI is settling in bad places from a strategic perspective. again, hard to say what should be a general rule here? How far out is too far? Does it depend on military strength? map size? game speed? What about new continents?

of course the two aspects can overlap as well ... if anyone has a good proposal, let's hear it!
 
Couple noteworthy fixes for next version:
Code:
AI settlers being unprotected should be fixed (might also apply to other civilians, not sure) (fixed by ilteroi)

Sanctioned players will no longer have their trade routes and corporation franchises removed from master/vassal cities
(you were able to create new trade routes/franchises but your current ones were removed, which didn't make sense since they're meant to be exempted)

Fixed a bug applying an erroneous -400 modifier to AI scoring for sanctions (that applied almost all of the time); also uses true approach rather than surface approach in calculations now
- This might cause the AI to really like sanctions in the next version, so keep an eye on it
 
Last edited:
Status
Not open for further replies.
Back
Top Bottom