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 2)
3 Pages1 2 3 
on Apr 18, 2007
Draginol, your subtitle is 'Making computer players better negotiators', and you mention adding some real AI to the trading process, so I will stick to that for this post.

I have always wondered why the computer players don't consider the overall galactic situation when trading with the human player. I would like to see what would happen with trading if each computer player came to the table with an assessment of the current division of the galaxy, the human player's alignment and past actions, and personality quirks of their own.

I would call it AI situational awareness.

If you're trading with a neighbor who probably shares planets in the same systems as you, it would make sense for that player to completely refuse to trade their weapon and colonization techs. At the same time, it would make sense for them to be more willing to trade econ/research treaties to you, making it less likely that you would attack them and breach the treaties.

On the other end of the spectrum, consider a player who is on the other side of the galaxy. You have neighbors, i.e. potential enemies, in common, and you are not an immediate threat. They might be more willing to trade colonization techs and other things that could serve to weaken their neighbors.

I can't really tell if alignment is much of a factor currently. Diplomatic standings do seem to matter a little, but it would make sense for your alignment brother on the other end of the map to be more willing to trade with you, at least. Or, if you're the Altarians trying to trade with the Drengin, they should be a lot less willing to even buy your stuff.

How to decide how close is too close? Right now, human player influence on even a single computer player planet causes a lot of friction. The Thalan home systems are a hundred parsecs away, but that one radioactive planet they colonized in the middle of your empire makes them hate you. It would seem to make good trade sense for them to be more willing to trade a planet like that, or to take a similar planet of yours in trade. Close neighbors, of course, might feel very differently.

Do the human player's past actions figure in to trading at all? If you're a known warmonger, why would anyone even sell weapon techs to you? If you're a peaceful, good empire, other similar empires might take this into account.

Which brings me to my last point, computer player personality. What if the Iconians had a 'be kind to the galactic underdog' philosophy, or the Terrans were inclined to suck up to anyone with a higher military rating? This type of thing would be exploitable if it were always the same, but it would be nice to see some kind of race philosophy at work behind a computer player's diplomatic and trade styles - especially if it were random between games and the human player had to guess his way through it each time.

All of that would probably be almost impossible to factor in, but if you are serious about enhancing the computer players' trade/diplomatic functionality, I hope you will consider at least adding some situational awareness routines.
on Apr 18, 2007
Wow, great thread!

My latest DA 1.6 Beta game, masochistic medium map as Thalans, the Terrans offered me Anti-matter Power Plants for Beam-Weapon Theory.

Needless to say, I took it.

Then the Drengin offered me Majesty for Stinger II.


So, once in a blue moon you'll get a good deal.
on Apr 18, 2007
I'd have to agree. When you say that the Trade screen isn't involving any AI, that really points out why its such a hole in their playstyle.

Just giving it a quick thought... there's basically four parts to a trade that need to be considered on a trade item by trade item basis. It basically comes down to what each side is getting or losing with each side of the trade. Lets take a simple trade, like 500 BC for laser III. The loss of the laser would be considered differently for both sides... both sides would be thinking "what am I gaining/losing out of this, and what are THEY gaining/losing?" This stuff would HAVE to be hooked into the AI somehow...

How you make use of that information becomes highly variable. Trading done on good terms would probably be a net gain for both sides. Trading done on less... favourable terms would be more one sided, or even set up to give the other a raw deal at the expense of ones self.
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.


I agree, but I do think it's the easier fix. The current system *can* work, but I'm not sure it should. Considering the diplomatic bonuses provided by treaties the fact that you can have them with everyone just serves to make the diplo model all that much easier to exploit. I'd certainly love to see the AI manipulate that system as well, but I don't have any real expectations in the regard with GC2 (here's hoping that it can be worked out in GC3). It just seems like too massive a project for Stardock to be able to realistically manage in patches.
on Apr 18, 2007
Maybe not patches, but an expansion that did an overhaul of the AI, including making trades actually work?

I'd pay money for that almost as fast as I would for multiplayer. Put the two together and you have the recipie for the perfect expansion - makes everyone happy, box it up and stick it in stores.

but now I'm off on a tangent so I'll get back to the discussion, sorry.
--------

The trade system really, really needs an overhaul - AIs just arent INTELLIGENT at all about trades, as many posters here have said. I'd also like to add another point to this bit about "stupid AI tricks". When you offer a treaty to give an AI some money to go beat up another race, the AI doesnt consider anything but relative military strength. Last game the Korx were at war with 3 civs and I paid them a scant 1500 to go to war with the other remaining AI civ. Because this final war overextended it, the Korx were overwhelmed by the might of four enemy AIs despite having the current military lead.

AIs need to evaluate the wars they and the target are involved in. It should cost substantially more, or even return a "our military is too busy in our other wars" response, to convince an AI to go aggressing more enemies when it's beset on all sides by races who want to destroy it.
on Apr 18, 2007
I really really really hope you read this. I think you guys did an innovative, creative, and amazing job creating a trade system. I would feel proud of yourselves, because no one has done anything similar to what you did. You created a 5 fold trading system, and although there is always going to be a way to cheat any system or AI. You did something that was fun. Don't fall off your pedestal on the trade screen, but pat your own backs. Firaxis with their multimillion dollar budget didn't think of a trade screen anymore complex for CIV4 then the one they used for CIV3. Let alone the fact that the only improvements they added for their multimillion dollar expansion pack was 2 civs and 2 units. You guys revamped your trade screen to be 30 times more pimp for less of a budget. Thanks guys.
on Apr 18, 2007
I very much disagree with the people who say the trading system isn't intelligent. You not only have an a great variety of trade goods, but you also have the diplomatic ability and negotian abilities which increase your chances of getting a good deal. That is creative fellows. I have only ran into two instances where the AI acted wierd on a trade, and that was on the lower levels. The AI bought a technology for a colonization for a world already possessed by someone. It happened to conquer that world later though. Plus I have seen the AI try trading smaller technologies that don't have much significance to me, but I try and trade useless stuff all the time. I think it was to raise the relation meter or because they needed the technology. I think people are upset that it's so hard to trade with the other races unless your human, and have an amazing diplomacy level. Thats the way it is in real life though. I don't see China trading nuclear secrets for canned good, and I don't see any country trading important technology for any amount of money unless a 'SPY' (which happens to be in your game) steals it. Another factor that is bothering some people, but I HAPPEN TO TRULY ENJOY THIS PART OF THE GAME is that civilizations with a good alignment are unwilling to trade weapons to evil civilizations, and vice versa. I know you can do that in CIV4, but I don't think that is truly realistic for advanced civilizations in space let alone the modern world. However if there is a way to revamp it please do, but I do enjoy the difficulty level of the AI TRADING.
on Apr 18, 2007
Maybe not patches, but an expansion that did an overhaul of the AI, including making trades actually work?

I'd pay money for that almost as fast as I would for multiplayer. Put the two together and you have the recipie for the perfect expansion


Actually put those two together and you have one of the few expansions I wouldn't pay for for this game. I don't think the trading is that bad, and multiplayer is fundamentally useless to me. Incidentally there's no trading AI to overhaul, did you read the initial post here?
on Apr 19, 2007
One other thought: When you make an offer, and the AI dialog box turns "Green", lowering your offer ought to make it turn "Red", no matter what else it would have accepted previously...
on Apr 19, 2007
Incidentally there's no trading AI to overhaul

Which probably is the problem right there. I also agree, I don't think trading is that bad, and the 1.5x3 patch made the AI a little tougher to beat.

I do think trading is one of the biggest AI holes, although probably not fair to attribute it to the AI. But, to be fair, even as one of the biggest holes it isn't that big at the top levels, and I'm becoming a fanboy, I just love everything about this game.

Doesn't mean feedback can't help it to improve!
on Apr 19, 2007
There are just a couple of things I'd like the AI to consider when trading, that would make it much harder to exploit:

1. The AI should value 'rare' techs more. If they're the only one with a particular tech, they should expect more for it. Equally, if you're trying to sell them a tech that all the other civs already have, they shouldn't be prepared to pay much for it at all. This'd make it a lot harder to use the old 'buy techs from one civ, and sell it to all the others' tactic.

2. The AI shouldn't accept selling techs for BC if they have plenty of cash already. Often I see the AIs absolutely rolling in cash, but they're perfectly happy to let their tech advantage go for a few extra BC.

3. The AI should look at relative research ratings before doing a tech trade- if you're miles ahead in tech already, they should start asking for techs in return for cash (as humans do all the time). They should also start expecting more of your techs in return for theirs, since it's not in their interests to just build up your tech further.

I don't know if they already do take stuff like this into account, but if so I think that this effect should be excagerated.
on Apr 19, 2007
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.


Not only there's a logic to it, it reduces cheese. It also forces you to have the right "bargaining chip".

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


Not really wise if you don't have an econ sstem that is balanced in all its components - is 300bc in research the same as 300bc in say planet income? Or in ship production cost? Also, a tech will eventually become outdated, a planet will always produce income. Etc etc. Point being, being "unorthodox" just for being different (or for having an AI coding challenge) might not be in the gameplay's best interest.

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.


Hanging responsibility on the player's side of the equation... seems recurrent. It's easier for you, no doubt about that. But rules and limitations are part of a game, and if a certain degree of freedom is always welcome, outright exploits and cheese are not IMO.

Simple and easily controllable vs complex and exploitable. The bottom line being fun,...
on Apr 19, 2007
Civ 4 basically doesn't have diplomacy at all. It won't trade most techs and won't go to war for anything. GalCiv is much more fun even if it is cheatable.
on Apr 19, 2007

Incidentally there's no trading AI to overhaul

Which probably is the problem right there.


No doubt about it, but changing that is definitely outside the scope of a patch.
on Apr 20, 2007
I also think - if there is an overhaul - that the AI should not value highly techs that allow for trade goods if they have already been built by you or another AI (or even close to completion, if an AI can determine so).
3 Pages1 2 3