Announcement

Collapse
No announcement yet.

IMPROVED version of DIPLOMOD

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • IMPROVED version of DIPLOMOD

    Here:

    IMPROVED BY: player1
    Added:
    -WarOver script: AI vs AI wars end after 50 turns
    -Embassies more often (3x times)
    -Diplomatic personality chage 30% more often

    Thanks to Dale for original diplomod.slc

    EDIT:

    Version 1.1
    Added:
    -WarOver script: AI vs AI wars end after some time
    11-20 turns in war: 2% end war chance (per turn)
    21-30 turns in war: 4% end war chance
    31-40 turns in war: 6% end war chance
    41-50 turns in war: 8% end war chance
    51 turns or more in war: 10% end war chance

    Thanks to janixx and Immortal Wombat for suggestions.


    EDIT:

    Version 1.15
    Added:
    -Ending War sets regard between AIs to +250
    (so AIs wont declare war on each other next turn)

    EDIT:

    Version 1.2 improved by Martin Guhmann
    Added:
    -Better MP support
    Attached Files
    Last edited by player1; November 22, 2001, 09:19.

  • #2
    AI vs AI war shouldn't end after 50 turns. Maybe it could be a some kind of random number between x and y
    Jani

    Comment


    • #3
      Maybe.

      For example:

      11-20 turns in war: 1% end war chance
      21-30 turns in war: 2% end war chance
      31-40 turns in war: 3% end war chance
      41-50 turns in war: 4% end war chance
      50 turns or more in war: 5% end war chance

      Any ideas?
      Last edited by player1; September 26, 2001, 06:41.

      Comment


      • #4
        Hey cool

        I think perhaps the personalities shouldn't change too much, but as long as the AI isn't constantly switching priorities and never gets anything done, it should be alright.

        Maybe.

        For example:

        11-20 turns in war: 1% end war chance
        21-30 turns in war: 2% end war chance
        31-40 turns in war: 3% end war chance
        41-50 turns in war: 4% end war chance
        50 turns or more in war: 5% end war chance

        Any ideas?
        I'd double those percentages, because long AI vs AI wars are boring for the player, and make it easier to clean up through the other end of the empire.
        Concrete, Abstract, or Squoingy?
        "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

        Comment


        • #5
          Originally posted by Immortal Wombat
          I think perhaps the personalities shouldn't change too much, but as long as the AI isn't constantly switching priorities and never gets anything done, it should be alright.
          In original diplomod v3.6 it changed DIPLOMATIC personality (not STRATEGIC) aproximately once in 150 turns. I changed it to 100 turns.

          I'd double those percentages, because long AI vs AI wars are boring for the player, and make it easier to clean up through the other end of the empire.
          Maybe you'r right. Sometimes after ending of war AI starts new one against same opponent.

          Comment


          • #6
            Version 1.1 is out!
            Look at the top of the thread.

            Comment


            • #7
              How about making AIs swap techs with each other when they're behind and making the chances of this happening increase the farther they are behind. Bluevoss suggested this in the medmod thread, and I thought it was a good Idea.

              Also, In MedMod AIs are going broke, but they don't ask for money. How about making them ask for money once they get below 10,000 gold. I like the war Idea, how about making it so if one of the civs has lost more than 3 or 4 cities, the victim starts sending cease fires, and the atacker starts to consider it.

              Edit: I was just reading diplomod(yes, I can read slic, just can't write it well) and saw DIP_request == number. It tells the AI to consider a proposal, but I don't know which proposals represent what number. Could someone tell me what number represents which proposal? I read all the readmes for for diplomod, and can't find this anywhere.
              Last edited by Cube; September 26, 2001, 17:46.

              Comment


              • #8
                One thing I almost had working at the end (before I gave up on the MODding due to time restrictions) was this.

                - Set a global counter to keep track of how many times the Human declares war. Let's call this the BadBoy Rating.
                - When the BB rating got to a certain level, pick the top two AI's known by the Human and force them to declare war on the Human. These AI's would have a forced trust/regard bonus put on them to increase the chance of combined efforts.
                - At certain levels of the BB more and more AI's are forced to declare war on the Human till ALL AI's are at war with the Human. Sort of like Europa's BB rating.

                Here's my table I came up with:

                - 2 war declarations: 2 AI's declare war on Human.
                - 4 war declarations: 3 AI's declare war on Human.
                - 7 war declarations: 5 AI's declare war on Human.
                - 10 war declarations: ALL AI's declare war on Human.

                I almost had it working. The good thing with this method is that since the AI would actually create armies and attack in the three big MODs (AP, MM2 & Cradle), this will force the Human into a war against numerous AI's simulately allied attacks.

                However, I ran out of time to implement it.

                Comment


                • #9
                  Originally posted by Dale
                  One thing I almost had working at the end (before I gave up on the MODding due to time restrictions) was this.

                  - Set a global counter to keep track of how many times the Human declares war. Let's call this the BadBoy Rating.
                  - When the BB rating got to a certain level, pick the top two AI's known by the Human and force them to declare war on the Human. These AI's would have a forced trust/regard bonus put on them to increase the chance of combined efforts.
                  - At certain levels of the BB more and more AI's are forced to declare war on the Human till ALL AI's are at war with the Human. Sort of like Europa's BB rating.

                  Here's my table I came up with:

                  - 2 war declarations: 2 AI's declare war on Human.
                  - 4 war declarations: 3 AI's declare war on Human.
                  - 7 war declarations: 5 AI's declare war on Human.
                  - 10 war declarations: ALL AI's declare war on Human.

                  I almost had it working. The good thing with this method is that since the AI would actually create armies and attack in the three big MODs (AP, MM2 & Cradle), this will force the Human into a war against numerous AI's simulately allied attacks.

                  However, I ran out of time to implement it.
                  There is a problem:
                  -Even in such War againt Human, AI's will make AI vs AI Wars, so I need
                  a way to force alliance between AI's
                  Any ideas?

                  Dale, can you give me that code.
                  Post it here!

                  Comment


                  • #10
                    Does anybody know how to:
                    -force AI's to make AI vs AI treaties
                    (or even consider them)

                    "
                    if (that) {
                    force peace betwen AI1 & AI2
                    }
                    "
                    You get the idea.


                    P.S. I Know how to force canceling of agreements. That's done in War
                    Over script (canceling "war agreement")

                    Comment


                    • #11
                      Originally posted by Cube
                      I was just reading diplomod(yes, I can read slic, just can't write it well) and saw DIP_request == number. It tells the AI to consider a proposal, but I don't know which proposals represent what number. Could someone tell me what number represents which proposal? I read all the readmes for for diplomod, and can't find this anywhere.
                      Look in aidata folder.
                      There is file diplomacy-test.txt

                      Comment


                      • #12
                        There is no way to force the AI to do anything. What you can do is use the LogRegardEvent function to make the AIs very nice and respectful towards each other. If you do this to both AIs in question, you can get them to have a greater chance of accepting each others proposals.
                        Concrete, Abstract, or Squoingy?
                        "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

                        Comment


                        • #13
                          AI - AI treaties/alliances

                          AI treaties/alliances

                          This is how CTP2 works for AI-AI treaties/alliances:

                          - For alliance to even be considered, trust AND regard must be over 400. (AI loves and trusts you)
                          - For normal treaties (except withdraw and peace), trust AND regard must be over 150. (AI likes and respects you)
                          - For everything else, trust AND regard must be over -250.
                          - Anything under -250 is war and embargo and demands.

                          There ARE exceptions to the rules though. The AI diplomacy is not as stupid as it makes itself seem. It will usually accept things that it needs (though the human might not be able to determine why it needs it [see below for explanation of requesting what you just offered]). Hence why some diplomacy tactics of the AI seem stupid.

                          SLICing AI diplomacy

                          When it comes to SLICing the AI's proposals, there is NO way we can force the AI into anything. All we can do is try to make the proposal so good that it can't refuse. Hence the "request priority". If we make regard, trust and the request priority high enough, the AI will consider anything. However, this still doesn't guarentee it'll accept. That is determined by the overall goals and wishes of the AI. I don't know any way to affect the goals and wishes of the AI. BTW, these are not the strategic goals and wishes. The overall goals and wishes of the AI determine which strategy-stance, diplomacy-stance, eco-stance, science-stance, military-stance, etc is used. All we can do is influence the decisions of an AI into a certain way. For example, we can't tell the AI which strategic goal to use from goals.txt, but we can make it extremely attractive. This is the same for diplomacy.txt and the others. It's a pity really. The overall top-level is THE one level we could make the biggest leaps in AI advancement.

                          AI offers back what it just refused

                          The AI tries to max out the regard/trust bonuses. This causes the "Human requests blah refused, AI offers blah back accepted". When a human initiates certain proposals, the AI doesn't get any regard/trust change. The AI will refuse and propose the same thing in opposite terms if IT gets the regard/trust bonus.

                          EG: Human offers maps for AI's maps. No regard/trust bonus for AI, Human gets the regard/trust bonus. AI refuses and offers maps for Human maps. AI gets the regard/trust bonus, Human gets no bonus.

                          Influencing the AI's diplomacy

                          This is where my theory on what to do in SLIC to force the AI into things comes in.

                          - We know we can't "tell" an AI what to do, only influence it.
                          - We know that the AI requires certain levels of trust/regard before certain proposals are even considered.
                          - We know that the AI considers things via it's overall goals and wishes based on priorities.
                          - We know that AI diplomacy is always trying to max out trust/regard bonuses for it.

                          If we add all these points together, we get a very clear picture on how the AI can be influenced a lot better. This is where I was heading with the Diplomod. By changing values in the settings of the AI's diplomacy I was trying to make certain proposals look so attractive it couldn't refuse. All through the Diplomod are examples of where I've tried to influence the AI's into more realistic diplomacy using the above 4 points, but sometimes CTP2's bugs/deficiencies got in the way. I believe I got extremely close to what we needed for CTP2, but AI-AI alliances always alluded me. I did get the AI proposing AI-Human alliances though, that's something new in Civ-genre games.

                          I hope all this helps out in some way.

                          Comment


                          • #14
                            Ripped from an old tread (apolyton pack v1.0, page 2) by Petter Triggis:

                            "What I would have liked to do is to add a new New Proposal: Embassy Treaty."

                            ...


                            "Next, to get the AI to send a request to establish mutual diplomatic relations, I used the ReactionMotivation event:


                            code:--------------------------------------------------------------------------------
                            HandleEvent(ReactionMotivation)'NewDipProposal' pre {

                            if (!HasAgreement(player[0], player[1], 37) && !AtWarWith(player[0],player[1])
                            && HasAdvance(player[0], ID_ADVANCE_BUREAUCRACY)
                            && HasAdvance(player[1], ID_ADVANCE_BUREAUCRACY) ){

                            ConsiderNewProposal(player[0].owner,playe[1].owner,2000,37,0,ID_NONE,ID_NONE,ID_NONE);
                            }
                            }

                            --------------------------------------------------------------------------------


                            So if they don't have embassys and aren't at war, then as soon as player[0] gets BUREAUCRACY (and player[1] already has it), player[0] will send a New Proposal to player[1] asking to establish diplomatic relations. Then I intercept this message in the NewProposal event:


                            code:--------------------------------------------------------------------------------
                            int_t first_type; //initial proposal
                            int_t second_type; // 'in exchange' proposal

                            HandleEvent(NewProposal)'RespondToNewProposals' pre {

                            first_type = GetLastNewProposalType(player[0], player[1], 0);
                            second_type = GetLastNewProposalType(player[0], player[1], 1);

                            if ( first_type==37 || second_type == 37 ) {
                            if (!IsHumanPlayer(player[0]) ){
                            Event:Accept(player[0], player[1]);
                            }
                            }
                            }
                            --------------------------------------------------------------------------------


                            As it stands the default condition is to accept. But I want to work out some more responses so that if it's the human player who's sending the proposal, the AI player may counter with a demand for an advance or gold or something. Anyway, having accepted the proposal it only remains to establish embassys:


                            code:--------------------------------------------------------------------------------

                            HandleEvent(Accept)'NewProposalHasBeenAccepted' post {//post

                            first_type = GetLastNewProposalType(player[0], player[1], 0);
                            second_type = GetLastNewProposalType(player[0], player[1], 1);

                            if (first_type == 37 || second_type == 37) {

                            Event:EstablishEmbassy(player[0],player[1]);
                            Event:EstablishEmbassy(player[1],player[0]);
                            }
                            }

                            --------------------------------------------------------------------------------


                            I've just tried this line of thought with the Alliance treaty. It seems to work: you can control when one AI civ will propose an Alliance to another. I guess it's just a matter of writing up the appropriate 'Response logic'. "


                            LOOK last paragraph! It's maybe posible to FORCE AI alliance!

                            Comment


                            • #15
                              Looks like I was wrong about this. What I had in mind was something like:

                              Code:
                              HandleEvent(ReactionMotivation) 'WarAndAllianceProposals'  pre {
                              
                                  if(!IsHumanPlayer(player[0]) && !IsHumanPlayer(player[1])){
                                       if (TurnsAtWar(player[0],player[1])>0) {// 0 for test
                              	      // offer cease-fire
                              	      ConsiderNewProposal(player[0],player[1], 9000,32,0,ID_NONE,ID_NONE,ID_NONE);
                              	 }
                              	 if (HasAgreement(player[0], player[1],32) && !HasAgreement(player[0], player[1],33) ) {
                              	      //if they have a cease-fire but not a peace treaty, offer one
                              	      ConsiderNewProposal(player[0], player[1], 2000, 33, 0,ID_NONE,ID_NONE,ID_NONE);
                              	 }
                              	 if(AtWarWith(player[0],1) && AtWarWith(player[1],1)){// 1 being the Human
                              	      //if both sender and recipient are at war with the Human
                                            if (!HasAgreement(player[0], player[1],33) ) {
                              	      //if they don't have a peace treaty, offer one
                              	           ConsiderNewProposal(player[0], player[1], 2000, 33, 0,ID_NONE,ID_NONE,ID_NONE);
                                            }
                                            if(HasAgreement(player[0], player[1],33) && !HasAgreement(player[0], player[1],38)){
                              	      //if they have a peace treaty but not an alliance, offer one 
                                                 ConsiderNewProposal(player[0], player[1], 2000, 38, 0,ID_NONE,ID_NONE,ID_NONE);
                                            }
                              	 }
                                  }      
                              }
                              In theory this should get AI civs to send proposals to each other, and if you take out the "&& !IsHumanPlayer(player[1])" from the first line, you (the Human) will get these proposals. That's what led me to think that it was just a matter of writing up the response logic: if it's sending the proposals to me it must be sending them to the AI civs. But it's not: they won't send them to each other! The instructions for getting the AI to send new proposals are:

                              At the beginning of every player turn the ReactionMotivation and possibly one or both of the FearMotivation or DesireMotivation events will be triggered. To add a rule which can trigger the sending of a new proposal you should write a SLIC function to handle one of these events. For simplicity it is best to write your handles to be triggered by the ReactionMotivation event. For all of these events, player[0] is the player whose turn it is, and player[1] is the foreigner that would receive the new proposal.

                              You should access the current diplomacy state for the player using the GetNewProposalPriority function and also call any other functions needed to determine whether or not the player should send a particular new proposal.[b] If it is determined that the proposal should be sent, then call the function ConsiderNewProposal. [\b]If multiple calls to ConsiderNewProposal are made, then the proposal with the highest priority will be sent.
                              It seems to me that the above code is consistent with these instructions and I can't see why an AI civ will send one of the above proposals to the Human but not another AI. I tried several things this afternoon to see if I could get at their motivations. For example, I tried defining a new strategy;

                              Code:
                              STRATEGY_GET_OUT_OF_WAR{
                              
                                   //
                                  //  DIPLOMACY
                                  //
                              
                                  // priority for fear motivations
                                  FearInvasion        5000
                                  FearCityDefense     5100
                                  FearPiracy           900
                                  FearScienceRank      800
                                  FearMilitaryRank    4800
                                  FearTradeRank        800
                                  FearPollution        900
                              
                                  // priority for desire motivations
                                  DesireAttack         800
                                  DesireGold           900
                                  DesireScience        900
                                  DesireMakeFriend    1000
                                  DesireEnlistFriend  1100
                              
                              }
                              which has some hugely increased fear motivations and which I loaded in at the appropriate circumstances. But it didn't make any difference.

                              I also tried guessing at the 'ConsiderMotivation' function:

                              Code:
                              HandleEvent(ComputeMotivations)'TestComputeMotivations' pre {
                              
                                 ConsiderMotivation(player[0].owner, 5000, 1);//1=FearInvasion?
                                 ConsiderMotivation(player[0].owner, 1000,11);// 11=DesireMakeFriend?
                              
                                 message(1,'TestComputeMotivationsM');   
                              }
                              but again no luck. And here I'm not sure about what that last parameter does. With different numbers I got the 'Wrong type of argument error'. Does anybody know how this one works?

                              So there you have it. The instructions I quoted above (from the AI Customization via SLIC document) certainly make it look like we ought to be able to get AI civs to send new proposals to each other. If only they'd given some examples!

                              BTW: note that this entails that DIPLOMOD's 'DIP_MainRoutine' handler can't be working properly, it uses the ConsiderNewProposal function in the same way.

                              Comment

                              Working...
                              X