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 3)
3 Pages1 2 3 
on Apr 20, 2007
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.


And that seems to be part of the problem . . . perhaps there should be some sort of decision tree or expert system or some other AI construct to make more intelligent choices about what it wants and doesn't want to trade.

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.


Well, that can be partially done by ensuring that "cost" of an AI selling an item is always lower than that of buying the item. Instead of having a weights system, have a currency system so that there's always a selling price and a buying price associated with each item.

In any case, I don't think of the system in terms of exploiting - I think of it in terms of getting the most bang for my buck. Yes, I do get aggressive and will add some BC to the very limit of what the AI is willing to trade.

Personally, I think one of the weaknesses is that the AI isn't very aggressive in trading between other AIs - even though I can't see trades, I get a feeling it doesn't happen often enough, and that the trades aren't as aggressive as my own trading.

Treaties themselves are something I want AIs to trade more often also - I used to be a great Civ 3 player, and one of the things I loved to see was all the complex political and trade agreements - and what happened when they came into play when AIs went to war with each other (alliances).

Not to say that Civ 3 was perfect, though: I was usually able to manipulate alliances and treaties to make everybody go to war against an AI that had declared war on me.

Anyways, I still think the AI should be a lot more willing to make treaties with other AIs and should do it more often.

The best thing to do if you think the game is really being exploited is to implement some sort of limiting factor. Many games use diminishing returns or limited resources to curb "exploits".

But, yeah, I think the weighting system is probably too simplistic to handle trading with a human. The game should implement some sort of system to make more intelligent choices based on what it values and what it thinks the human values. Decisions should probably be based on a system combining both actual value and perceived value.

And, yeah, the value of peace should be altered - if I'm in a position to crush another player, they're really in no position to ask me for anything beyond a peace treaty, because I'd rather finish crushing them than giving them anything. In fact, they should be offering me a lot for the peace.

Okay, now on to something I disagree with a bit: Calling it an "exploit." The only way it's an "exploit" is because the player a huge advantage - and that is because the AIs aren't doing the same thing. It would probably be much less of an exploit if the AIs were just as capable of aggressive trading as the human is.

Also, a good look into economic theory doesn't hurt - why can't we make infinite money in our own world? Because of limited resources, of course. Even money itself is a limited resource.

Do we sometimes "exploit" the system, making more money off of an item than we bought it at? Sure.

But there are a few limiting factors:

-Diminishing returns. The item just went up in price, and eventually the price will become too high for a profit. Eventually, you're going to hit the supply and demand curves.

-Competition. People generally sell stuff at a competitive price. If you raise the price when you resell it, you risk the price becoming too high to be competitive. People may ask "why should I buy it from you when I can get it from somebody else cheaper?"

--This is why monopolies are generally shunned in free market economics - by removing competition, a limiting factor is released and can often lead to high prices. In a business where demand is practically guaranteed (ie, seen as a need and not a want), the prices can even go up to insane amounts.

-Finite resources. Once you sell the object, it generally won't be sold back to you, and if it is, it will be at an increased price. Ultimately, you only have so many things to sell, and that places a limit on how much money you can get from selling stuff.

-Even money is a finite resource in our economic system. It moves from place to place, but the government has tight reigns on how much money is in circulation.

I'm not saying you've got to implement all of this, but understanding economics may allow developers to make internal (and hopefully invisible) changes to the way the game's internal trading system works so that the game is a lot harder to "exploit."


In conclusion:
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.


I have to disagree with this statement. There are many ways to prevent "exploits."

Ultimately, this is an issue of game economics, and how well the AI can use the economics of the game. The problem isn't exploits - the problem is that we humans are currently a whole lot better at economics than the AI is. Increase the AI's intelligence at setting prices, make it more aware of the game's economics (implement some real AI), and it'll be much better at making good deals at the trade screen. You'll be left wondering why you ever implemented the weights system in the first place .

In addition, make the AIs trade a lot more between themselves. A player may be less tempted to "exploit" the system if the player knows that there is competition going on, and that the AI is at least as likely to get stuff from another AI than from the player.

Edit: And this has actually worked for me in a very interesting way . By substantially increasing my own profits and research, and by sharing my wealth and knowledge with friendly AIs, I have often fought a "proxy war" where I win because I make my allies so powerful compared to my enemies. I've won many scenarios this way, with only a defensive military and letting my allies do all of the offensive work. Since I don't have to use resources maintaining a large military, it only increases my economic and scientific potential.
on Apr 20, 2007
The AI gives -way- too much value to some things. It absolutely will not trade away ships, influence points, or starbases unless you give an unbelievable offer. Even with high diplomacy, it will expect what seems like 10x (or more) bc for a ship than the ship cost to build. It's easier to buy planets and techs to build your own versions of those ships than to buy the ships themselves.

On the flipside, the AI will trade off trade goods like aphrodesiac and micro repair bots for peanuts.
on Apr 20, 2007
generally when it gets to large trades it gets a little wacky. I think I remember a game where I was winning a war, but I decided I didn't really want to be fighting it. So I offered some stuff for a peace treaty, they responded negative. I tried adding more stuff just to see how much they thought a peace treaty was worth --- I ended up putting (just to see) all of my ships, planets, bc, influence, and technology against a peace treaty, and they still didn't want it.
on Apr 20, 2007
I found that if my military is far stronger than my enemy's, I get much better peace treaties. Easiest way is just to go around and knock off all his orbiters.
on Apr 21, 2007
Peace Treaties are the biggest flaw in the system IMHO. The aI is losing planets by the bucketful, but until your military ranking is much greater than theirs they will not even entertain an offer.

If you do get a treaty, because their attitude towrdsd you stays low, they are prone to declare war again almost immediately, usually sealing their doom. Just because they have a high ranking due to defenders in orbit, does not mean they are strong militarily.

Also, if they are way on the other side of the map, well beyond practical reach, they will stay at war forever. More of an annoyance - except the aI will try and send their 3 speed ships towards you - leaving them defenseless if another aI that is closer attacks them.

The algorythms for peace treaties should be changed to reflect more than the military ranking, and should reflect the offensive ranking more heavily, defenders in orbit are really useless and very vulnerable and weigh too heavily in the ranking; - how this can be done is beyond me.
on Apr 23, 2007
I ran into this in a game over the weekend. I was kicking butt and taking names, but the only way I negotiate peace was to offer one of my planets! Yeah - they had a lot of defenders (hp-8) ships in orbit and only one or two fleets poking about, while I had a couple capital ships wrecking havoc.

I even got a message from my own "adviser" that the war was going going badly because the numbers comparing my military and economy with the AI's were much lower.

I think the way to evaluate this is to first make a comparison of strongest ships vs weakest ships. If the player's ships are stronger than the best ships the AI can possibly make, then the AI should seek peace.

If the ships are equal strength, the system should only count the ships within a reasonable range of that value, and ignore the weaklings (and especially ignore the 1-hp utility ships).

Another evaluation is productivity. Make an evaluation of the civ's productivity during the course of the war - how many new ships have come on line? If the player's number is higher than the AI's, the AI should realize that it doesn't have a chance and should seek peace.

The final thought here - the AI should set a goal when attacking another race (player or AI) of what it wants to accomplish - such as take X number of worlds, or destroying X number of enemy ships, or removing certain starbases from its territory. It should also decide how long it wants to be in this particular war (or conflict). If it has achieved it's goals, then it should call for peace and ask the opponent for concessions. If it hasn't achieved its goals within the selected time-frame, then it should seek peace and offer some kind of concession.
on Apr 23, 2007
I would call it AI situational awareness.


Yup. I agree. The value of goods changes based on what the current situation is, and the game doesn't do that. Which is exactly what you said.

But it's not. It's basically just a dialog full of weighted values.


But if the AIs could take the situation into account, oh, that would be beautiful.

And then, while we're wishing, could you make a patch that reduces my need for sleep, please?   

3 Pages1 2 3