| General | Hosted Sites | Civ5 | CivRev | Civ4Col | Civ4 | Civ3 | Civ2 | Civ1 | Misc | Marketplace |
![]() |
|
|
Welcome to Civilization Fanatics' Center. You are currently viewing our site as a guest which gives you limited access to our site features. By joining our free community, you will be able to participate in the discussions, search the forum, send private messages, vote in polls, upload your own screenshots to the gallery, and access many other special features. Registration is fast, simple and absolutely free, so sign up today! If you have any problems with the registration process or your account login, please contact support. |
|
|||||||
![]() |
|
|
Thread Tools |
|
|
#1 |
|
Repair Guy
![]() ![]() Join Date: Dec 2005
Location: Baden-Württemberg, Germany
Posts: 13,176
|
AI Attitude Explained
This is a parse of the way the Game determines an AIs attitude towards other players. The attitude is calculated as iAttitudeVal and is set to +100 for team members and -100 for Barbarians.
For all other cases the following 25 items are calculated and added to determine iAttitudeVal (see next post). For this guide the following sources are used if no other source is given: CvPlayerAI.cpp from the SDK (note: this is the Vanilla version - there is a 26th item for having a Vassal in Warlords which is visible). CivIVLeaderHeadInfos.xml (a spreadsheet of this is available here. In the posts below the following terms are used: US for the current AI THEM for the Player towards whom the iAttitudeVal is calculated Rank as defined in CvGame.cpp is 0 for the highest scoring Civilization and (TotalNumberOfPlayers - 1) for the lowest scoring Civilization. RankDifference = US Rank - THEM Rank Last edited by ori; Jan 27, 2007 at 11:30 AM. Reason: Corrected Rank definition |
|
|
|
|
|
#2 |
|
Repair Guy
![]() ![]() Join Date: Dec 2005
Location: Baden-Württemberg, Germany
Posts: 13,176
|
Code:
Item 1 (not visible) US iBaseAttitude Code:
Item 2 (not visible) THEM iAttitudeChange Code:
Item 3 (not visible) If AggressiveAI option is ON AND THEM is Human: -2 Code:
Item 4 (not visible) If THEM is NOT Human: +(4 – abs(US Peace Weight – THEM PeaceWeight)) Code:
Item 5 (not visible) If THEM is NOT Human: + the lower of US iWarmongerRespect or THEM iWarmongerRespect Code:
Item 6 (not visible) - the higher of 0 or (THEM number of Team members – US number of Team members) Code:
Item 7 (not visible) if THEM is higher ranking: +(RankDifference*iWorseRankDifferenceAttitudeChange/(NumberOfPlayersEverAlive+1)) Code:
Item 8 (not visible) if THEM is lower ranking: +((-RankDifference)*iBetterRankDifferenceAttitudeChange/(NumberOfPlayersEverAlive+1)) Code:
Item 9 (not visible) if US rank >= NumberOfPlayersEverAlive/2 AND THEM rank >= NumberOfPlayersEverAlive/2 +1 Code:
Item 10 (not visible) if THEM WarSuccess > US WarSuccess: +iLostWarAttitudeChange Code:
Item 11 (visible) CloseBordersAttitude Code:
Item 12 (visible) WarAttitude Code:
Item 13 (visible) PeaceAttitude Code:
Item 14 (visible) SameReligionAttitude Code:
Item 15 (visible) DifferentReligionAttitude Code:
Item 16 (visible) BonusTradeAttitude Code:
Item 17 (visible) OpenBordersAttitude Code:
Item 18 (visible) DefensivePactAttitude Code:
Item 19 (visible) RivalDefensivePactAttitude Code:
Item 20 (visible) ShareWarAttitude Code:
Item 21 (visible) FavoriteCivicAttitude Code:
Item 22 (visible) TradeAttitude Code:
Item 23 (visible) RivalTradeAttitude Code:
Item 24 (visible) MemoryAttitude Code:
Item 25 (visible) AttitudeExtra Last edited by ori; Jan 27, 2007 at 11:32 AM. Reason: Corrected Items 7 and 8 |
|
|
|
|
|
#3 |
|
Repair Guy
![]() ![]() Join Date: Dec 2005
Location: Baden-Württemberg, Germany
Posts: 13,176
|
The following attitudes are set for the calculated Attitude Values from above:
Code:
Friendly: iAttitudeVal >= +10 Pleased: iAttitudeVal >= +3 Cautious: if no other Attitude rule is fulfilled Annoyed: iAttitudeVal <= -3 Furious: iAttitudeVal <= -10 Last edited by ori; Jan 27, 2007 at 02:01 AM. |
|
|
|
|
|
#4 |
|
Repair Guy
![]() ![]() Join Date: Dec 2005
Location: Baden-Württemberg, Germany
Posts: 13,176
|
Notes:
Item 2: source: CIV4HandicapInfo.xml = +2 on Settler, +1 on Warlord, 0 on Chieftain, -1 on Noble and aboveItem 4: abs means that the result of (US Peace Weight – THEM PeaceWeight) is always a positive valueItem 10: WarSuccess seems to be the number of Units killed (source: CvUnit.cpp)Item 25: This is reserved for scenarios or mods which want to control relations between certain civilizationsDiplomacy vote (Diplomatic Victory): An AI will always vote itself. If this is not a choice it will vote for a team member. If this is not a choice it will vote for the Player towards whom the iAttitudeVal is highest if iAttitudeVal is greater than +7. If both players are tied it will abstain. If both players are at or below iAttitudeVal of +7 it will abstain.Worst Enemy: An AIs has a worst enemy if there is atleast one other Player towards whom its attitude is worse than Cautious. The worst enemy is defined as the one with the lowest iAttitudeVal (source: CvTeamAI.cpp). Last edited by ori; Mar 19, 2007 at 10:05 AM. Reason: typo |
|
|
|
|
|
#5 |
|
... !
Join Date: May 2004
Location: Germany
Posts: 4,200
|
A note on rank (items 7-9):
Lower rank means higher score. The best in score is rank 0. So item 7 means (IWorseRankDifference is <=0 in the xml): not liking people scoring higher. Item 8 (iRankDifference is<0): liking people scoring lower. Item 9: the underdogs give each other a +1. |
|
|
|
|
|
#6 | |
|
Repair Guy
![]() ![]() Join Date: Dec 2005
Location: Baden-Württemberg, Germany
Posts: 13,176
|
Quote:
The CvGame.cpp defines rank like this: Code:
for (iI = 0; iI < MAX_CIV_PLAYERS; iI++)
{
iBestScore = MIN_INT;
eBestPlayer = NO_PLAYER;
for (iJ = 0; iJ < MAX_CIV_PLAYERS; iJ++)
{
if (!abPlayerScored[iJ])
{
iScore = GET_PLAYER((PlayerTypes)iJ).calculateScore(false);
if (iScore >= iBestScore)
{
iBestScore = iScore;
eBestPlayer = (PlayerTypes)iJ;
}
}
}
abPlayerScored[eBestPlayer] = true;
setRankPlayer(iI, eBestPlayer);
setPlayerRank(eBestPlayer, iI);
They definitely like a high scoring Player better than a low scoring one (which encourages them to bully the weaker players). |
|
|
|
|
|
|
#7 |
|
... !
Join Date: May 2004
Location: Germany
Posts: 4,200
|
Well, I looked up the rank calculation you quoted before I posted
.The inner loop gets the highest score not already scored. So for the outer loop (ii) 0, it's the highest score overall. Edit: I looked up the Iustus post. It's unlikely that this could come from better-worse rank, as the ranks are pretty similar (and it needs a lot difference for Saladin to even give a 1 change). But what could have happened is that Saladin fell out of the group of underdogs by passing somebody not even known to any of the two. Last edited by klarius; Jan 27, 2007 at 11:06 AM. |
|
|
|
|
|
#8 | |
|
Repair Guy
![]() ![]() Join Date: Dec 2005
Location: Baden-Württemberg, Germany
Posts: 13,176
|
Quote:
I am still confused - but you sure seem to be right, I just did a quick test on an old save and gave the underdog a couple hundred more population points in Worldbuilder so that he went to No.1 and sure enough he went from pleased to friendly... So it basically means that:iBetterRankDifference is applied when the AI scores better than the other player. iWorseRankDifference is applied when the AI scores worse than the other player. |
|
|
|
|
|
|
#9 |
|
Emperor
Join Date: Feb 2006
Location: Denmark
Posts: 1,224
|
Ori, do you know how rounding of numbers work?
Thanks, TDK |
|
|
|
|
|
#10 |
|
King
Join Date: Feb 2006
Posts: 755
|
Now all we need is someone to put together a UI mod that performs all these calculations for you and displays the results in the foreign advisor screen.
1....2....3.....Not It! |
|
|
|
|
|
#11 |
|
Repair Guy
![]() ![]() Join Date: Dec 2005
Location: Baden-Württemberg, Germany
Posts: 13,176
|
Referring to items 7 and 8 (worse or betterrank calculations):
I am not even sure if the game rounds those values at this point. But if it uses integers I would expect it to do the mathematically correct thing and round up at .5 and down below this. |
|
|
|
|
|
#12 |
|
Emperor
Join Date: Feb 2006
Location: Denmark
Posts: 1,224
|
Ori, it seems your assumption was correct.
TDK |
|
|
|
|
|
#13 | |
|
Deity
Join Date: May 2005
Posts: 11,731
|
Quote:
And what sort of text do we see when there's a RivalTradeAttitude value on the screen? Last edited by LowtherCastle; Feb 03, 2007 at 07:54 AM. |
|
|
|
|
|
|
#14 |
|
Repair Guy
![]() ![]() Join Date: Dec 2005
Location: Baden-Württemberg, Germany
Posts: 13,176
|
In single player games: either team members you have specified in custom game (by choosing the same team number) or Permanent Alliance partners. In Multiplayer Games usually team members assigned at the start...
"You have traded with our worst enemy" |
|
|
|
|
|
#15 |
|
Big mouth
Join Date: Dec 2005
Location: France
Posts: 7,710
|
great thread, as usual Ori
it's 10, not 11 |
|
|
|
|
|
#16 |
|
Repair Guy
![]() ![]() Join Date: Dec 2005
Location: Baden-Württemberg, Germany
Posts: 13,176
|
![]() typos? me? Spoiler:
|
|
|
|
|
|
#17 |
|
Deity
Join Date: Dec 2005
Posts: 3,602
|
You may, or may not, want to note that the attitude value used in trading is Team to Team attitude, not player to player attitude. (This may be true in other circumstances as well - I've not investigated thoroughly).
This got touched on a bit in another thread |
|
|
|
|
|
#18 | ||
|
Chieftain
Join Date: Aug 2006
Location: Amsterdam
Posts: 29
|
Quote:
Quote:
Consider iBetterRankDifferenceAttitudeChange in a game with 10 civs. The biggest rank difference is 9. iBetterRankDifferenceAttitudeChange then gets multiplied by 9 divided by 11, 11 being the civs ever alive plus 1. Obviously resulting in a number between 0 and 1 and thus 0. The same goes for iWorseRankDifferenceAttitudeChange since negative numbers get rounded up. Or better: the remainder is discarded. I'm sure this is unintended and as such a bug. Hardly a gamebreaking one though. In this game I'm the number one and Alex is 7. A rankdifference of 6 which is the threshold for an iWorseRankDifferenceAttitudeChange guy of -2 like Alex and indeed he shows a "We think you are getting too big for your own good.", which is the translation I made for Item 7. ![]() Wang Kon however who has an iWorseRankDifferenceAttitudeChange of -1 apparently doesn't mind my rank while being the lowest in score with the exception of dead Ramesses.
|
||
|
|
|
|
|
#19 | ||
|
Repair Guy
![]() ![]() Join Date: Dec 2005
Location: Baden-Württemberg, Germany
Posts: 13,176
|
Quote:
Thanks, good to know that a lot of these values are essentially meaningless - but then one could mod this by simply increasing all those values by 1...Quote:
I didn't bother to include it here. But now that I am at it I can as well start (this is from a quick search through the SDK - so there might and probably will be mistakes and things overlooked)There are only four instances were the AI uses the Attitude Value (i.e. the integer value): Diplomacy Vote Determine Worst Enemy Determine which city to nuke Become Vassal while at Peace For all other instances either PlayerAttitude or TeamAttitude (i.e. Friendly, Pleased etc.) are used. PlayerAttitude is the attitude of on AI player towards another player, TeamAttitude is the attitude of one AITeam towards another Team. Spoiler for TeamAttitude explained by VoiceOfUnreason:
The instances in which PlayerAttitude are used are: Civic Trade - ask an AI to change Civic(s) Religion Trade - ask an AI to convert Religion Trade City - ask an AI to trade a city (Note: that does not mean it will trade it, it just is not readened out )Give Help - ask an AI to give help Demand Tribute - AI demands tribute UseSpy - all Spy actions against a player UseNuke - the AI decides which city to Nuke depending on attitude ![]() The Instances in which TeamAttitude are used are: Stop Trading - trade stop trading IsFriend - for you Declared War on a friend memory and for you nuked a friend memory StartWar - for decision to start a war Tech Trade - for tech trading decisions Map Trade - for map trading Trade Peace - (broker Peace between 2 AIs) Trade War - (broker War between 2 AIs) Open Borders - explains itself ![]() Defensive Pact - dito Permanent Alliance - dito Worst Enemy - who is my worst enemy? NoWarAtttude - (NoWar threshold) DiploVote - which team to vote for? Vassal - (Peace) |
||
|
|
|
|
|
#20 |
|
Perma-newb
Join Date: Oct 2006
Posts: 1,192
|
Some of these reasons I've never even seen before in my games. How big do you have to be before you get "we are worried that you are becoming too big"? I tried continuing the game after domination victory, and I still don't get that modifier.
|
|
|
|
![]() |
| Bookmarks |
|
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| AI attitude | Bamspeedy | Civ3 Strategy Articles | 154 | Sep 17, 2010 12:49 PM |
| AI attitude at aggressive AI setting | oedali | Civ4 - Better AI | 0 | May 10, 2007 08:13 AM |
| AI Personalites Explained | Tekee | Civ4 - Strategy & Tips | 28 | Oct 06, 2006 08:48 AM |
| AI attitude | popewiz | Civ4 - General Discussions | 8 | Aug 09, 2005 08:27 PM |
| Why is the AI so Irrational? Scenario Explained | Cleosith | Civ3 - General Discussions | 3 | Feb 27, 2004 03:35 PM |