Aggressive AI

It still doesn't know how to deal with one unit per tile mechanics, so even when it thinks it can win, it just loses a lot of hammers in units to a player because they judge him weak.

I wasn't really saying they're not competitive, just that human players who play civ aren't necessarily that competitive either. For me at least, Civ is more about building a cool empire, instead of exploiting every tiny weakness in your neighbors. I think AI aggressiveness could definetly be toned down in lower difficulty levels.

I won't go into the reasons why you are incorrect, but - suffice to say - you are incorrect.

G
 
It still doesn't know how to deal with one unit per tile mechanics, so even when it thinks it can win, it just loses a lot of hammers in units to a player because they judge him weak.

I wasn't really saying they're not competitive, just that human players who play civ aren't necessarily that competitive either. For me at least, Civ is more about building a cool empire, instead of exploiting every tiny weakness in your neighbors. I think AI aggressiveness could definetly be toned down in lower difficulty levels.
Unit per tile is far from being the problem. The main problem is that human players are usually better at tactical warfare than at value optimization.
But if you present VP to people that are not used to warfare games, the AI will be more efficient that them in war (I've seen player doing some 1 kill 1 death quite frequently against barbarians)

But I do agree that aggressiveness could be lowered as an option (like chill barbarians).
 
My last game on the last version with one-city venice: not a single war and i didn't had many units. (tourism victory)
Is being a good trading partner and no border dispute a great way to make long-lasting friends?

Maybe the aggressiveness should be a bit higher... /s
 
I personally don't have a problem with the AI being aggressive.

But when it's aggressive when it has literally no chance to win just because you're ahead, it kind of bugs me. For example, I granted Brazil their independence in the late game and they had one city left and a very small land military, while I had nukes and stealth bombers, controlled pretty much all of the Earth, and had a massive tech lead with thousands of GPT.

They and Indonesia thought a co-op war would go well; I steamrolled their entire empires in 4 turns with my vastly superior might.

When the situation is like that, I feel they shouldn't declare war because it's just pointless. This after I had won a Diplo Victory, too.
 
I personally don't have a problem with the AI being aggressive.

But when it's aggressive when it has literally no chance to win just because you're ahead, it kind of bugs me. For example, I granted Brazil their independence in the late game and they had one city left and a very small land military, while I had nukes and stealth bombers, controlled pretty much all of the Earth, and had a massive tech lead with thousands of GPT.

They and Indonesia thought a co-op war would go well; I steamrolled their entire empires in 4 turns with my vastly superior might.

When the situation is like that, I feel they shouldn't declare war because it's just pointless. This after I had won a Diplo Victory, too.
With the old behavior, once you are dominant, you only have to press next button without worrying a lot. If you liked that more, then you may as well consider that you did win once all AI turn on you. But without this panic mode, the final turns are a bit boring.
 
I personally don't have a problem with the AI being aggressive.

But when it's aggressive when it has literally no chance to win just because you're ahead, it kind of bugs me. For example, I granted Brazil their independence in the late game and they had one city left and a very small land military, while I had nukes and stealth bombers, controlled pretty much all of the Earth, and had a massive tech lead with thousands of GPT.

They and Indonesia thought a co-op war would go well; I steamrolled their entire empires in 4 turns with my vastly superior might.

When the situation is like that, I feel they shouldn't declare war because it's just pointless. This after I had won a Diplo Victory, too.

Sorry, but all I hear when I see stuff like this is "I want the AI to play to win but I also want the AI to roll over because I'm winning." Can't have it both ways.

G
 
You can change AI flavors of every leader to be more peacefully. It still works for Vox Populi, right?
 
Not exactly, I do appreciate how competitive the AI is before I get to that point.

What I'm saying is more like "it makes no realistic sense for the AI to declare war when their chances of winning a war are zero, because it's suicidal and will wipe out their people". It's an issue with realism more than gameplay - I don't mind warring with the AI, but when they bring Infantry to a nuke fight...

I don't want them to roll over, I just don't want them to wipe themselves out with suicidal behavior. Doesn't seem smart. :lol:

Well, and it's a bit frustrating in terms of realism if an AI I've helped all game declares war due to a victory lead after I've already won.

I'll probably just play on a higher difficulty, that'll solve the issue.
 
With the old behavior, once you are dominant, you only have to press next button without worrying a lot. If you liked that more, then you may as well consider that you did win once all AI turn on you. But without this panic mode, the final turns are a bit boring.

You have a point, though. I'd rather do that than just hit next turn. :P
 
I wonder if you can make an option for telling AI that the player is competent at fighting. In such case, selecting this option could prevent AI attacking the player when he has enough units to crush any incoming attack.

Alternatively, you could increase the AI military appreciation of the player in lower difficulties. I always read people complaining about AI attacking too often and without any chance of success, not the opposite. We're talking chieftain and above.
 
Yeah, sometimes I get DoW 4 or 5 times in row from one nation and every time, they lose a lot of units but didnt make any progress.
Could we consider a modifier which includes the results of previous wars for the decision progress of war declaration?
I dont say its a bad behavior to attack at even bad situations, cause its maybe the last chance to turn the game towards AI favor. The modifier could be overwritten, if the AI has to decide to go to war to stop a winning player.
But its simply annoying to fight several times the same war while you already know what will happen and are not in the mooth to go conquering spree.
 
-Give gifts (+20 GPT early on does wonders. Thanks @John.B.C !) You get a +35 trade modifier which would override the -25 from Territorial Disputes early on..
-Trade. This reinforces the same trade modifier that gifts do. If you're ahead, AIs will be less likely to attack because they can get science/culture from you.
-Spread Religion if you can. This gives a hefty positive modifier.
-Avoid actively pissing off powerful civs in the World Congress. Vote for proposals that are kind of irrelevant sometimes (the Natural Wonder proposal).
-Get to the middle of the pack, scientifically and culturally. If you're behind the pack, they'll attack you because they see you as weak, and if you're greatly ahead, they'll also attack (but this isn't as bad because you should be in the lead)
-Make sure that other civs are closer to your neighbours than you are. Sometimes settling a city 1 or 2 tiles back can make a fairly big difference.
-Militarily, you don't need to be on top. However, keep these things in mind:
-The AI considers your army relative to your empire size, so bigger empires need more military
-The AI considers your army to be a bit more powerful than it actually is. On Deity the AI considers your army twice as powerful as it actually is, on King it would be a little less (perhaps @Gazebo could please shed some light on the AI perception of your army across difficulties) but still significant. Look at your neighbours size compared to yours and the difficulty you're playing and calculate a ratio where your perceived army is roughly the same)
-Finally, don't be so scared of war when it happens. Even if it's purely defensive, you will earn Generals, promote your troops, and force the AI to lose Production and Gold in lost units fighting you and you might just be able to snipe a city or pillage the AI to set it back. Find a defensive position, maybe plant a Citadel, be very careful not to lose units, and you should be able to beat the AI back without letting them pour in. City-State allies and Defensive Pacts (or just joint wars) can help too.
-The alternative is to play aggressive. If you play Authority you'll get a ton of yields from war (Progress and Tradition can profit off war too!). Make a large army early on, promote it to Level 5+, and beat the AI at its own game.
 
AIs learning from previous wars and tending to attack either with a different tactic (grouping up, exploiting third-party wars, using diplomacy, spying, etc.), or with a stronger comparative military power than last time is an idea I really like, realism-wise.

However I still think they should attack to prevent you from winning (perhaps not the suicidal behavior I described, but if it makes the late game more interesting, so be it, I'll play on a higher difficulty). :)
 
Yeah, sometimes I get DoW 4 or 5 times in row from one nation and every time, they lose a lot of units but didnt make any progress.
Could we consider a modifier which includes the results of previous wars for the decision progress of war declaration?
I dont say its a bad behavior to attack at even bad situations, cause its maybe the last chance to turn the game towards AI favor. The modifier could be overwritten, if the AI has to decide to go to war to stop a winning player.
But its simply annoying to fight several times the same war while you already know what will happen and are not in the mooth to go conquering spree.

AIs learning from previous wars and tending to attack either with a different tactic (grouping up, exploiting third-party wars, using diplomacy, spying, etc.), or with a stronger comparative military power than last time is an idea I really like, realism-wise.

However I still think they should attack to prevent you from winning (perhaps not the suicidal behavior I described, but if it makes the late game more interesting, so be it, I'll play on a higher difficulty). :)

Sure and I'll just get an API key for DeepBlue and then we'll be set!

You guys can be ridiculous sometimes.

G
 
Haha, point taken.

The AI is still a lot better (leagues better) than in vanilla, we do appreciate that. ;)
 
Sure and I'll just get an API key for DeepBlue and then we'll be set!

You guys can be ridiculous sometimes.

G
The calculation if AI goes to war is also only a comparison of 2 values, or?
Like:
if ( own strenght * modifiers > enemy strenght * modifiers )
= go to war

If we add:
PreviousWarModifier.X = set to 1
X = the different civs in the game
At the end of a war with Civ X:
Set PreviousWarModifier.X = PreviousWarModifier.X * (1+WarResult/100*Y)
Y= the percentage of the war score which influence the modifier (I think 20% sounds good)

And maybe a balance mechanic like:
If finished a technology [set PreviousWarModifier.X = PreviousWarModifier.X + (1 - PreviousWarModifier.X) * 0,02]
 
The calculation if AI goes to war is also only a comparison of 2 values, or?
Like:
if ( own strenght * modifiers > enemy strenght * modifiers )
= go to war

If we add:
PreviousWarModifier.X = set to 1
X = the different civs in the game
At the end of a war with Civ X:
Set PreviousWarModifier.X = PreviousWarModifier.X * (1+WarResult/100*Y)
Y= the percentage of the war score which influence the modifier (I think 20% sounds good)

And maybe a balance mechanic like:
If finished a technology [set PreviousWarModifier.X = PreviousWarModifier.X + (1 - PreviousWarModifier.X) * 0,02]
No. That's far more complex. The code is there:

Code:
/// Handles declarations of War for this AI
void CvDiplomacyAI::DoMakeWarOnPlayer(PlayerTypes eTargetPlayer)
{
   CvAIOperation* pOperation;
    bool bWantToAttack = false;
    bool bDeclareWar = false;

    if(!IsPlayerValid(eTargetPlayer))
        return;

    if(GetWarGoal(eTargetPlayer) == WAR_GOAL_DEMAND)
        return;

    if(IsAtWar(eTargetPlayer))
        return;

    // Don't make demands of them too often (deal speed best idea)
    if(GetNumTurnsSinceStatementSent(eTargetPlayer, DIPLO_STATEMENT_DEMAND) <= GC.getGame().getGameSpeedInfo().GetDealDuration())
        return;

    bool bAtWarWithAtLeastOneMajor = MilitaryAIHelpers::IsTestStrategy_AtWar(m_pPlayer, false);
    // Minor Civ
    if(GET_PLAYER(eTargetPlayer).isMinorCiv())
    {
        bWantToAttack = !bAtWarWithAtLeastOneMajor && (GetMinorCivApproach(eTargetPlayer) == MINOR_CIV_APPROACH_CONQUEST);
        pOperation = GetPlayer()->GetMilitaryAI()->GetSneakAttackOperation(eTargetPlayer);
    }
    // Major Civ
    else
    {
        MajorCivApproachTypes eApproach = GetMajorCivApproach(eTargetPlayer, /*bHideTrueFeelings*/ false);
        bWantToAttack = (eApproach == MAJOR_CIV_APPROACH_WAR || (eApproach <= MAJOR_CIV_APPROACH_HOSTILE && IsGoingForWorldConquest()));
        bWantToAttack = bWantToAttack && !bAtWarWithAtLeastOneMajor; // let's not get into another war right now
        if(MOD_DIPLOMACY_CIV4_FEATURES && bWantToAttack)
        {
            if(IsPlayerMoveTroopsRequestAccepted(eTargetPlayer))
            {
                bWantToAttack = false;    // don't declare war on a player we promised not to attack, unless we're wily!
            }
        }
        pOperation = GetPlayer()->GetMilitaryAI()->GetSneakAttackOperation(eTargetPlayer);
    }

    // Not yet readying an attack
    if(pOperation == NULL && !IsMusteringForAttack(eTargetPlayer))    // If we're "mustering" it means we had a Sneak Attack Operation that finished
    {
        if(!GET_TEAM(GetTeam()).isAtWar(GET_PLAYER(eTargetPlayer).getTeam()))
        {
            if(GET_TEAM(GetTeam()).canDeclareWar(GET_PLAYER(eTargetPlayer).getTeam(), GetPlayer()->GetID()))
            {
                // Want to declare war on someone
                if(bWantToAttack)
                {
                    SetWarGoal(eTargetPlayer, WAR_GOAL_PREPARE);

                    // Attack on minor
                    if(GET_PLAYER(eTargetPlayer).isMinorCiv())
                        GetPlayer()->GetMilitaryAI()->RequestCityStateAttack(eTargetPlayer);
                    // Attack on major
                    else
                    {
                        GetPlayer()->GetMilitaryAI()->RequestSneakAttack(eTargetPlayer);
                        SetWantsSneakAttack(eTargetPlayer, true);
                    }
                }
                else
                {
                    SetWarGoal(eTargetPlayer, NO_WAR_GOAL_TYPE);
                    SetWantsSneakAttack(eTargetPlayer, false);
                }
            }
        }
    }
    // We already have an attack on the way
    else
    {
        // Our Approach with this player calls for war
        if(bWantToAttack)
        {
            if(!IsAtWar(eTargetPlayer))
            {
                if(GET_TEAM(GetTeam()).canDeclareWar(GET_PLAYER(eTargetPlayer).getTeam(), GetPlayer()->GetID()))
                {
                    // If we're at least 85% of the way to our objective, let loose the dogs of war!
                    if(IsMusteringForAttack(eTargetPlayer) || (pOperation != NULL && pOperation->GetOperationState() == AI_OPERATION_STATE_SUCCESSFUL_FINISH))    // If we're "mustering" it means we have a Sneak Attack Operation that's in position to attack
                    {
                        bDeclareWar = true;
                        SetMusteringForAttack(eTargetPlayer, false);
                        SetWantsSneakAttack(eTargetPlayer, false);
                    }
                }
            }
        }

        // We were planning an attack, but changed our minds so abort
        else
        {
            if(pOperation != NULL)
            {
                SetWantsSneakAttack(eTargetPlayer, false);
                pOperation->SetToAbort(AI_ABORT_DIPLO_OPINION_CHANGE);
                SetWarGoal(eTargetPlayer, NO_WAR_GOAL_TYPE);
                SetMusteringForAttack(eTargetPlayer, false);
            }
        }

        // If our Sneak Attack is read then actually initiate the DoW
        if(bDeclareWar)
        {
            DeclareWar(eTargetPlayer);
            SetWantsSneakAttack(eTargetPlayer, false);
        }
    }
}

/// Handles declarations of War for this AI
void CvDiplomacyAI::MakeWar()
{
    CvWeightedVector<int> playerList;
    int iWeight;

    if((int)m_eTargetPlayer >= (int)DIPLO_FIRST_PLAYER)
    {
        DoMakeWarOnPlayer((PlayerTypes)m_eTargetPlayer);
    }
    else
    {
        for(int iPlayerLoop = 0; iPlayerLoop < MAX_CIV_PLAYERS; iPlayerLoop++)
        {
            PlayerTypes eTarget = (PlayerTypes)iPlayerLoop;
            if(GC.getGame().isReallyNetworkMultiPlayer() && MOD_ACTIVE_DIPLOMACY)
            {
                if (IsPlayerValid(eTarget))
                {
                    iWeight = (int)GetWarProjection(eTarget) + 1;

                    // Square the distance enum to make it crucial
                    iWeight *= (1 + (int)GetPlayer()->GetProximityToPlayer(eTarget));
                    iWeight *= (1 + (int)GetPlayer()->GetProximityToPlayer(eTarget));

                    if(iPlayerLoop < MAX_MAJOR_CIVS)
                    {
                        if(GetMajorCivOpinion(eTarget) == MAJOR_CIV_OPINION_UNFORGIVABLE)
                        {
                            iWeight *= 2;
                        }

                        iWeight *= 10;  // Make sure majors are looked at before city states
                    }

                    playerList.push_back(iPlayerLoop, iWeight);
                }
            }
            else
            {
                if(IsValidUIDiplomacyTarget(eTarget) && IsPlayerValid(eTarget))
                {
                    iWeight = (int)GetWarProjection(eTarget) + 1;

                    // Square the distance enum to make it crucial
                    iWeight *= (1 + (int)GetPlayer()->GetProximityToPlayer(eTarget));
                    iWeight *= (1 + (int)GetPlayer()->GetProximityToPlayer(eTarget));

                    if(iPlayerLoop < MAX_MAJOR_CIVS)
                    {
                        if(GetMajorCivOpinion(eTarget) == MAJOR_CIV_OPINION_UNFORGIVABLE)
                        {
                            iWeight *= 2;
                        }

                        iWeight *= 10;  // Make sure majors are looked at before city states
                    }

                    playerList.push_back(iPlayerLoop, iWeight);
                }
            }
        }

        playerList.SortItems();

        for(int iI = 0; iI < playerList.size(); iI++)
        {
            DoMakeWarOnPlayer((PlayerTypes)playerList.GetElement(iI));
        }
    }

    // Increment counters for co-op wars we have agreed to - this may trigger war
    for(int iPlayerLoop = 0; iPlayerLoop < MAX_CIV_PLAYERS; iPlayerLoop++)
    {
        PlayerTypes eLoopPlayer = (PlayerTypes) iPlayerLoop;

        if(IsPlayerValid(eLoopPlayer))
        {
            if(!GET_PLAYER(eLoopPlayer).isMinorCiv())
            {
                for(int iThirdPlayerLoop = 0; iThirdPlayerLoop < MAX_MAJOR_CIVS; iThirdPlayerLoop++)
                {
                    PlayerTypes eThirdPlayer = (PlayerTypes) iThirdPlayerLoop;
                    if (IsPlayerValid(eThirdPlayer))
                    {
                        if(GetCoopWarCounter(eLoopPlayer, eThirdPlayer) >= 0)
                        {
                            ChangeCoopWarCounter(eLoopPlayer, eThirdPlayer, 1);

                            // AI players will always declare war at 10 turns, so we simplify things here - humans are handled by DoCoopWarTimeStatement()
                            if(!GET_PLAYER(eLoopPlayer).isHuman())
                            {
                                if(GetCoopWarAcceptedState(eLoopPlayer, eThirdPlayer) == COOP_WAR_STATE_SOON &&
                                    GetCoopWarCounter(eLoopPlayer, eThirdPlayer) == /*10*/ GC.getCOOP_WAR_SOON_COUNTER())
                                {
                                    // Us
                                    SetCoopWarAcceptedState(eLoopPlayer, eThirdPlayer, COOP_WAR_STATE_ACCEPTED);
                                    SetCoopWarCounter(eLoopPlayer, eThirdPlayer, 0);
                                    DeclareWar(eThirdPlayer);
                                    GetPlayer()->GetMilitaryAI()->RequestBasicAttack(eThirdPlayer, 2);

                                    int iLockedTurns = /*15*/ GC.getCOOP_WAR_LOCKED_LENGTH();
                                    GET_TEAM(GetPlayer()->getTeam()).ChangeNumTurnsLockedIntoWar(GET_PLAYER(eThirdPlayer).getTeam(), iLockedTurns);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
 
Back
Top Bottom