No announcement yet.

Diplomacy and AI

  • Filter
  • Time
  • Show
Clear All
new posts

  • Diplomacy and AI


    Well, I don't know who is in charge of AI, so I will ask on the forums here. How does the AI currently determine the aggression level against another player based on diplomacy?

    I looked at the code Mark sent out to me, and I didn't like the diplomacy stuff too much. I don't know what I was smoking when I cam up with that, but it must have been pretty good stuff. The code right now is kinda bulky, and hard to use. (I even made Laurent go GRRRR in there somewhere using the diplomacy code. )

    Other than the code structure, which I will leave unmentioned, one thing that bothers me in particular is this diplomatic state deal. Right now, essentially every pair of civs has a value associated with it:

    -1 if the civs are at war
    0 if they are in peace
    1 if they are in an alliance, and
    -999 if they have not had contact yet.

    Uhhh yeah. I don't like that for instance because it mixes the concept of agreements with diplomatic states.

    So if this won't screw with AI too much, I think it would be in order to revise this thing some.

    One idea is as follows: decouple the notion of diplomatic state from the notion of a diplomatic agreement further. Then, we would have only two possible states: war and peace. War is whenever two civs don't have a peace treaty going. The amount of aggression would then be determined by the attitude of the two civs towards each other. If the attitude is real low, then they go for each other's throats, if it is realy good, then they won't really fight each other even though there is no official peace agreement.

    The other idea is to bind the diplomatic state to the treaties closer instead, that is, for each diplomatic state treaty, have a corresponding diplomatic state. Then, there would be peace, war, alliance, armistice, temporary cease-fire, and what-not.

    And this is where the AI comes in. I think that in terms of AI, the first solution would be best. At any given point in time, it could then check: hey, am I at war with civ such-and-such or not?
    o Yes - let's see my attitude towards it. Is it bad? Time to attack. Is it good? Well, I'll let 'em live some more. Maybe I should even offer an official peace treaty?
    o No - let's see the other civ's attitude towards me. Is it bad? Maybe I should defend my territory, because hey could break peace. Is it good? Hey, how about I send them a gift?

    Another reason I like the simplified war/peace idea, is that it still does not restrict you from coding all kinds of fancy treaties. For instance, I can make a cease-fire treaty, which makes peace between two civs, but keeps their attitudes real low, and expires real fast. Or I could make an alliance treaty which makes peace and boosts attitudes.

    Finally, I like the first approach because it makes the game more flexible and configurable, IMO. Here, we can have a choice in each scenario what treaties to include and what to exclude. Maybe we want to have an ancient-times scenario with only the basic peace treaty, and none of the fancy modern diplomatic agreements. We can do that, whereas with the second approach, t would become harder.

    What do you folks think? Also, if anyone can suggest anything else, feel free.
    XBox Live: VovanSim (login required)
    Halo 3 Service Record (I fail at FPS...)
    Spore page

  • #2
    Hi Vovan:

    I do agree that we should handle separately treaty status and diplomatic attitude. AFAIK the diplomatic AI is not very much at this point, and needs to be much more.

    There are discussions of this in the various diplomacy and AI threads going back. There isn't so much on the Diplomacy Page on the web site. If you get a chance, could you link to the most recent discussions in which you had a part? The AI discussion so far is in AI -- the Thread, but the discussion there is heavily tilted toward military AI.

    In Clash D4 and before I had an algorithm for determining a civ's realpolitik power position in the world that could help to determine actions that could bring the civ towards winning the game. It included fundamental evaluation of military (and economic?) power, and relative power in the context of the current alliance structure. When we get to the point of working out a real diplomatic AI that includes treaty negotiations and declarations of war, I'll dust it off. It is my old code, so it is horrible spaghetti code, but the algorithm itself may be useful.
    Project Lead for The Clash of Civilizations
    A Unique civ-like game that will feature low micromanagement, great AI, and a Detailed Government model including internal power struggles. Demo 8 available Now! (go to D8 thread at top of forum).
    Check it out at the Clash Web Site and Forum right here at Apolyton!


    • #3
      Ah, yes, I forgot to link to the previous discussion threads.

      The Revised Diplomacy Model
      The Revised Diplomacy Model: Coding Discussion
      XBox Live: VovanSim (login required)
      Halo 3 Service Record (I fail at FPS...)
      Spore page


      • #4
        The AI currently does little to nothing in terms of diplomacy. It just picks enemies in the list of enemies it's got, and bashes them when they see them (more or less). It's not even to the point of coordinating attacks against a single enemy when fighting against two (well, it may in a limited manner, but it currently lacks a notion of fronts/theaters of operations, as mentionned elsewhere).
        Clash of Civilization team member
        (a civ-like game whose goal is low micromanagement and good AI)
        web site and forum here on apolyton)