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.)

  • 1
    \$\begingroup\$ 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. \$\endgroup\$ – Patrick Hughes Mar 4 '12 at 19:43
  • \$\begingroup\$ 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. \$\endgroup\$ – akarnokd Mar 4 '12 at 20:00
  • \$\begingroup\$ 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? \$\endgroup\$ – BlueWolf Mar 5 '12 at 16:37
  • \$\begingroup\$ @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. \$\endgroup\$ – akarnokd Mar 5 '12 at 17:07
  • \$\begingroup\$ 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). \$\endgroup\$ – BlueWolf Mar 5 '12 at 17:15

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.

| improve this answer | |
  • \$\begingroup\$ This sounds a lot like game theory, perhaps that is an area to research as well? \$\endgroup\$ – knight666 Jun 18 '12 at 15:03
  • 1
    \$\begingroup\$ YES! Please don't make it an "if you have 100 good boi points I will accept any of your offers", all games do this, and it leads to the AI being exploited in often enough game-breaking ways. \$\endgroup\$ – Hobbamok Feb 22 '19 at 8:29

I don't know how you plan to implement your ai behavior, but lets assume you are going to implement something as described here: http://www.gamasutra.com/view/feature/1535/designing_ai_algorithms_for_.php?print=1

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.

| improve this answer | |
  • \$\begingroup\$ 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. \$\endgroup\$ – akarnokd Mar 5 '12 at 16:38
  • \$\begingroup\$ 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. \$\endgroup\$ – Kamil Mar 5 '12 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.