AI trading valuation

Shabbaman

rebuffing the rebels
Joined
Feb 18, 2002
Messages
3,585
Location
the new civduelzone.com!
I was wondering: when trading with the AI, sometimes they offer a lot of gold for a 'worthless' resource or technology, and sometimes they don't want to give you a thing (like, 1 gold). Does this make any sense? I figure that there is some connection between how much luxury resources a civ has (means more happy faces) and how scarce an item is (i.e. strategic)

I doubt that the AI trading is based on a random strategy. I've noticed that, when requesting gold, there is not very much difference in total value in gold between a lump sum or a per turn agreement (that is, if they can afford the lump sum)

Has anyone done further research on this? Or is there another thread dedicated to this subject?
 
Certainly sounds like a topic worth someone (else)'s time. :) After all, enterprising individuals have cracked corruption formulas already...

From what I've gathered, the trade offering is based on:
- your relationship with them (Polite, Cautious, Annoyed...)
- your cultural imbalance (in awe, unimpressed...)
- the cost it would take the civ to research that tech themselves. (If they're currently researching it, they're not willing to pay full value.)

The "would never accept this deal" hint from your advisor can mean one of several things. If you're requesting gold per turn, and you request more than the civ is making (or offer more than you're making) then they simply won't accept it. Also, you often mix per turn and lump sum agreements, especially for certain one-shot items like world maps.

If you offer an optional tech for which the wonder has already been built, then you'll only get 1 gold. So sell Music Theory to everyone right before you build J.S. Bach's !

Sometimes I get the sneaking suspicion that my first offer for a tech partially determines what the civ is willing to accept. (As in, if I had started with 60 gold instead of 40, they would have accepted 50, but now they won't accept more than 45.) Haven't bothered to verify this though.

Anyone else wanna chip in?
--Yelof
 
Originally posted by Sir Yelof


Sometimes I get the sneaking suspicion that my first offer for a tech partially determines what the civ is willing to accept. (As in, if I had started with 60 gold instead of 40, they would have accepted 50, but now they won't accept more than 45.) Haven't bothered to verify this though.

--Yelof

It would be much more interesting if this was the case, but unless you actually submit the offer then the AI will always want the same amount of money, indicated by the advisor saying 'This is close to a deal' if you move it down one gold and 'This deal will be acceptable' if you move it back up one.

One thing I have noticed when recently trying out The Pope Strategy on Emperor; If the tech has only been discovered by one civ than the price will be significantly higher than if other civs have discovered it as well. I think this works like:
Tech Price = (Research Cost in Gold/Number Of Civs That Have Discovered It)

Also, even on 1.21 the AI will still sell cheaper amongst itself than to me!!!
 
Originally posted by Sir Yelof

Sometimes I get the sneaking suspicion that my first offer for a tech partially determines what the civ is willing to accept.

When you ask what they're willing to offer for a treat, you can ask for more most of the time. I'm not sure whether the AI is affected by changing your proposals time after time (to achieve the optimal proposal)

On the other hand, if it does, than it would make a lot more sense that all the other civs are furious with me while I didn't do a thing (besides being a dominant cultural and military power, and constantly selling treats for beaucoup gold...) in my current game.

Originally posted by mydisease
Tech Price = (Research Cost in Gold/Number Of Civs That Have Discovered It)

Are you suggesting that a tech has a set price for all civs will be the same and that there's no difference to whom you'll sell?
 
Originally posted by Shabbaman


'Tech Price = (Research Cost in Gold/Number Of Civs That Have Discovered It)'

Are you suggesting that a tech has a set price for all civs will be the same and that there's no difference to whom you'll sell?

Sorry, I was a bit vague there, I actually just meant that this is part of the formula for tech price. Research cost is meant as specific to an individual civ, ie. the amount of gold required to complete research for that tech, which would be lower if research had already been done on it. So there would be a difference.

Also as Sir Yelof said, the tech price is affected by diplomatic standing, military power, culture and to some extent usefulness of the tech (possibly judged by turns since it has been discovered).
 
The AI calculates each deal to how much it is worth to them and how much it would be worth to you. There are a lot of factors in human-AI dealings. Here are some:

Techs:
- I think your biggest factor is, how much gold & gpt each party has. A civ with 5 gold and is making 1 gpt will not pay more than that. That's probably why you see so many discrepancies. AIs aren't still great with accumulating much money. Even if they were, the human player is pretty good at draining it from them :)

- "beakers" the civ already has invested. Techs get way cheaper after you have invested money into them already. Same for the AI. Perhaps the AI offering you 5 gold for a tech is 1 turn away from discovering it themselves.

- # known civs who already have it. Tech devaluates at the rate of the above formula, given by mydisease.

- Difficulty. On Emporer, AIs get everything at 80% cost. That means they only need to put 80% of the beakers into a discovery as you do. That also means that they will only want to pay 80% gold to buy it as you do. That's why the AI's will also trade at a cheaper rate & stiff you, because it is worth less to each AI civ than the human player. Because of this, on higher levels, the AI is actually very smart to sell anything to the human player first.

- Tech Utility. In a recent patch, AI's reportedly stopped paying much for a tech that only allowed a wonder that was already built. I haven't tested this though.

- Relationship. Not sure how exactly this works, but Gracious civs will often give you a better deal than furious.

Resources/Luxuries:
- Population. The AI will know by your population, how valuable a luxury will be to you. If you only have a few cities, 1 luxury will only make a few people happy, & you can probably get a good deal. If you have many cities, 1 luxury will make a much larger impact, & the price goes up. Therefore, if you had twice the cities as a trading partner, you might have to pay 2 for 1 luxuries.
 
Chiefpaco, those are some great observations. I too have noticed that a civ will offer less if it can afford less. After I crack and finally decide to give a civ a technology, I hop around and offer it to everyone else, figuring they will soon enough anyways. But sometimes you'll only get a couple gold for your efforts from those civs about to be wiped out...

Of course, as a human player your own civ can't get away with that! If you don't have enough gold or tech, even if you're losing, then they will simply ask for gold per turn as well. If you don't have enough revenue to afford even that, then they'll tell you "it can't be done."

Also worth noting -- I believe the negotiations only pay attention to your current revenue. If you're currently losing money, civs "will never accept a deal" with gold per turn. If you're making 20gold/turn, then they won't accept a deal for 21gold/turn. This is a bit silly, though, because if you adjust your tax slider before entering negotations to increase your income, civs will offer and consider offers for gold per turn deals.

A similar component is the gold in your coffers. Though I haven't set up a controlled experiment yet, I'm pretty convinced that the AI wants more for that Chivalry tech if you have 800 in the bank, but will accept less if you have 400 in the bank.

Originally posted by chiefpaco
- Tech Utility. In a recent patch, AI's reportedly stopped paying much for a tech that only allowed a wonder that was already built. I haven't tested this though.

I can validate that one. No one would give me more than 1gp for Music Theory after I built JSBach's Cathedral. I was on 1.17 at the time.

Would still love to know if you alter the final offering/selling price through your continued offers. Isn't it odd how often you'll offer, say, 50 gold for something and get "acceptable," then try 49 but find that drops you to "nearing a deal"? If you had started with 45 would that have been 'acceptable'? I mean after all, otherwise why bother to have a negotiation screen, if you could simply step down 1 gold at a time from your high price until you found something acceptable.

--Yelof
 
"A similar component is the gold in your coffers. Though I haven't set up a controlled experiment yet, I'm pretty convinced that the AI wants more for that Chivalry tech if you have 800 in the bank, but will accept less if you have 400 in the bank. "

this is almost certainly true. have you ever noticed how when you're in a war and need a certain strategic resource, the selling civ's offer is always almost everything you have ... to the penny? (this could be gamed, i suppose, by spending down your treasury before trying to make the deal ... hmmm, have to try that).

and as far as selling techs around. it may be stating the obvious, but i am always careful to make a complete circuit of the ai leaders before i begin selling--palming off 5 gold a head repays itself many times over when i can get a really rich deal by offering the tech first to the civ with the most cash, and then gradually working my way down.
 
Originally posted by Sir Yelof

I can validate that one. No one would give me more than 1gp for Music Theory after I built JSBach's Cathedral. I was on 1.17 at the time.

Would still love to know if you alter the final offering/selling price through your continued offers. Isn't it odd how often you'll offer, say, 50 gold for something and get "acceptable," then try 49 but find that drops you to "nearing a deal"? If you had started with 45 would that have been 'acceptable'

Well, I couldn't say that that proves a thing. Personally, I wouldn't even pay you 1 gold for music theory if JSBC is already build. I mean, what'cha gonna use it for? It aint no good...'cause it's a 'dead end' tech.

I'd like to see it proven with something like monarchy, feudalism and construction. It would be strange if there's no interest in those. I could try this tonight, maybe I can sell them fission:nuke: for a little more than 1 gold (they're all pre-combustion, it'd be nice to bash their heads with a tactical...)

Oh yeah, I've tried your offering/selling approach by reloading a couple of times, and it seems to me that a certain price is set and is not influenced by your diplomatic haggling (I think your proposal is made AFTER you click 'What do you think of this you filthy rat?')
 
In regards to my earlier guess;

Tech Price = (Research Cost in Gold/Number Of Civs That Have Discovered It)

I have done some research :lol: and found that this is not the relationship at all. At first, I tried looking at patterns in tech. price, but this was much too complex to derive a formula without prior knowledge. So, I looked through my notes and saw something odd. Research cost (I was at 0% research) for a specific tech got less as I met more civs. This led me to wonder what the definition of Research cost could be. I set up a test map, 60% water Pangea and 8 civs, so I can meet all the civs quickly, regent and standard size so there are no modifiers. I log research cost of the five available techs every turn and pump out settlers and warriors to find the other civs. Naturally I am not researching the techs myself as I want the total cost.
A pattern starts to emerge; research cost for a particular tech falls every time I meet a civ that has that tech. I buy no techs, but just explore until I find all the civs. I'd post the results here, but I don't know how to insert tables and it would probably just take up unneccesary space. Anyway, after analysis of the results I derived the general formula for any specific tech:

Research Cost = 0.9^N * Map Modifier * COST

Where; N = number of civs on my diplomacy screen that have discovered that tech
COST = the value for tech cost as written in the civilopedia
Map Modifiers are as follows:
16 : Tiny
20 : Small
24 : Standard
32 : Large
40 : Huge

If the result of the formula is a decimal then it is rounded to the nearest whole number.

And that is it. No difficulty modifier and no devaluation per turn. The formula is not exactly right all the time, but is usually within 5%. I think this may be due to computer rounding at some point, though I might have missed something.

I doubt that there will be a separate number of civs component in the tech price formula as well, so the formula at the top can be disregarded. And now that I've got a more or less accurate research cost formula, it should be easier to work out the tech price one.

Also can someone try this formula with later era techs, as I only had a chance to try it with ancient era.
 
Mydisease rules the world obviously.

You're sure civs you haven't contacted don't count? Great research. Maybe you could upload an excel spreadsheet or something...I think that there might be a handy tool in this one (a la the combat calculator) Picture this: you could calculate the optimal research pattern...:goodjob:
 
Originally posted by Shabbaman
Mydisease rules the world obviously.


You're too kind. No, really, I forgot to test the formula using different numbers of civs :o and it turns out the formula I stated was almost entirely wrong. I have read elsewhere that the map modifiers are *10, meaning I missed a factor of 10 division somewhere. The real formula, I think, also involves the number of civs on your diplo screen that know the tech as a percentage of the total no of civs on the map and this altogether will account for approximately a 60% drop in research cost if all civs know the tech in question. This is still a large drop, though my formula should be though of more as illustrating a general trend than mathematically correct; research cost will drop significantly as you meet more civs that know the tech.

The formula stated is roughly correct for a standard, 8 civ map, but it is now clear to me that .9 is not a constant and the formula becomes more incorrect after N=5. I'll do some more research on this and should have another formula worked out by the end of the weekend (I've got too much revision to do during the week). And hopefully it should be the correct formula this time:o .
 
Mydisease, that is some awesome work. I look forward to your quantitative analysis.

In the meantime, I guess the rule of thumb is definitely:

"If you're behind in tech, you'll research faster if you're in touch with more civs."

I'm totally gonna use that on GOTM7 and any Deity level game. Man, you get so far behind on tech so quickly...!

Also worth noting that once you trade a tech to a civ, you're decreasing the work/cost required for other civs to obtain it -- but hell, they'll be trading for it from each other anyways, so you can already assume THAT...

Tying up some points Shabbaman made on this thread:
- Good to hear that I shouldn't be paranoid about my initial offering price. Of course that means the haggling interface is really just a farcical hoop to jump through to find out what something is worth, though nonetheless I still enjoy it.
- re: 1gp for Music Thoery: actually, that was what I was trying to prove: that the AI won't pay for an optional technology if it has no use for it. (i.e., the wonder is already built.)

--Yelof
 
Yesterday I was able to extort the Aztecs over 150 gpt for computers, while I'd already built the SETI program. So a tech doesn't devaluate down to 1 gold, as was mentioned by Sir Yelof.

Actually, I meant that Music Theory has no use whatsoever except the J.S. Bach cathedral and that I doubted that the AI doesn't pay more than 1 gold for a tech when the wonder was already built. As I demonstrated with computers, that's not true. However, the AI doesn't pay for Music Theory, and probably wouldn't pay for Free Artisany, when the S.'s theatre is built.
 
The drop is definately not constant. A tech is highly valuable (up to 90% of the research cost) if no one else has discover it. But drops significantly once someone else has it. Then, the drop goes more linear.

And the value of tech both in research as well as trade is dependent on the "buyers" contact, not yours. So, the AI will value even your outdated tech if it has not make any contact with anyone else. It happens to me once when English was on an island and I intentional stop anyone from contacting them.

Two rules for trading
1) Get as many contact as possible before trading
2) delay AI contact with each other as long as possible
 
Originally posted by Shabbaman
Yesterday I was able to extort the Aztecs over 150 gpt for computers, while I'd already built the SETI program. So a tech doesn't devaluate down to 1 gold, as was mentioned by Sir Yelof.

Computers is a pre-req for dozens of other techs in the Modern Age, so the fact that the SETI program has been build does de-value the tech slightly, but not completely. The de-valuation (is that a real word?) of a tech to 1 gold is only true for techs that are not pre-reqs for other techs, and do not allow you to bulid any other units or city improvements, just a Wonder. The only two techs that meet these requirements are Music Theory and Free Artistry. These two techs are de-valued to nothing when the associated wonder for that tech has been built.
 
This is an approximation to the research cost formula for v1.21f. The real formula for v1.21f is on the next page. I leave this here only to show how I came to the final, correct formula:

Research cost = (MM * COST * (K - N) / 10K) - Research done so far

Research cost and research done so far are in gold.
COST is the tech cost specified in the editor.
MM = map modifiers =
Tiny 160
Small 200
Standard 240
Large 320
Huge 400

N = number of civs on the diplomacy screen that have discovered the tech.

K is constant for the number of civs left on a map(not the starting number). Values of K :

2 civs K=3
3 civs K=4
4 civs K=6
5 civs K=6.66
6 civs K=9
7 civs K=10
8 civs K=12
9 civs K=12.5
10 civs K=15
11 civs K=16
12 civs K=18
13 civs K=19
14 civs K=21
15 civs K=22
16 civs K=24

ALTERNATIVE FORMULA

Here is a rearrangement of the formula above, which I find easier to understand and use:

Research cost = [(MM * COST)/10 * (1 - (N * K^-1))] - Research done so far

I will also give the values of K^-1 for simplicity's sake:

2 civs K^-1=0.333
3 civs K^-1=0.25
4 civs K^-1=0.167
5 civs K^-1=0.15
6 civs K^-1=0.111
7 civs K^-1=0.1
8 civs K^-1=0.0833
9 civs K^-1=0.08
10 civs K^-1=0.0667
11 civs K^-1=0.0625
12 civs K^-1=0.0556
13 civs K^-1=0.0526
14 civs K^-1=0.0476
15 civs K^-1=0.0455
16 civs K^-1=0.0417

ROUNDING

The rounding takes place on the first part of the equation (ignoring research done so far). Basically, the actual values of this part are discrete, ie. the solution to this part of the equation can only take certain integer values and not all integer values. These integer values are determined by the map modifier using the formula:

ROUNDDOWN[((MM * COST)/10) - (MM/100)]

This may look complicated, but for small maps where the MM = 200 it just means that research cost (previous to any spending) can only take even integer values, ie. in steps of two. Similar to this, for huge maps where MM = 400, research cost (previous to any spending) can only take integer value in steps of four. However, it is more complicated for other map sizes as (MM/100) is not an integer, so steps seem irregular after the ROUNDDOWN.

Anyway the value from the first part of the research cost equation is rounded down to the next integer value of the rounding equation above. Then Research done so far is taken away from this rounded down value to give actual Research cost.
 
Looks good. Formula is good with my current tournament game =)

But you forgot to divide the cost by 10 ;>

i.e.

tiny 16
small 20
standard 24
large 32
huge 40
 
Originally posted by Qitai
Looks good. Formula is good with my current tournament game =)

But you forgot to divide the cost by 10 ;>

i.e.

tiny 16
small 20
standard 24
large 32
huge 40

I wrote this down, but just failed to copy it into the post. It has now been edited so that it is right (or quite close). The map modifiers are actually ten times those values as you can see if you look in the editor. Why they've done this I don't know, probably to give more flexibility for modders.
 
Top Bottom