Aggressive AI

Tracking DOWs backwards and tracing the behavior to see if it meshes with the civ's actual reality.

G
Ive seen the weighted values for decision making, if AI want to be friendly, neutral, hostal, .... and some of the factors are kinda strange to me.
There are too many factors, and some are weighted kinda silly.
The hostility is increased by 5 or 10 times the hostility bias, if an AI nation has its UU, but if the AI enemy has a defence pact, the hostility is only reduced by 2 times the bias of hostility.
Why does the UU has much more impact than a defence pact? Sure, UU are strong, but its kinda silly to weight the UU 5 times higher than a defence pact. If I get raped by 2 same strenght enemies, not even my UU will help me.
Those values should be reworked a bit.
Also, I missed something like a historic friendship modifier. Having a all time ally or atleast long term friend should be valued more.
 
Ive seen the weighted values for decision making, if AI want to be friendly, neutral, hostal, .... and some of the factors are kinda strange to me.
There are too many factors, and some are weighted kinda silly.
The hostility is increased by 5 or 10 times the hostility bias, if an AI nation has its UU, but if the AI enemy has a defence pact, the hostility is only reduced by 2 times the bias of hostility.
Why does the UU has much more impact than a defence pact? Sure, UU are strong, but its kinda silly to weight the UU 5 times higher than a defence pact. If I get raped by 2 same strenght enemies, not even my UU will help me.
Those values should be reworked a bit.
Also, I missed something like a historic friendship modifier. Having a all time ally or atleast long term friend should be valued more.

The weight is relative to the player's own weight for the approach type, so you're mistaken on it being incorrect.

G
 
The weight is relative to the player's own weight for the approach type, so you're mistaken on it being incorrect.

G
I know its related to its own bias, but 10 times hostile bias is still 5 times higher than 2 times hostile bias. No matter how much the bias is.

Other player has a Defensive Pact with the player we're looking at
If the other player's military strength is equal to or greater than ours:
- Subtract 2x WAR bias from WAR approach.
- Subtract 2x HOSTILE bias from HOSTILE approach.

If this civilization has a unique unit:

We have the unique unit unlocked, and at least one of them active
- Multiply WAR approach score by 10.
- Multiply HOSTILE approach score by 10.
 
I know its related to its own bias, but 10 times hostile bias is still 5 times higher than 2 times hostile bias. No matter how much the bias is.

Other player has a Defensive Pact with the player we're looking at
If the other player's military strength is equal to or greater than ours:
- Subtract 2x WAR bias from WAR approach.
- Subtract 2x HOSTILE bias from HOSTILE approach.

If this civilization has a unique unit:

We have the unique unit unlocked, and at least one of them active
- Multiply WAR approach score by 10.
- Multiply HOSTILE approach score by 10.

Consider too the opinion elements that play into this - they're calculated in at the end of the function, and they're quite important.

G
 
Consider too the opinion elements that play into this - they're calculated in at the end of the function, and they're quite important.

G
Both values are changed by the opinion modifier in the end in the same way.... I didnt see any difference.. its still 5 times higher....
 
Both values are changed by the opinion modifier in the end in the same way.... I didnt see any difference.. its still 5 times higher....

It's not '5 times higher' - whatever the value going into that part of the function is increased by a multipliedx5 value.

Seriously, though, I'm super duper tired of debating this with you guys. AI work like this is one area that I really prefer to just iterate without group think.

G
 
Tracking DOWs backwards and tracing the behavior to see if it meshes with the civ's actual reality.

G

So, basically a double check to make sure that the DoW is a good idea before it's initiated?

I'm not gonna debate further, I'm still trying to make sense of the existing diplomacy functions - looking into those other functions called by the approach function, so I can write a better diplomacy guide in the future. :lol:
 
So, basically a double check to make sure that the DoW is a good idea before it's initiated?
Pretty sure that what he meant was that Gazebo, not the AI, is doing some checking on AI DOWs to see if the evaluation algorithms are producing results that represent ingame reality. Since the AI isn't sentient (yet, how long do we still have to wait for this Gazebo huh? Seriously...smh :lol:) it can't really check on its own scripting to see if it makes sense.
 
G, if you are still analyzing this, I would consider looking into a large amount of weak units being overvalued in terms of strength by the current AI. This is my experience, and it would be consistent with the experience posted by others who feel the AI is overly aggressive early on, often when it has only warriors.
 
G, if you are still analyzing this, I would consider looking into a large amount of weak units being overvalued in terms of strength by the current AI. This is my experience, and it would be consistent with the experience posted by others who feel the AI is overly aggressive early on, often when it has only warriors.
Do you mean that the strength of the army is not the sum of all the units, but it is lowered by the number of units since more units require more space to maneuver?
I thought it was already considered.

I guess that three warriors can beat two spearsmen, even when the sum of their strengths is the same, thanks to flanking, but this can be true in open terrain. If the terrain does not allow those warriors to attack at once, or if any of them has not yet arrived to the front line (which happens often), then the stronger units have the upper hand.
When we are talking about tenths of units, being in the front line matters more than what flanking may provide (this is why ranged units, even being theoretically weaker, are still good, since they reach the front line from a far. Extra mobility too, to a lesser extent.
 
I guess that three warriors can beat two spearsmen, even when the sum of their strengths is the same, thanks to flanking, but this can be true in open terrain. If the terrain does not allow those warriors to attack at once, or if any of them has not yet arrived to the front line (which happens often), then the stronger units have the upper hand.
When we are talking about tenths of units, being in the front line matters more than what flanking may provide (this is why ranged units, even being theoretically weaker, are still good, since they reach the front line from a far. Extra mobility too, to a lesser extent.
2 spearmen are much stronger than 3 warriors, I'm pretty sure the warriors would lose in most exchanges. The thing is melee units just won't attack if they are at enough of a disadvantage (which is smart). However, it also means that Siam over there has no business trying to fight me, because his army appears to be 100% warriors, and I have a horsemen, which even if surrounded and outnumbered 3:1, he won't attack and I'd win anyways if he did.
 
Is there a way to just disable brokered wars in the game files somehow? All the games I play basically have no diplomacy since everybody hates everybody because of brokered wars. Diplomacy seems chaotic in general. Civilizations that I've been on good terms with for a long time and have a defensive pact with just denounce me for no reason and major trade partners declare brokered wars. They basically get more from my trade routes than they get for declaring war...
 
Last edited:
2 spearmen are much stronger than 3 warriors, I'm pretty sure the warriors would lose in most exchanges. The thing is melee units just won't attack if they are at enough of a disadvantage (which is smart). However, it also means that Siam over there has no business trying to fight me, because his army appears to be 100% warriors, and I have a horsemen, which even if surrounded and outnumbered 3:1, he won't attack and I'd win anyways if he did.
I was referring to the hypothetical case of three warriors summing up the same strength as two spearsmen. Making the case that adding all unit strengths, even when weighted by unit type, is not enough.

Anyway, G has been watching AI fight against themselves for a while, so I was confident that AI was able to account for military might properly, at least valuing other AI forces.
 
Here's my (more complete and seemingly mostly correct understanding) of the way the function works. But I'd still appreciate clarifications from people who know more, if they have any comments. :)

For anyone who's interested, I have updated the AI approach selection guide I wrote based off of the function. It is accurate as of 7-15 and has fixed all of the values previously listed as unknown (I understand how distance is factored in now, for example). Also fixed a few small errors I made in initially interpreting it, and a few bugs that were fixed in the latest version (there was a bug making the AI more aggressive when they approached science, culture or diplomatic victory).

...With one exception as far as unknown values, ironically #1. I'm still unsure of how the current approach bias affects AI approach, if at all. G, mind helping me here? :)
Code:
#if defined(MOD_BALANCE_CORE)
   ////////////////////////////////////
    // CURRENT APPROACH BIASES
    ////////////////////////////////////

    // Bias for our current Approach.  This should prevent it from jumping around from turn-to-turn as much
    // We use the scratch pad here since the normal array has been cleared so that we have knowledge of who we've already assigned an Approach for this turn; this should be the only place the scratch pad is used
    MajorCivApproachTypes eOldApproach = (MajorCivApproachTypes)m_paeApproachScratchPad[ePlayer];
    if (eOldApproach == NO_MAJOR_CIV_APPROACH)
        eOldApproach = MAJOR_CIV_APPROACH_NEUTRAL;

    FStaticVector< int, 128, true, c_eCiv5GameplayDLL > viApproachWeightsPersonality;
    for (iApproachLoop = 0; iApproachLoop < NUM_MAJOR_CIV_APPROACHES; iApproachLoop++)
    {
        viApproachWeightsPersonality.push_back(GetPersonalityMajorCivApproachBias((MajorCivApproachTypes)iApproachLoop));
    }

Also, as I understand it, the civ-specific approach biases like WAR, HOSTILE, etc. are not randomized from game to game, but other personality flavors, like Loyalty and Victory Competitiveness, are randomized to a degree. Is this accurate?
 
Last edited:
G, if you are still analyzing this, I would consider looking into a large amount of weak units being overvalued in terms of strength by the current AI. This is my experience, and it would be consistent with the experience posted by others who feel the AI is overly aggressive early on, often when it has only warriors.

Right now it just takes the total sum of all power of units (with power augmented by health and # of promotions on the unit). I could turn this into an average (So military power = the average of your unit power stats). Might be a better indicator of force, actually.

G
 
Right now it just takes the total sum of all power of units (with power augmented by health and # of promotions on the unit). I could turn this into an average (So military power = the average of your unit power stats). Might be a better indicator of force, actually.

G
So 1 horseman on 3rd level would be better than 20 spearmen on 2nd level?
 
Are combat strength promotions like Morale, or bonuses in foreign lands/own lands (defense bonuses important when declaring, offense bonuses important if they might declare or invade lands if declared on), or terrain bonuses, etc. factored in at all?

Might be a good idea, just throwing that out there. I imagine it'd be complex to do, though.

Also, please see my query above. :)
 
Right now it just takes the total sum of all power of units (with power augmented by health and # of promotions on the unit). I could turn this into an average (So military power = the average of your unit power stats). Might be a better indicator of force, actually.

G
I knew there was more than just raw sum of CS. Just to double check, what promotions are counting towards this? Just earned ones, right? How much are they adding? That could be the problem, the AI on Deity often has 2 or 3 pathfinders around with 3+ promotions that aren't part of the actual army. They could be driving up their perceived strength against the player, who likely has only one. Furthermore, on high difficulties the initial promotions on all units could really add up.

Basically, a warrior with shock III is still just a warrior. I'm wondering how much its earning, relative to say a horseman without promotions.
 
Newer players could benefit from a "Roleplaying AI" option that disables the panic mode. At least, having an option explaining that the panic mode exists would lower the immersion break after spending hours of play unaware of its existence.

Right now it just takes the total sum of all power of units (with power augmented by health and # of promotions on the unit). I could turn this into an average (So military power = the average of your unit power stats). Might be a better indicator of force, actually.

G

That could be a way to factor in tech difference. I didn't see something referring to having a tech advantage in the algorithm.
 
I knew there was more than just raw sum of CS. Just to double check, what promotions are counting towards this? Just earned ones, right? How much are they adding? That could be the problem, the AI on Deity often has 2 or 3 pathfinders around with 3+ promotions that aren't part of the actual army. They could be driving up their perceived strength against the player, who likely has only one. Furthermore, on high difficulties the initial promotions on all units could really add up.

Basically, a warrior with shock III is still just a warrior. I'm wondering how much its earning, relative to say a horseman without promotions.

It uses the units level to augment it.

G
 
Back
Top Bottom