Vox Populi Declaration Of Friendship Formula

It sounds like the answer is “if the AI will accept a DoF, they will offer first”. If they offer and you decline, boom negative diplo modifier. So in essence you will never be able to offer? But unless I’m misreading, people have said they have gotten the AI to accept a DoF. I would also like to get some confirmation other than rumours and advice to rummage through the code myself. Isn’t the point of a forum to share knowledge?

I play sim games often, and even in a game such as NBA 2K I can put up my players for a trade and the AI will offer a lucrative trade.. but god forbid I offer the same trade, they don’t even counter offer, just an outright refusal.

The principal factor here might be the AI being suspicious of your trade offer; imagine your enemy in Civ offering to trade for a luxury for a strangely high price? Maybe they really need the WLTKD? The AI could be doing a similar calculation and assuming you are benefiting more from the DoF/trade than they are, hence the refusal.

All in all, it is frustrating never being able to befriend an AI. Would like further insight into how this works because every Civ leaders reacts differently and it doesn’t say explicitly what you need to do to get a DoF.
 
So who can we summon that could have knowledge of this formula, or where to look for it?
 
Probably "the code people". Let me try my best incantation:

Oh @Gazebo the magnificent; Lord of the Community Patch; Keeper of the incremental sea; Guardian of the lunar scriptures...show us thy wisdom, make us see the light, reveal thyself!
*places bone fragments on the ground* *lights incense*

We offer sacrifice!
 
I agree it'd be nice to have a decent grasp of how to befriend or even play nice with the AI. One of the downsides of making them more competitive for victory is that you'll quickly earn the enmity of the all civs once you start to pull ahead. I usually RP this as other civs being jealous of my great empire but it'd be nice if there was a way to perform actual diplomacy instead of the incredibly passive diplo game we have now.

At the very least it'd be nice if we had ways to 'offer gifts' like the AI does (I think the most we can do is just give a one sided trade deal?) or even openly display that we desire peaceful relations. Instead I have to simply assume every civ that isn't offering friendship is hostile.
 
Looks like your summoning skills didn't work out (Not even sure that @ thing works, even tho' it looks like it).
Jokes aside, still waiting for some lights shed on this from someone more knowledgeable..
 
Looks like your summoning skills didn't work out (Not even sure that @ thing works, even tho' it looks like it).
Jokes aside, still waiting for some lights shed on this from someone more knowledgeable..

Patience!
 
It might surprise you that I don’t live to fulfill esoteric requests all hours of the day. :)

G
Well can you tell us whether the assessment some here have given (that it is not recommended to propose DOFs because the AI will always propose it themselves once they are ready to accept them) is correct? Seems pretty relevant for gameplay...
 
You know not what you ask for, mortals.

Code:
/// Is this AI willing to work with ePlayer?
bool CvDiplomacyAI::IsDoFAcceptable(PlayerTypes ePlayer)
{
    // Can't declare friendship with a civ you're at war with
    if(GET_TEAM(GetTeam()).isAtWar(GET_PLAYER(ePlayer).getTeam()) || GC.getGame().isOption(GAMEOPTION_ALWAYS_WAR))
    {
        return false;
    }

    // Haven't known this guy for long enough
    if(IsTooEarlyForDoF(ePlayer))
        return false;

    MajorCivApproachTypes eApproach = GetMajorCivApproach(ePlayer, /*bHideTrueFeelings*/ false);

    // If player is planning War, always say no
    if(eApproach == MAJOR_CIV_APPROACH_WAR)
        return false;
    // If player is Hostile, always say no
    else if(eApproach == MAJOR_CIV_APPROACH_HOSTILE)
        return false;
    // If player is afraid, always say yes
#if !defined(MOD_BALANCE_CORE_DIPLOMACY_ADVANCED)
    else if(eApproach == MAJOR_CIV_APPROACH_AFRAID)
        return true;
#endif

    MajorCivOpinionTypes eOpinion = GetMajorCivOpinion(ePlayer);
#if defined(MOD_BALANCE_CORE_DIPLOMACY_ADVANCED)
    if(IsDoFBroken(ePlayer))
    {
        //If we've made amends, take away the DoF malus.
        if(eOpinion >= MAJOR_CIV_OPINION_FRIEND)
        {
            SetDoFBroken(ePlayer, false);
        }
        else
        {
            return false;
        }
    }
#endif
    // If player is unforgivable, always say no
    if(eOpinion == MAJOR_CIV_OPINION_UNFORGIVABLE)
        return false;
    // If player is an enemy, always say no
    else if(eOpinion == MAJOR_CIV_OPINION_ENEMY)
        return false;

    // Has there been a denouncement either direction?
    if(IsDenouncedPlayer(ePlayer))
        return false;
    if(GET_PLAYER(ePlayer).GetDiplomacyAI()->IsDenouncedPlayer(GetPlayer()->GetID()))
        return false;

    // Are we working AGAINST ePlayer with someone else?
    //if (IsWorkingAgainstPlayer(ePlayer))
    //    return false;

    int iWeight = 0;

#if defined(MOD_BALANCE_CORE_DIPLOMACY)
    iWeight = GetDoFValue(ePlayer);

    if (ePlayer == GetMostValuableDoF(false))
    {
        iWeight += 10;
    }
    else if (ePlayer == GetMostValuableDoF(true))
    {
        iWeight += 5;
    }
    else
        iWeight -= 5;
#endif

    if(iWeight >= /*32*/ GC.getDOF_THRESHOLD())
        return true;

    return false;
}

GetDoFValue comes from the function below. The true/false 'GetMoveValuableDOF' essentially asks the AI to see if this is their best friend including current DOFs or if it is their best potential friend.

Code:
void CvDiplomacyAI::DoRelationshipPairing()
{
    // Loop through all (known) Players
    for (int iPlayerLoop = 0; iPlayerLoop < MAX_MAJOR_CIVS; iPlayerLoop++)
    {
        PlayerTypes ePlayer = (PlayerTypes)iPlayerLoop;

        int iEnemyWeight = GetMeanness();
        int iDPWeight = GetDiploBalance();
        int iDoFWeight = GetDoFWillingness();

        m_paiCompetitorValue[ePlayer] = 0;
        m_paiDefensivePactValue[ePlayer] = 0;
        m_paiDoFValue[ePlayer] = 0;

        if (IsPlayerValid(ePlayer))
        {
            //Let's build the competitor list first.

            MajorCivApproachTypes eApproach = GetMajorCivApproach(ePlayer, /*bHideTrueFeelings*/ false);
            MajorCivOpinionTypes eOpinion = GetMajorCivOpinion(ePlayer);

            switch (eApproach)
            {
            case MAJOR_CIV_APPROACH_WAR:
                iEnemyWeight += 10;
                iDPWeight -= 10;
                iDoFWeight -= 10;
                break;
            case MAJOR_CIV_APPROACH_HOSTILE:
                iEnemyWeight += 7;
                iDPWeight -= 7;
                iDoFWeight -= 7;
                break;
            case MAJOR_CIV_APPROACH_GUARDED:
                iEnemyWeight += 5;
                iDPWeight -= 5;
                iDoFWeight -= 5;
                break;
            case MAJOR_CIV_APPROACH_DECEPTIVE:
                iEnemyWeight += 3;
                iDPWeight += 3;
                iDoFWeight += 1;
                break;
            case MAJOR_CIV_APPROACH_NEUTRAL:
                iEnemyWeight += 0;
                iDPWeight += 1;
                iDoFWeight += 1;
                break;
            case MAJOR_CIV_APPROACH_AFRAID:
                iEnemyWeight += 1;
                iDPWeight += 5;
                iDoFWeight += 3;
                break;
            case MAJOR_CIV_APPROACH_FRIENDLY:
                iEnemyWeight += -5;
                iDPWeight += 5;
                iDoFWeight += 5;
                break;
            }

            switch (eOpinion)
            {
            case MAJOR_CIV_OPINION_UNFORGIVABLE:
                iEnemyWeight += 10;
                iDPWeight += -10;
                iDoFWeight += -10;
                break;
            case MAJOR_CIV_OPINION_ENEMY:
                iEnemyWeight += 5;
                iDPWeight += -5;
                iDoFWeight += -5;
                break;
            case MAJOR_CIV_OPINION_COMPETITOR:
                iEnemyWeight += 3;
                iDPWeight += -3;
                iDoFWeight += -3;
                break;
            case MAJOR_CIV_OPINION_NEUTRAL:
                iEnemyWeight += 0;
                iDPWeight += 1;
                iDoFWeight += 1;
                break;
            case MAJOR_CIV_OPINION_FAVORABLE:
                iEnemyWeight += -3;
                iDPWeight += 3;
                iDoFWeight += 3;
                break;
            case MAJOR_CIV_OPINION_FRIEND:
                iEnemyWeight += -5;
                iDPWeight += 5;
                iDoFWeight += 5;
                break;
            case MAJOR_CIV_OPINION_ALLY:
                iEnemyWeight += -10;
                iDPWeight += 10;
                iDoFWeight += 10;
                break;
            }

            // Military Strength compared to us
            switch (GetPlayerMilitaryStrengthComparedToUs(ePlayer))
            {
            case STRENGTH_PATHETIC:
                iEnemyWeight += -5;
                iDPWeight += -5;
                iDoFWeight += -5;
                break;
            case STRENGTH_WEAK:
                iEnemyWeight += -3;
                iDPWeight += -3;
                iDoFWeight += 1;
                break;
            case STRENGTH_POOR:
                iEnemyWeight += -1;
                iDPWeight += -1;
                iDoFWeight += 2;
                break;
            case STRENGTH_AVERAGE:
                iEnemyWeight += 1;
                iDPWeight += 3;
                iDoFWeight += 5;
                break;
            case STRENGTH_STRONG:
                iEnemyWeight += 3;
                iDPWeight += 5;
                iDoFWeight += 3;
                break;
            case STRENGTH_POWERFUL:
                iEnemyWeight += 5;
                iDPWeight += 7;
                iDoFWeight += 1;
                break;
            case STRENGTH_IMMENSE:
                iEnemyWeight += 7;
                iDPWeight += 10;
                iDoFWeight += -3;
                break;
            }
            // Economic Strength compared to us
            switch (GetPlayerEconomicStrengthComparedToUs(ePlayer))
            {
            case STRENGTH_PATHETIC:
                iEnemyWeight += -5;
                iDPWeight += -5;
                iDoFWeight += -5;
                break;
            case STRENGTH_WEAK:
                iEnemyWeight += -3;
                iDPWeight += -3;
                iDoFWeight += 1;
                break;
            case STRENGTH_POOR:
                iEnemyWeight += -1;
                iDPWeight += -1;
                iDoFWeight += 2;
                break;
            case STRENGTH_AVERAGE:
                iEnemyWeight += 1;
                iDPWeight += 3;
                iDoFWeight += 5;
                break;
            case STRENGTH_STRONG:
                iEnemyWeight += 3;
                iDPWeight += 5;
                iDoFWeight += 3;
                break;
            case STRENGTH_POWERFUL:
                iEnemyWeight += 5;
                iDPWeight += 7;
                iDoFWeight += 1;
                break;
            case STRENGTH_IMMENSE:
                iEnemyWeight += 7;
                iDPWeight += 10;
                iDoFWeight += -3;
                break;
            }

            switch (GetPlayer()->GetProximityToPlayer(ePlayer))
            {
            case PLAYER_PROXIMITY_NEIGHBORS:
                iEnemyWeight += 3;
                iDPWeight += 5;
                iDoFWeight += 3;
                break;
            case PLAYER_PROXIMITY_CLOSE:
                iEnemyWeight += 1;
                iDPWeight += 2;
                iDoFWeight += 1;
                break;
            case PLAYER_PROXIMITY_FAR:
                iEnemyWeight += -1;
                iDPWeight += -1;
                iDoFWeight += 1;
                break;
            case PLAYER_PROXIMITY_DISTANT:
                iEnemyWeight += -5;
                iDPWeight += -5;
                iDoFWeight += 2;
                break;
            }

            // We denounced them
            if (IsDenouncedPlayer(ePlayer) || GET_PLAYER(ePlayer).GetDiplomacyAI()->IsDenouncedPlayer(GetPlayer()->GetID()))
            {
                iEnemyWeight += 10;
                iDPWeight += -10;
                iDoFWeight += -10;
            }

            // We were friends and they betrayed us!
            if (IsFriendDenouncedUs(ePlayer))
            {
                iEnemyWeight += 25;
                iDPWeight += -25;
                iDoFWeight += -25;
            }

            ////////////////////////////////////
            // MILITARY THREAT
            ////////////////////////////////////

            switch (GetMilitaryThreat(ePlayer))
            {
            case THREAT_CRITICAL:
                iEnemyWeight += 15;
                iDPWeight += 15;
                iDoFWeight += -15;
                break;
            case THREAT_SEVERE:
                iEnemyWeight += 10;
                iDPWeight += 10;
                iDoFWeight += -10;
                break;
            case THREAT_MAJOR:
                iEnemyWeight += 5;
                iDPWeight += 5;
                iDoFWeight += -5;
                break;
            case THREAT_MINOR:
                iEnemyWeight += 1;
                iDPWeight += -5;
                iDoFWeight += 5;
                break;
            case THREAT_NONE:
                iEnemyWeight += -5;
                iDPWeight += -10;
                iDoFWeight += 10;
                break;
            }

            switch (GetWarmongerThreat(ePlayer))
            {
            case THREAT_CRITICAL:
                iEnemyWeight += 15;
                iDPWeight += 15;
                iDoFWeight += -15;
                break;
            case THREAT_SEVERE:
                iEnemyWeight += 10;
                iDPWeight += 10;
                iDoFWeight += -10;
                break;
            case THREAT_MAJOR:
                iEnemyWeight += 5;
                iDPWeight += 5;
                iDoFWeight += -5;
                break;
            case THREAT_MINOR:
                iEnemyWeight += 1;
                iDPWeight += -5;
                iDoFWeight += 5;
                break;
            case THREAT_NONE:
                iEnemyWeight += -5;
                iDPWeight += -10;
                iDoFWeight += 10;
                break;
            }

            switch (GetVictoryBlockLevel(ePlayer))
            {
            case BLOCK_LEVEL_NONE:
                iEnemyWeight += -5;
                iDPWeight += 1;
                iDoFWeight += 1;
                break;
            case BLOCK_LEVEL_WEAK:
                iEnemyWeight += 5;
                iDPWeight += -5;
                iDoFWeight += -5;
                break;
            case BLOCK_LEVEL_STRONG:
                iEnemyWeight += 10;
                iDPWeight += -10;
                iDoFWeight += -10;
                break;
            case BLOCK_LEVEL_FIERCE:
                iEnemyWeight += 15;
                iDPWeight += -15;
                iDoFWeight += -15;
                break;
            }
            // Weight for victory issues
            switch (GetVictoryDisputeLevel(ePlayer))
            {
            case DISPUTE_LEVEL_NONE:
                iEnemyWeight += -5;
                iDPWeight += 1;
                iDoFWeight += 1;
                break;
            case DISPUTE_LEVEL_WEAK:
                iEnemyWeight += 5;
                iDPWeight += -5;
                iDoFWeight += -5;
                break;
            case DISPUTE_LEVEL_STRONG:
                iEnemyWeight += 10;
                iDPWeight += -10;
                iDoFWeight += -10;
                break;
            case DISPUTE_LEVEL_FIERCE:
                iEnemyWeight += 15;
                iDPWeight += -15;
                iDoFWeight += -15;
                break;
            }

            switch (GetLandDisputeLevel(ePlayer))
            {
            case DISPUTE_LEVEL_NONE:
                iEnemyWeight += -5;
                iDPWeight += 1;
                iDoFWeight += 1;
                break;
            case DISPUTE_LEVEL_WEAK:
                iEnemyWeight += 3;
                iDPWeight += -3;
                iDoFWeight += -3;
                break;
            case DISPUTE_LEVEL_STRONG:
                iEnemyWeight += 5;
                iDPWeight += -5;
                iDoFWeight += -5;
                break;
            case DISPUTE_LEVEL_FIERCE:
                iEnemyWeight += 10;
                iDPWeight += -10;
                iDoFWeight += -10;
                break;
            }

            //Do we already have a DP? Let's keep this alive then.
            if (GET_TEAM(GetTeam()).IsHasDefensivePact(GET_PLAYER(ePlayer).getTeam()))
            {
                iDPWeight += 10;
                iDoFWeight += 15;
                iEnemyWeight += -10;
            }

            if (GET_PLAYER(ePlayer).GetDiplomacyAI()->IsCloseToDominationVictory())
            {
                if (GET_PLAYER(ePlayer).isHuman())
                {
                    int EnemyMod = 15 * GC.getGame().getHandicapInfo().getAIDeclareWarProb();
                    EnemyMod /= 100;
                    iEnemyWeight += EnemyMod;
                    iDPWeight += -EnemyMod;
                    iDoFWeight += -EnemyMod;
                }
                else
                {
                    iEnemyWeight += 20;
                    iDPWeight += -10;
                    iDoFWeight += -10;
                }
            }
            if (GET_PLAYER(ePlayer).GetDiplomacyAI()->IsCloseToSSVictory())
            {
                if (GET_PLAYER(ePlayer).isHuman())
                {
                    int EnemyMod = 15 * GC.getGame().getHandicapInfo().getAIDeclareWarProb();
                    EnemyMod /= 100;
                    iEnemyWeight += EnemyMod;
                    iDPWeight += -EnemyMod;
                    iDoFWeight += -EnemyMod;
                }
                else
                {
                    iEnemyWeight += 20;
                    iDPWeight += -10;
                    iDoFWeight += -10;
                }
            }
            if (GET_PLAYER(ePlayer).GetDiplomacyAI()->IsCloseToDiploVictory())
            {
                if (GET_PLAYER(ePlayer).isHuman())
                {
                    int EnemyMod = 15 * GC.getGame().getHandicapInfo().getAIDeclareWarProb();
                    EnemyMod /= 100;
                    iEnemyWeight += EnemyMod;
                    iDPWeight += -EnemyMod;
                    iDoFWeight += -EnemyMod;
                }
                else
                {
                    iEnemyWeight += 20;
                    iDPWeight += -10;
                    iDoFWeight += -10;
                }
            }
            if (GET_PLAYER(ePlayer).GetDiplomacyAI()->IsCloseToCultureVictory())
            {
                if (GET_PLAYER(ePlayer).isHuman())
                {
                    int EnemyMod = 15 * GC.getGame().getHandicapInfo().getAIDeclareWarProb();
                    EnemyMod /= 100;
                    iEnemyWeight += EnemyMod;
                    iDPWeight += -EnemyMod;
                    iDoFWeight += -EnemyMod;
                }
                else
                {
                    iEnemyWeight += 20;
                    iDPWeight += -10;
                    iDoFWeight += -10;
                }
            }

            if (GET_TEAM(GET_PLAYER(ePlayer).getTeam()).GetMaster() == GetPlayer()->getTeam())
            {
                iEnemyWeight += -25;
                iDPWeight += 25;
                iDoFWeight += 25;
            }
            if (GET_TEAM(GetPlayer()->getTeam()).GetMaster() == GET_PLAYER(ePlayer).getTeam())
            {
                iEnemyWeight += -25;
                iDPWeight += 25;
                iDoFWeight += 25;
            }

            //Let's not have too many defensive pacts.
            iDPWeight -= (GetNumDefensePacts() * 15);

            //Subtract for # of existing DoFs - want only a few close friends.
            iDoFWeight -= (GetNumDoF() * 15);

            //He hates who we hate? We love this guy!
            if (!GET_PLAYER(ePlayer).isHuman())
            {
                if (GET_PLAYER(ePlayer).GetDiplomacyAI()->GetBiggestCompetitor() == GetBiggestCompetitor())
                {
                    iDPWeight += 5;
                    iDoFWeight += 5;
                    iEnemyWeight += -5;
                }
            }

            if (GET_PLAYER(ePlayer).GetCulture()->GetInfluenceLevel(GetPlayer()->GetID()) == INFLUENCE_LEVEL_POPULAR)
            {
                if (GET_PLAYER(ePlayer).GetCulture()->GetInfluenceTrend(GetPlayer()->GetID()) == INFLUENCE_TREND_RISING)
                {
                    iDoFWeight -= 5;
                    iDPWeight += -5;
                    iEnemyWeight += 5;
                }
            }

            // Loop through all (known) Players and see who he likes/hates - if he likes/hates who we like/hate, then add those points in!
            for (int iPlayerLoop2 = 0; iPlayerLoop2 < MAX_MAJOR_CIVS; iPlayerLoop2++)
            {
                PlayerTypes eOtherPlayer = (PlayerTypes)iPlayerLoop2;

                if (eOtherPlayer == ePlayer)
                    continue;

                if (eOtherPlayer == GetPlayer()->GetID())
                    continue;

                if (IsPlayerValid(eOtherPlayer))
                {
                    //Friend or DP?
                    if (IsDoFAccepted(eOtherPlayer) || GET_TEAM(GET_PLAYER(eOtherPlayer).getTeam()).IsHasDefensivePact(GetPlayer()->getTeam()))
                    {
                        //At war?
                        if (GET_PLAYER(eOtherPlayer).GetDiplomacyAI()->IsAtWar(ePlayer))
                        {
                            iEnemyWeight += 5;
                            iDPWeight += -5;
                            iDoFWeight += -5;
                        }
                        if (GET_PLAYER(eOtherPlayer).GetDiplomacyAI()->IsDenouncedPlayer(ePlayer))
                        {
                            iEnemyWeight += 5;
                            iDPWeight += -5;
                            iDoFWeight += -5;
                        }
                        if (GET_PLAYER(ePlayer).GetDiplomacyAI()->IsDenouncedPlayer(eOtherPlayer))
                        {
                            iEnemyWeight += 5;
                            iDPWeight += -5;
                            iDoFWeight += -5;
                        }
                    }

                    //We dislike the same people? Good!
                    if (!GET_PLAYER(ePlayer).isHuman())
                    {
                        if (GET_PLAYER(ePlayer).GetDiplomacyAI()->GetCompetitorValue(eOtherPlayer) > GC.getDOF_THRESHOLD() && GetCompetitorValue(eOtherPlayer) > GC.getDOF_THRESHOLD())
                        {
                            iDPWeight += 5;
                            iDoFWeight += 5;
                            iEnemyWeight += -5;
                        }
                    }

                    //We have defensive pacts with the same people? Good!
                    if (GET_TEAM(GET_PLAYER(ePlayer).getTeam()).IsHasDefensivePact(GET_PLAYER(eOtherPlayer).getTeam()) && GET_TEAM(GetPlayer()->getTeam()).IsHasDefensivePact(GET_PLAYER(eOtherPlayer).getTeam()))
                    {
                        iDPWeight += 5;
                        iDoFWeight += 5;
                        iEnemyWeight += -5;
                    }

                    //We have DoFs with the same people? Good!
                    if (GET_PLAYER(ePlayer).GetDiplomacyAI()->IsDoFAccepted(eOtherPlayer) && IsDoFAccepted(eOtherPlayer))
                    {
                        iDPWeight += 5;
                        iDoFWeight += 5;
                        iEnemyWeight += -5;
                    }

                    //War? Are we threatened?
                    if (GET_PLAYER(ePlayer).IsAtWarWith(eOtherPlayer))
                    {
                        if (GetPlayer()->IsAtWarWith(eOtherPlayer))
                        {
                            iDPWeight += 5;
                            iDoFWeight += 5;
                            iEnemyWeight += -5;
                        }

                        //Close? We might be next!
                        if (GetPlayer()->GetProximityToPlayer(eOtherPlayer) >= PLAYER_PROXIMITY_CLOSE)
                        {
                            iDPWeight += 5;
                            iDoFWeight += 5;
                            iEnemyWeight += -5;
                        }

                        //Warmonger? We might be next!
                        if (GetWarmongerThreat(eOtherPlayer) >= THREAT_MAJOR)
                        {
                            iDPWeight += 5;
                            iDoFWeight += 5;
                            iEnemyWeight += -5;
                        }
                    }
                }
            }

            if (GET_TEAM(GetPlayer()->getTeam()).IsVassalOfSomeone() || GET_TEAM(GET_PLAYER(ePlayer).getTeam()).IsVassalOfSomeone())
            {
                iDPWeight = 0;
                iDoFWeight /= 2;
                iEnemyWeight /= 2;
            }
        }
        //Total it up and add it to the pool of values.
        m_paiCompetitorValue[ePlayer] = iEnemyWeight;
        m_paiDoFValue[ePlayer] = iDoFWeight;
        m_paiDefensivePactValue[ePlayer] = iDPWeight;
    }
   
    //Let's log this data
    if (GC.getLogging() && GC.getAILogging())
    {

        CvString strLogName;

        CvString strOutBuf1;
        CvString strOutBuf2 = "";
        CvString strBaseString;

        CvString playerName;
        CvString otherPlayerName;

        CvString strTemp;

        playerName = GetPlayer()->getCivilizationShortDescription();

        // Open the log file
        if (GC.getPlayerAndCityAILogSplit())
        {
            strLogName = "DiplomacyAI_GlobalRelations_Log_" + playerName + ".csv";
        }
        else
        {
            strLogName = "DiplomacyAI_GlobalRelations_Log.csv";
        }

        FILogFile* pLog;
        pLog = LOGFILEMGR.GetLog(strLogName, FILogFile::kDontTimeStamp);

        // Turn number
        strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns());

        // Our Name
        strBaseString += playerName;

        strOutBuf1 = strBaseString;
        strOutBuf2 = strBaseString;

        // Loop through all (known) Players
        int iNumPlayers = 0;
        for (int iPlayerLoop = 0; iPlayerLoop < MAX_MAJOR_CIVS; iPlayerLoop++)
        {
            PlayerTypes ePlayer = (PlayerTypes)iPlayerLoop;

            if (IsPlayerValid(ePlayer))
            {
                if (iNumPlayers != 0)
                {
                    strTemp.Format("\n     -");
                    strOutBuf1 += strTemp;
                }
                // Strategy Info
                strTemp.Format(" ** %s Valuation: Competitor - %d; DoF - %d, DP - %d **", GET_PLAYER(ePlayer).getCivilizationShortDescription(), GetCompetitorValue(ePlayer), GetDoFValue(ePlayer), GetDefensivePactValue(ePlayer));
                strOutBuf1 += strTemp;
                iNumPlayers++;
            }
        }

        if (GetBiggestCompetitor() != NO_PLAYER)
        {
            strTemp.Format("\n     - ** Our biggest COMPETITOR: %s", GET_PLAYER(GetBiggestCompetitor()).getCivilizationShortDescription());
            strOutBuf2 += strTemp;
        }

        if (GetMostValuableDefensivePact(false) != NO_PLAYER)
        {
            strTemp.Format("\n     - ** Our best DEFENSIVE PACT: %s", GET_PLAYER(GetMostValuableDefensivePact(false)).getCivilizationShortDescription());
            strOutBuf2 += strTemp;
        }

        if (GetMostValuableDoF(false) != NO_PLAYER)
        {
            strTemp.Format("\n     - ** Our best FRIENSHIP: %s", GET_PLAYER(GetMostValuableDoF(false)).getCivilizationShortDescription());
            strOutBuf2 += strTemp;
        }
        pLog->Msg(strOutBuf1);
        if (strOutBuf2 != "")
        {
            pLog->Msg(strOutBuf2);
        }
    }
}
 
OMG... That explains a lot... I'm ranked 1 on both military and economic... Need to check again when i overstep in the "immense", but i think i did in both... Also military threat might have something to do with my situation, not the warmongering one tho'.

Thanks Gazebo, i'm sure this insight will help everyone here to better approach their games!

By the way which files did you take those snippets from? I searched and never found them... Wondering where i missed them!
 
And is it true that the AIs will surely approach you with a DOF proposal once they think it is beneficial for them and refuse your proposal if they would not propose themselves? Which means it is pointless to approach them with DOFs from your end?
 
OMG... That explains a lot... I'm ranked 1 on both military and economic... Need to check again when i overstep in the "immense", but i think i did in both... Also military threat might have something to do with my situation, not the warmongering one tho'.

Thanks Gazebo, i'm sure this insight will help everyone here to better approach their games!

By the way which files did you take those snippets from? I searched and never found them... Wondering where i missed them!

DiplomacyAI... for the future, you can tell what file it came from by the header linker snippet, i.e.
CvDiplomacyAI:: = CvDiplomacyAI.cpp
 
And is it true that the AIs will surely approach you with a DOF proposal once they think it is beneficial for them and refuse your proposal if they would not propose themselves? Which means it is pointless to approach them with DOFs from your end?

They don't ask every single turn, so there's a chance you can ask first.

G
 
Thanks, G. I'm wondering about one thing, though: the decrement of DoFWeight and EnemyWeight seems a bit low for the parts of the function that check if the other guy is near a victory condition, don't you think? It only decrements by 10 for DoFWeight and increments by 20 for EnemyWeight in those cases, which isn't much compared to the other modifications of those weights. I mean betrayal (-25), critical military threat (-15), warmonger threat (-15) and others lower the DoFWeight more than imminent victory on the part of the other player; betrayal even increases EnemyWeight more than imminent victory; shouldn't the AI be more motivated to stop someone who's going to win very soon? I would have thought that this would be more on the order of 50 to make sure that the potential imminent victor gets a good amount of DoWs to foil his plans.
 
Thanks, G. I'm wondering about one thing, though: the decrement of DoFWeight and EnemyWeight seems a bit low for the parts of the function that check if the other guy is near a victory condition, don't you think? It only decrements by 10 for DoFWeight and increments by 20 for EnemyWeight in those cases, which isn't much compared to the other modifications of those weights. I mean betrayal (-25), critical military threat (-15), warmonger threat (-15) and others lower the DoFWeight more than imminent victory on the part of the other player; betrayal even increases EnemyWeight more than imminent victory; shouldn't the AI be more motivated to stop someone who's going to win very soon? I would have thought that this would be more on the order of 50 to make sure that the potential imminent victor gets a good amount of DoWs to foil his plans.

This is just one function - in reality VC condition check has a bigger impact on approach and opinion, which in turn affects DOF viability, etc. etc.

G
 
Top Bottom