I'm reimplementing an old 4X space-rts game which has diplomacy options. The original was based on a relation scoring system (0..100) and a set of negotiation options (improve relations, alliance, declare war, etc.) The AI player usually had 3 options: yes, maybe and no; each adding or removing some amount to the relation score.

How should the AI chose between the options?

How does the diplomacy work in other games and how are they imlemented?

Any good books/articles on the subject?

(Googling the term diplomacy yields the game Diplomacy, which is unhelpful.)

You might have more luck searching on "goal seeking" for AI works that will give you ideas. GOAP is popular for driving NPCs and could be adapted.
–
Patrick HughesMar 4 '12 at 19:43

I had trouble understanding and adapting GOAP literature for this game before. I went ahead by using heuristics and rule system derived from my and other players' behavior. But I always have to ask first whether proper methods exist before I reinvent the wheel.
–
akarnokdMar 4 '12 at 20:00

I'm not quite sure if I understand this question. Are you saying that result of each option (in relation score difference) is hidden to players and they have to figure out which one is good for them using common sense? And you want to figure out how computer should choose his answer as he obviously doesn't have any common sense?
–
BlueWolfMar 5 '12 at 16:37

@BlueWolf on one hand, computer needs to chose one of the options if the player approaches it: player offers alliance, computer might accept or turn it down. On the other hand, the computer should approach the player from time to time with similar options, e.g., ranging from alliance down to war. The original had already some score points associated with all available diplomatic option and outcome.
–
akarnokdMar 5 '12 at 17:07

Well I don't have much experience with AI, so I might be just guessing here, but can't you create some way to evaluate power of each AI and the player in some sort of score system. For instance assigning points for each ship, depending on how big it is, for amount or resources they have and for their current level of technology. Then perhaps multiplying that with difficulty level of AI so less smart AIs wont go to suicidal rampages all the time. And then just keep those score secret to player but let AIs look at them and based on that decide what to do (with some randomness margin).
–
BlueWolfMar 5 '12 at 17:15

2 Answers
2

You should answer that question from a player's perspective, i.e. if you were the AI player, how would you respond?

If a player offers you an alliance, you evaluate whether that alliance is a good idea. When is an alliance a good idea? When you stand to gain from it. When would you stand to gain from it? For instance when you're currently under threat from other players. Or when the player offering the alliance is a lot stronger than you.

You should attempt to measure these factors (heuristically) and evaluate that into a decision.

With such system with tasks modifiers in place, I think all you would need to do is to take also into account modifier from diplomacy, so for example if ai goes from friendly to neutral then "defend planet" task will get higher priority. This article mentions also filtering tasks which are not appropriate, so you could generate tasks which assumes player as enemy and then filter direct assault tasks in case of pace.

No no, that's the trivial part once the relation scoring is in place: I currently prioritize target based on the relation with that race. What I need is a method or heuristics for the AI to respond to a diplomatic offer from the user. For example. If the AI is in bad shape and the player seems to be formidable, choose a more humble options: accept peace treaty, accept money offer, etc. Or if the AI feels powerful and the player weak, declare war on the player.
–
akarnokdMar 5 '12 at 16:38

In that case you need a way to assess shape of each player - his economy power, military power, etc.. how you do that depends on you and your game, for example military power could be a sum of player ships with their attack, defense and hp taken into account. When you have such assessors ready, you need rules to pick the outcome. They can be static rules like if something and something then something, or they can be implemented as fuzzy logic, or neural networks for classification problems.. I would go with fuzzy logic and mapped response to "yes","no","maybe..give something more" options.
–
KamilMar 5 '12 at 17:37