1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

AI Leaders Personality Matrix

Discussion in 'Civ4 - Modding Tutorials & Reference' started by ori, Nov 2, 2006.

  1. ori

    ori Repair Guy Super Moderator

    Joined:
    Dec 17, 2005
    Messages:
    16,561
    Location:
    Baden-Württemberg, Germany
    These are three Excel spreadsheets of the BtS 3.13, Warlords V2.08 and Vanilla V1.61 CIV4LeaderheadInfos.xml files. In these versions all tags are annotated

    The BtS version was compiled by karlkrlarsson
    The Warlords version was compiled and annotated by ori
    The Vanilla version was compiled by NeverMind and annotated by PeteT

    The File can be found in the DownloadDataBase.

    Please also note fengertao's Vanilla version of this spreadsheet.
     
  2. NeverMind

    NeverMind Proud to be Russian

    Joined:
    Apr 29, 2005
    Messages:
    618
    Gender:
    Male
    Location:
    Moscow, Russia
    Good work, ori! I would like you to add my vanilla spreadsheet in your file, in order to keep this info in one place. ;)
     
  3. ori

    ori Repair Guy Super Moderator

    Joined:
    Dec 17, 2005
    Messages:
    16,561
    Location:
    Baden-Württemberg, Germany
    Thanks, I'll upload a combined version once I return home after Thanksgiving...
     
  4. PeteT

    PeteT Warlord

    Joined:
    Jan 2, 2002
    Messages:
    273
    Location:
    Winterpeg
  5. ori

    ori Repair Guy Super Moderator

    Joined:
    Dec 17, 2005
    Messages:
    16,561
    Location:
    Baden-Württemberg, Germany
    I just uploaded the combined file using PeteT's annotated version of NeverMind's spreadsheet
     
  6. ori

    ori Repair Guy Super Moderator

    Joined:
    Dec 17, 2005
    Messages:
    16,561
    Location:
    Baden-Württemberg, Germany
    Answered in next post...
     
  7. ori

    ori Repair Guy Super Moderator

    Joined:
    Dec 17, 2005
    Messages:
    16,561
    Location:
    Baden-Württemberg, Germany
    AI Attitude explained:

    The AI attitude towards another player (be it human or AI) is defined as follows:
    if no other sources are quoted then the calculations are from CvPlayerAI.cpp and the Leader specific values are from CIV4LeaderHeadInfos.xml

    Friendly:
    iAttitudeVal >= +10

    Pleased:
    iAttitudeVal >= +3

    Cautious:
    if no other Attitude rule is fulfilled

    Annoyed:
    iAttitudeVal <= -3

    Furious:
    iAttitudeVal <= -10


    The following terms are used:

    US (the active AI)
    THEM (the opponent towards whom the attitude is calculated)

    iAttitudeVal = +100 if US and THEM are on the same team (i.e. Team play or Permanent Alliance)
    iAttitudeVal = -100 if THEM is Barbarian

    In all other cases iAttitudeVal is calculated using the following items:

    &#8222;not visible&#8220; denotes Items not displayed ingame

    Item 1 (not visible):
    US iBaseAttitude

    Item 2 (not visible):
    THEM iAttitudeChange (source: CIV4HandicapInfo.xml - = +2 on Settler, +1 on Warlord, 0 on Chieftain, -1 on Noble and above)

    Item 3 (not visible):
    If AggressiveAI option is ON and THEM is Human:
    -2

    Item 4 (not visible):
    If THEM is NOT Human:
    +(4 &#8211; abs(US Peace Weight &#8211; THEM PeaceWeight))
    abs means that the result of (US Peace Weight &#8211; THEM PeaceWeight) is always a positive value
    PeaceWeight = iBasePeaceWeight + (0 to iPeaceWeightRand) as shown by Seven05

    Item 5 (not visible):
    If THEM is NOT Human:
    + the lower of US iWarmongerRespect or THEM iWarmongerRespect

    Item 6 (not visible):
    - the higher of 0 or (THEM number of Team members &#8211; US number of Team members)

    Item 7 (not visible):
    if THEM is higher ranking:
    +(RankDifference*iWorseRankDifferenceAttitudeChange/(NumberOfPlayersEverAlive+1)) Note: these modifiers are negative in the .xml - so this produces a negative modifier...

    Item 8 (not visible):
    if THEM is lower ranking:
    +(RankDifference*iBetterRankDifferenceAttitudeChange/(NumberOfPlayersEverAlive+1))

    Item 9 (not visible):
    if US rank >= NumberOfPlayersEverAlive/2 AND THEM rank >= NumberOfPlayersEverAlive/2
    +1

    Item 10 (not visible):
    if THEM WarSuccess > US WarSuccess:
    +iLostWarAttitudeChange
    WarSuccess seems to be the number of Units killed (according to CvUnit.cpp)

    Item 11 (visible):
    CloseBordersAttitude

    Item 12 (visible):
    WarAttitude

    Item 13 (visible):
    PeaceAttitude

    Item 14 (visible):
    SameReligionAttitude

    Item 15 (visible):
    DifferentReligionAttitude

    Item 16 (visible):
    BonusTradeAttitude

    Item 17 (visible):
    OpenBordersAttitude

    Item 18 (visible):
    DefensivePactAttitude

    Item 19 (visible):
    RivalDefensivePactAttitude

    Item 20 (visible):
    ShareWarAttitude

    Item 21 (visible):
    FavoriteCivicAttitude

    Item 22 (visible):
    TradeAttitude

    Item 23 (visible):
    RivalTradeAttitude

    Item 24 (visible):
    MemoryAttitude (i.e. Accepted or Rejected Demand)

    Item 25 (visible):
    AttitudeExtra (only if specified for a Scenario &#8211; not in Core Game)

    All Items are added and the total Attitude is returned.
     
  8. ori

    ori Repair Guy Super Moderator

    Joined:
    Dec 17, 2005
    Messages:
    16,561
    Location:
    Baden-Württemberg, Germany
    Note that:

    Item 4 means that Leaders with a similiar Peace Weight have a positive modifier of up to +4 and Leaders with very different Peace Weights have a very high negative modifier (up to -9)

    Item 5 means that Warmongers have a positive modifier with each other...

    Edit: for Diplomacy Victory any AI will vote for the Player on whose team it is, if there is none it will vote for the Player towards whom it has the higher attitude if this attitude is higher than +7. If both Players are tied it will abstain, if the attitude towards both is +7 or below it will abstain.
     
  9. Ralph_Jackson

    Ralph_Jackson Emperor

    Joined:
    Mar 7, 2006
    Messages:
    1,631
    Location:
    Edinburgh Scotland
    Ori, Thanks for the explanation re attitudes, I had tried and struggled to understand what was going on then found thid thread and it became clear

    :goodjob:

    Thanks

    Ralph
     
  10. ori

    ori Repair Guy Super Moderator

    Joined:
    Dec 17, 2005
    Messages:
    16,561
    Location:
    Baden-Württemberg, Germany
    :blush: actually I found one thing that is not quite right here (I corrected it in the Attitude thread but not here):

    rank: is 0 for the HIGHEST scoring civ, i.e. the player with the highest rank number is the one with the lowest score. This means that iWorseRankAttitude applies when the AI has a lower score and iBetterRankAttitude applies when the AI has a higher score. Also item 9 thus applies if both players are in the lower half of the score table...
     
  11. Ralph_Jackson

    Ralph_Jackson Emperor

    Joined:
    Mar 7, 2006
    Messages:
    1,631
    Location:
    Edinburgh Scotland
    Don't worry with the signposting in this thread I had puzzled that bit out myself!!

    Ralph
     
  12. r_rolo1

    r_rolo1 King of myself

    Joined:
    May 19, 2006
    Messages:
    13,818
    Location:
    Lisbon, Portugal
    :bump:

    For when a BtS update ,ori ? ;)
     
  13. ori

    ori Repair Guy Super Moderator

    Joined:
    Dec 17, 2005
    Messages:
    16,561
    Location:
    Baden-Württemberg, Germany
    :salute:
    Done :scan:






    Actually karlkrlarsson did it 5 months ago but I promised to add it to this file by the weekend - never specified which one though :evil:
     
  14. r_rolo1

    r_rolo1 King of myself

    Joined:
    May 19, 2006
    Messages:
    13,818
    Location:
    Lisbon, Portugal
    I already noticed that ( a small delay :lol: ) .... Thanks ;)
     
  15. TDK

    TDK Emperor

    Joined:
    Feb 22, 2006
    Messages:
    1,229
    Location:
    Denmark
    Ori, do you know if they changed anything for 1.74 Vanilla? Like the rounding bug in iBetterRankAttitudeChange that causes a value of 1 to be useless? Or is it the same as 1.61?

    Also, I can't find where it says how long a leader "Refuse to talk" to you after you agree to stop trading with him?

    Thanks,
    TDK
     
  16. ori

    ori Repair Guy Super Moderator

    Joined:
    Dec 17, 2005
    Messages:
    16,561
    Location:
    Baden-Württemberg, Germany
    I don't know by heart but will check - tough I am away from my civ computer for the next two weeks :eek: (hope I don't go cold turkey ;)) so it will be a while before I reply to this - If I don't prod me :)
    I think there where no or no remarkable changes in 1.74/2.13 though I will recheck this as well :)
     
  17. ori

    ori Repair Guy Super Moderator

    Joined:
    Dec 17, 2005
    Messages:
    16,561
    Location:
    Baden-Württemberg, Germany
    I forgot about this - sorry:
    there are no xml changes between 1.61 and 1.74 and none between 2.08 and 2.13.
    I cannot find any changes for the BetterRank thing and for the time it takes for the AI to respond again I am unsure - I don't really follow that code too well, it confuses me :crazyeye: I'll try to understand it better and report again.

    There are no changes for this file for the BtS 3.17 patch.
     
  18. DrakenKin

    DrakenKin Prince

    Joined:
    Jan 8, 2010
    Messages:
    461
    Location:
    Montreal
    Could we have some explanation on how to interpret the numbers?

    Say right now I want to make Alexander go to war with another AI. I go to your spreadsheet for BtS and see that for Alexander, CONTACT_JOIN_WAR as a value of 20. How do I use this number to know how many diplomatic points I need in my current game to open this possibility to me?

    It would be great if someone had the time to post how this spreadsheet can be used in a few different cases (a kind of tutorial or article with examples).
     
  19. ori

    ori Repair Guy Super Moderator

    Joined:
    Dec 17, 2005
    Messages:
    16,561
    Location:
    Baden-Württemberg, Germany
  20. DrakenKin

    DrakenKin Prince

    Joined:
    Jan 8, 2010
    Messages:
    461
    Location:
    Montreal
    Thanks, it cleared that specific problem up.

    The numbers in the matrix are affected by the difficulty level, right? Is this documented somewhere?
     

Share This Page