Brad Wardell's views about technology, politics, religion, world affairs, and all sorts of politically incorrect topics.
Making computer players better negotiators
Published on April 18, 2007 By Draginol In GalCiv Journals

One part of the "AI" isn't really AI.  A lot of people think of the trade screen in the game as being "AI".  But it's not. It's basically just a dialog full of weighted values.

The real AI may, for instance, call up the trade screen. But the actual valuing of items in the trade screen (money, techs, ships, planets, etc.) isn't in my area (the AI) but is instead just a table of values to weight everything.

Which means, of course, that it's exploitable. 

Creating a negotiation screen like this is non-trivial. 

For instance, in GalCiv, you can research diplomacy techs and get the super ability Diplomacy which gives you a huge advantage in negotiations.  But at the same time, we can't let people trade say 100BC for 101BC or else they can really exploit the game.  And that's the kind of thing that is more difficult to keep from happening than one might think.

In Civilization 4, the solution was to pretty much make it so that you could only trade apples for apples (techs for techs for instance).  That way, players couldn't easily exploit the AI.

In GalCiv, we slog through with trying to let people trade ships, techs, money, treaties, war proposals, etc. for any combination of those things. 

But the downside is that some people will find exploits.  There is no practical solution other than to remind people that it is a single player game and if they want to cheese the computer opponents, that's really their busines. 

We also try to do updates to the trade screen "AI" so that it is better in negotiating.  But there are just so many variables to take into account. 

If you have a particular "stupid" trade screen behavior, post below and I'll take a look at it.


Comments (Page 1)
3 Pages1 2 3 
on Apr 18, 2007
Peace treaties. All the time you'll be slaughtering an AI player and the AI on the trade screen will be begging for peace; but when you offer Peace Treaty for Peace Treaty, he won't take it. At least, not until you throw in half your Trade Goods--and that's when you're WINNING THE WAR.
on Apr 18, 2007

Peace treaties. All the time you'll be slaughtering an AI player and the AI on the trade screen will be begging for peace; but when you offer Peace Treaty for Peace Treaty, he won't take it. At least, not until you throw in half your Trade Goods--and that's when you're WINNING THE WAR.



I've run into the same thing more than once, and it's somewhat frustrating. They offer you something of theirs that you don't want, in addition to a peace treaty, you refuse, then suggest peace treaty, PERIOD, and they refuse, let alone peace treaty and something else.
on Apr 18, 2007
Peace treaties can go the other way too, though. It may be a hallucination on my part but it seems like you're more likely to get one the longer the conflict has stretched on, no matter what the relative performance of the sides. More than once I've managed to white peace my way out of certain doom, which never really made much sense to me. Heck, sometimes when they're casually slaughtering you they'll up and offer you a straight peace treaty. I don't really think of it as all that serious of a problem, but it's decidedly odd.
on Apr 18, 2007
Is this "table of values" the same for all opponents in all situations (weighted by diplomacy) or does it change depending on the strategic goals of the AI's?
on Apr 18, 2007
I agree with the previous posters, the AI is very poor at deciding the value of peace and war, when it should keep fighting and when it should want to stop. The Terran Alliance is especially bad about peace treaties, wanting too much for peace when it is losing, often leading to it's doom.

Also, I often have problems with apples to apples trading. No matter my diplomacy, the AI should want to trade me Phasor II if I offer it Phasor VII in exchange. I know this means its trading weapons tech... which it now recognizes as dangerous. It still will always gain from this trade, no matter the difficulty level or situation.
on Apr 18, 2007
I have noticed that with a high enough diplo, the AI is willing to trade away it's last planet. This happens more often during a peace negotiation, but it ought not happen at all...
on Apr 18, 2007
Also, not sure if this has to do with the real AI or the values table that you deal with, but the AI does not try hard enough to get multiple treaties. Every AI should want every treaty from all the other civs, those are free bonuses to your empire. The AI is lethargic at picking them up, and only ever seems to pick up two.

Part of this appears to be how they value the treaties. IMO, they are valued too low... I should be able to sell mine for more, and it should cost me more to get one. A treaty's value is a function of the time that it is up. Say I'm producing 200bc of research a turn. My treaty will now give 20bc of research per turn. So how many turns will it be active? Say, if you just want to guestimate/average a treaty will last for one year - 48 turns - then my research treaty is worth about 960bc. Sure, it might not last a year, but it also might last 10 years. Rather than trying to estimate the life of a treaty, I would pick a default "average" length the AI assumes a treaty will be up and then calculate the value accordingly. Often (especially in the first few years) I can't sell an economic treaty for 200bc, when my income is over 4k per turn. The AI would see an IMMEDIATE cash increase to take that trade, on the very next turn it would get 400bc back on its 200bc investment. Still, it stubbornly says... no deal. This is to the AI's detriment.

If it matters, I play on suicidal and on average on medium maps, so my experience and conclusions come from what I see on that level of gameplay. What I see might not necessarily hold true for other game environments.

- Edit - Also, generally income and research levels rise through the course of the game. Therefore, figuring the value of the treaty based on current values still probably undervalues them. Say, in my example above, I personally might value the research treaty at closer to 20*1.3*50 = 1300. This formula is just how I personally value treaties when I am trading in my own games, and is used really only for example purposes - not necessarily as a benchmark to shoot for. True, sometimes research and income values can fall, but on AVERAGE they increase, so that is what I consider, hence the x1.3 multiplier.

- Double Edit - For instance, this is a screenshot from a very recent game of mine on suicidal. I was playing as the Altarians. Why does the AI not try and do this??
on Apr 18, 2007
Actually, I have more to say about trading in general on the top difficulty levels. The AIs approach seems to be to just value everything more highly, and this leads to it missing opportunities.

For instance, lets go back to that research treaty from a civ that is researching 200bc/turn. Say on suicidal the AI just values everything it has twice as much. Now, it wants 2600 for its research treaty. That is fine, it makes the game harder on me. BUT it will only pay 750bc for my treaty. But, the value of the treaty is actually 1300. Solution, I just don't sell my treaty. I don't have the cash, but the AI is the net loser, because my treaty really was worth at least 1300bc. Because the AI insists on paying too little for my resources, it consistently misses out on opportunities. This is especially true because I often become one of the most powerful civilizations, so what I can offer is usually quite a lot. Instead, I become more powerful by just keeping all of my toys to myself because the AI asks too much for me to be willing to share. This is exactly why the general feeling among players is that turning tech trading off makes the game easier. Not selling anything usually is an advantage. The AI should work harder to procure deals, exactly because it can make it more powerful.

Sometimes I might be willing to sell a planet that I get deep in enemy territory because it is too far away to defend. But if the AI won't pay for it, then it is just easier to take the diplomacy hit from close borders and alarming influence, and maybe invade the stubborn AI rather than selling it the planet. It should realize that offering to sell a planet is a huge asset. It should also realize how much of a loss selling a planet is to its overall potential. The AI being unwilling to pay for assets is only an advantage to the AI if I have money problems. If I am self sufficient economically, it is just missing out on opportunities.

This goes to exactly the problem with peace treaties. The AI is valuing its money over its survival, and so it gets conquered. True, if it thinks you will just attack again in the next turn the peace treaty is worthless. But what about when you honor your treaties? If the AI is losing a war, regardless of its military rating, it might be time to think about regrouping and suing for peace.

--
Another trading oddity. "Worthless preceding tech" is only worthless if the preceding tech doesn't include bonuses. Soldiering tech comes to mind. If I offer Planetary Bombardment with Advanced Troop Modules, the Planetary Bombardment is NOT worthless preceding tech. It confers a +5 soldiering bonus and gives you more invasion tactics.


Edit - And more along the same lines with the AI not working hard enough to trade more. Why doesn't the AI send me offers to buy planets that it finds offending? Why doesn't it approach ME about trading treaties early? Plenty of times I have bought ships off of the AI for various reasons. I have never once ever seen the AI approach me about buying one of my ships. If I offer something, it will think about it, but I'm the trade "aggressor", I'm setting the terms and making the deals. Why isn't the AI looking to trade with me for what it needs, why isn't it initiating? Especially the Terrans. You would think having them in the game they would early on be getting most of the treaties, and bugging me constantly about buying something new. Same with the Korx. But no, they just sit there, and the Terrans will just stubbornly demand more for any deals.

Don't get me wrong. I'm impressed by the AI generally, and I love this game. Trading and the AIs approach to trade has always seemed like one of the biggest holes, however.

Double Edit - imagine for instance, if the Terrans kept offering you good deals for your top tech. You don't want to make them more powerful, but its just such a good deal... There is so much more to a trading empire than just sending out a few freighters. You finally research large hulls and everyone else is using small or mediums. Suddenly the Korx approach YOU and offer you thousands of bc for your large hulls. Man that is a lot of money. How much can they do with a tech advantage really... Only, they can do plenty. This is the sort of approach a player takes, especially when building a trading empire. The AI on top levels makes unreal amounts of cash. To turn that cash into power, you want to play off of the players natural greed by offering them short term benefits (money) for long term problems (the AI now has your best tech). When the AI always just offers you bad deals, it is easy to just turn them down.
on Apr 18, 2007
The AI also seems to value tech in a vacume. If everyone is using warp drives, New Propulsion Techniques really isn't worth much. I've had problems trading Extreme Colonization for Xeno Biology. What? What is the AI thinking? Why is it valuing those old techs so highly?

The value of any tech in this game is relative to the top tech reached in that tree at the current time in the current game. Having the top tech of any tree, except maybe sensorsIV and starbase fortification techs, is worth plenty. How much are research centers worth? If everyone is using basic labs and xeno labs, they are worth a lot. If everyone is using Discovery Spheres and Neutrality Learning Centers, Research Centers tech is practically worthless.
on Apr 18, 2007
I'm currently playing my first game with tech-trading enabled in a long time.

The AI never sent me any acceptable trade. They kept insisting in wanting to trade my Alliance against their Missile weapon theory...

And this isn't limited to tech trading, since I never got offered a treaty or an alliance (in all the games I played), even though I see the AI trading it to another AI. So I'm pretty sure that the AI treat the human player differently than the others AI.

So my question is : Why does the AI never propose acceptable trade to the human player? I would be pretty happy to enable tech trading if the AI was to send me acceptable trades sometimes...
on Apr 18, 2007
Treaties should be bilateral only, the above screenshot is why.
on Apr 18, 2007
Wyndstar, your points are very well made, especially when you show how the AI is actually hurting itself by refusing reasonable trades and very offering anything reasonable.

After the patch that made the AI's much more stingy, I have the impression that in order to fix the "exploit" of trading to the AI's disadvantage, the AI's were made so greedy that they not only don't trade to their disadvantage, they also never trade to their advantage.
Unable to tell the difference, the AI will turn down a great deal for fear of being ripped off.

At what cost? Obviously, players are going to figure out ways to rip off the AI no matter what, as Draginol said. So is the game more fun with a stingy AI that drops you out of the suspension of disbelief because it turns down obviously advantageous trades or is it more fun with an AI that lets itself get ripped off a little more often but generally is pretty reasonable?
on Apr 18, 2007
Treaties should be bilateral only, the above screenshot is why.


But, but, I like my "tributes". The thing is, it wouldn't be an exploitable advantage if the AI just tried to do it as well. I think the current "free" treaty system can work, where some empires get six sent there way, others get none. But for it to work, the AI has to actually want them.
on Apr 18, 2007
Sorry, double post...
on Apr 18, 2007
I think that treaties should be re-negotiable. After a certain minimum contract length, the AI examines their worth and decides whether it's worth haggling for a better deal. A civ which is behind technologically should make a better prospective buyer for a research treaty.

By subtly changing who they grant a research treaty to, a civ can try to keep the playing field level instead of allowing one civ to suck off all the rest.
3 Pages1 2 3