Thread Tools
Old January 19, 2003, 16:57   #1
theNiceOne
Warlord
 
theNiceOne's Avatar
 
Local Time: 15:46
Local Date: November 1, 2010
Join Date: Dec 2002
Posts: 121
AI - human trade revisited
Hi. This is a rewritten version of the post in the AI - human trade revealed thread, as it turned out that my first version didn't cover the whole thruth. It wasn't wrong, but I had found only one of the three aspects that affected the AI-human trade bonus. Many thanks to Nor Me for pushing me in the right direction.

(Disclaimer: This is found using the 1.29 patch, but my guess is that nothing is changed for PTW.)

First, the AI-AI trade bonus that can be found in the editor does not affect AI-human trade in any way. The AI will demand, or accept the same price in a trade regardless of whether the AI-AI bonus is 110 or 200.

Second, there is a formerly unknown (at least to me) AI-human difficulty related trade bonus, which AFAIK is not found in the editor, but is hardcoded.

This AI-human trade bonus is dependant on three factors. Those are:
1) Diffiulty setting
2) AI aggression level (as found in the editor). Hereafter called AL.
3) The AI's attitude towards you. Hereafter called AA.

On chieftan, the AI-human trade bonus is 0%. So the AI is willing to pay exactly as much as it would demand for a goods. As an example: If you both ha he same number of cities and no marketplaces, the AI will agree to trade luxury for luxury. On chieftan, 2) and 3) does not matter at all.


On warlord, the same is true, if the AI's aggression level (AL) is 1 or 2. On AL 3, 4 and 5 the AI-human trade bonus is 1%, 2% and 3% respectively.

This means that if an AI with AL3 would demand 100 gold on chieftan, it will demand 101 gold on warlord. An AI with AL4 will demand 102 gold.
Note that at the first AL where the bonus kicks in, it is 1%, and then increases with 1% for each AL (this is the start of a pattern).

On regent, the bonus kicks in earlier, on A=2, and it starts with a bonus not of 1%, but with 2%, and it increases with 2% for each AL. So A=3 means bonus = 4%, AL4 means bonus = 6% and A=5 means bonus=8%.

On monarch, the bonus still kicks in on AL2, but now it starts with (did you guess it?) 3%. And AL3 means bonus=6%, AL4:bonus=9% and AL5:bonus=12%

On emperor, the bonus kicks in already at AL1, and then with 4% and increases with 4% for each AL increase, for a total of 16% on AL4. BUT it does not increase again for AL5 where 20% was expected, but stops on 16%.
So on emperor, for a luxury worth 100 gold the human must pay 112 to an AI with AL3 and 116 to an AI with AL4 or 5.

On deity, the story is exactly the same as on emperor, except that the bonus starts on 5% and increases with 5% for each AL (but alse here with no increase from AL4 to AL5).
So the most you have to pay for the value 100 luxury is 120 gold on deity if the AI has AL4 or AL5.


Then there is the third factor, the AI's attitude towards you. All I've written above is correct if the AI's attitude is below polite, but if it is polite or gracious, the AI-human trade bonus may be reduced by 1 or 2 %.

The rule is this: If the AI-human trade bonus is 8% or higher, it may be reduced once, by 1%. If the bonus is 15% or higher, it may be reduced twice, each time by 1%.

So on deity, if the AI is very gracious, the following will happen, dependant on AL:
AL1: 5% - no change.
AL2: reduced from 10% to 9%
AL3: reduced from 15% to 13%
AL4/AL5: reduced from 20% to 18%

Unfortunately, the two attitude thresholds where the bonus is reduced by 1% is not the same as when the AI goes from cautious to polite and polite to gracious, but a bit higher. I.e., an AL5 AI that is just polite (but close to cautious) will not give you a better deal, but if polite and almost gracious it will reduce the bonus by 1%. It will still only reduce it by 1% after just having passed into gracious, but if it gets pleased just a bit more to get even more gracious, it will reduce the bonus by another 1%.
The two attitude threshold isn't necessary the same for different AL/difficulty settings: If two civs are equally polite, but with different AL, the one with highest AL (and thus highest bonus) may reduce the bonus with 1% while the other need to be gracious to reduce it at all.

To sum this up, I'll make a table showing the possible AI-human trade bonuses:


-----AL1-----AL2-------AL3--------AL4--------AL5

Ch. 0-0-0---0-0-0----0--0--0----0--0--0----0--0--0

Wl. 0-0-0---0-0-0----1--1--1----2--2--2----3--3--3

Rg. 0-0-0---2-2-2----4--4--4----6--6--6----8--7--7

Mn. 0-0-0---3-3-3----6--6--6----9--8--8---12-11-11

Em. 4-4-4---8-8-8---12-11-11---16-15-14---16-15-14

Dt. 5-5-5--10-9-9---15-14-13---20-19-18---20-19-18

The three columns for each AL is for the three attitude levels.

Note that the biggest gap by far is between monarch and emperor.

Two examples: You want to buy a resource that is worth 100 gold on chieftan. If you play on Monarch vs a civ with AL4 that is cautious, you must pay 109 gold. If the civs becomes gracious, it will reduce its demand to 108 gold.
If playing on deity vs a civ with AL3, you must pay 115 gold, but by getting it gracious enough, you get the cost down to 113.

Note that no AI will demand more if falling below catious. An annoyed AI will still not demand more.


If you are selling the goods, then you can divide by 1+the bonus.
Ex: You're selling a luxury worth 100 gold to a catious civ, AL4 on monarch. It will pay 100/1.09 = 92 gold.



With techs, things gets a bit more convoluted. First, take a simple tech like currency. The base trade price is dependant on the human player's research cost, and then modified by the above-mentioned AI-human trade bonus.

(The base trade price is also dependant on number of known civs and number of civs that already has the tech, but this isn't affected by difficulty settings and can therefore be ignored in this article).

I.e. if the human player's research cost (modified by civs having the tech) is 1000 on chieftan, then an AI with AL3 will demand 1040 for the tech on regent, but it will demand more than 1060 on monarch - it will actually demand 1177 for the tech. The reason for this is that on monarch and higher, the human player's research cost is divided by the AI's cost factor (as found in the editor) which is: Monarch 0.9, emperor 0.8, deity 0.6.

So, to find the price the AI will demand, take the base (1000), divide by the cost factor (if this is below 1) and add the AI-human trade bonus. So on deity (AL3), the AI will demand 1000 / 0.6 * 1.15 = 1917 gold. Quite a sum and quite a handicap for the human.

But the table turns a bit if you're doing the selling. The AI will still pay 1000 on chieftan, 992 on warlord and 962 on regent, but on monarch it will actually begin to pay you higher prices again. The formula is: base / cost factor (if below 1) / AI-human trade bonus. On the three higher difficulties (still AL3), this becomes:
Monarch: 1000 / 0.9 / 1.06 = 1049
Emperor: 1000/ 0.8 / 1.12 = 1116
Deity: 1000/ 0.6 / 1.15 = 1450

What this effectively means is that if you manage to get a tech lead on the higher settings, then you actually get an additional bonus. Now the AI will pay more for the tech than it will cost it to reserach it by itself. This really gives a merit to the tactic of selling a tech for gross amounts of gpt so that the AI cannot keep up the research rate. Not only do you get the money instead of the bank, but the AI pays you more. :goodjob:


The above formulas are mostly correct, but when a tech gives access to some other benefits, like a wonder, the formula must be slightly modified. The trade price for tech Monarchy consists of three parts: The reseach cost, the government bonus and the wonder bonus. It turns out that the government bonus is handled as described above, but the wonder bonus is not. When calculating the cost, the wonder bonus is added after having divided by the cost factor. So the formula for buying from the AI on deity (AL3) becomes:
[(value for research and government) / 0.6 + (wonder value)] / 1.15

This doesn't affect the formula much, as the wonder value is very low compared to the other values. As a real world example, a game with only one AI at AL3, the AI will demand the following for monarchy:
Chieftan: 694 (if wonder can be built)/684 (if wonder is already built)
Warlord: 700/690
Regent: 721/711
Monarch: 815/803
Emperor: 968/956
Deity: 1321/1308

After having found out all this I was satisfied, so I didn't bother to check whether the added cost for new resources and new units is divided by the cost factor (like government cost) or not (like wonder cost). It doesn't make much difference though.

Note that in the actual game there is no floating point math, but all numbers are truncated after each math operation, so the actual number may vary from the calculated with a gold or three. Nothing sigificant though.

Final remarks: I've done at least hundred loads of a (each time) slighly modified scenario to find this out. What I also concluded was that the following factors does not affect the trade cost at all:
*Relative culture
*Relative military strength
*Culture group
*Favourite/shunned government
So an AI with much higher culture, much higher military strength that belongs to a differet culture group and shuns your government will not demand more gold than a the total opposite.
__________________
If you cut off my head, what do I say?
Me and my body, or me and my head?
theNiceOne is offline  
Old January 19, 2003, 17:57   #2
Nor Me
Apolyton University
Prince
 
Local Time: 14:46
Local Date: November 1, 2010
Join Date: Oct 2002
Posts: 689
Impressive. Now, that's more interesting.
It's good to know I was right in thinking that the aggression level was much more important than attitude. The unimportance of attitude was the thing that everyone seemed to argue with me about. Now I can quote 2%.

On a side note, I cannot get reasonable results out of an AI-AI trade test. The Iroquois appeared to keep on selling the French aluminium for 1 gold. I don't think the AI is supposed to have an over 8000 times advantage on regent. A different formula may be used. (Yes, I tried giving the Iroquois a stack of MAs.)

EDIT: removed edit

Last edited by Nor Me; January 28, 2003 at 11:08.
Nor Me is offline  
Old January 19, 2003, 19:21   #3
vmxa1
PtWDG Gathering StormC4DG Gathering Storm
Deity
 
vmxa1's Avatar
 
Local Time: 10:46
Local Date: November 1, 2010
Join Date: Nov 2001
Location: Oviedo, Fl
Posts: 14,103
First congrats on the hard work. Second it is purely academic to me as two of the three factors are not changable after the game starts, so there is nothing I can do with that info.
The thrid is sort of out of my control at the point of the trade talks. I mean I have either tried to keep a good relations or not and I either succeeded or not. I am not going to be able to do much differently, with out a complete style change.
So I do not really care about the why and where fores of the trade, only what is on the table.
vmxa1 is offline  
Old January 20, 2003, 02:50   #4
Hurricane
Warlord
 
Hurricane's Avatar
 
Local Time: 16:46
Local Date: November 1, 2010
Join Date: May 2001
Location: Arctic Hill
Posts: 266
Good info about the attitude. I have also for a long time suspected that it has almost no effect on trade, since even civs that are furious at you happily will trade everything. I also suspected that AL might have something to do with it, since India and other peaceful civs always seem to offer the best deals.
Hurricane is offline  
Old January 20, 2003, 04:12   #5
theNiceOne
Warlord
 
theNiceOne's Avatar
 
Local Time: 15:46
Local Date: November 1, 2010
Join Date: Dec 2002
Posts: 121
vmxa1: I agree that this information is mostly academic, as it's not much to do about it in-game. It may make a difference to know that when you're going to sell a tech, you should start selling it to the most peaceful civs first, when the base value is highest. Similarily, buy things from the most peaceful civs if you have a choise. You don't have the choise too often though.
__________________
If you cut off my head, what do I say?
Me and my body, or me and my head?
theNiceOne is offline  
Old January 20, 2003, 06:08   #6
Hurricane
Warlord
 
Hurricane's Avatar
 
Local Time: 16:46
Local Date: November 1, 2010
Join Date: May 2001
Location: Arctic Hill
Posts: 266
Also good to note is that there is nothing random about trade costs. Thus, a deal won't get better (or worse) just because you battle a little and change the PRNG.
Hurricane is offline  
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 10:46.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Apolyton Civilization Site | Copyright © The Apolyton Team