Announcement

Collapse
No announcement yet.

Creating AI superpowers

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

  • #16
    OK, got the file without any problem.

    Got some questions regarding the following lines within the SLIC code...
    =================================================
    int_f GetCityLimit(int_t testCiv)
    {
    int_t CityLimit;
    player[0] = testCiv;
    if(player[0].govttype == GovernmentDB(GOVERNMENT_ANARCHY)){
    CityLimit = 1000;
    } elseif(player[0].govttype == GovernmentDB(GOVERNMENT_TYRANNY)){
    CityLimit = 10;
    } elseif(player[0].govttype == GovernmentDB(GOVERNMENT_THEOCRACY)
    || player[0].govttype == GovernmentDB(GOVERNMENT_MONARCHY)
    || player[0].govttype == GovernmentDB(GOVERNMENT_REPUBLIC)) {
    CityLimit = 20;
    } elseif(player[0].govttype == GovernmentDB(GOVERNMENT_COMMUNISM)
    || player[0].govttype == GovernmentDB(GOVERNMENT_DEMOCRACY)
    || player[0].govttype == GovernmentDB(GOVERNMENT_FASCISM)) {
    CityLimit = 35;
    } elseif(player[0].govttype == GovernmentDB(GOVERNMENT_TECHNOCRACY)
    || player[0].govttype == GovernmentDB(GOVERNMENT_CORPORATE_REPUBLIC)) {
    CityLimit = 45;
    } elseif(player[0].govttype == GovernmentDB(GOVERNMENT_VIRTUAL_DEMOCRACY)
    || player[0].govttype == GovernmentDB(GOVERNMENT_ECOTOPIA)) {
    CityLimit = 60;
    }
    return CityLimit;
    }

    // return what generation (age) of governemts is currently available for 'thePlayer'
    // this is a stand-in until the player's government can be found somehow.
    // Based on part of Wouter's MM2 Partisan code.
    int_f GetAge(int_t thePlayer) {
    int_t tmpPlayer;
    tmpPlayer = thePlayer;

    if (HasAdvance(tmpPlayer, ID_ADVANCE_VIRTUAL_DEMOCRACY) && HasAdvance(tmpPlayer, ID_ADVANCE_ECOTOPIA)) { // if player has both diamond govs possible,
    CityLimit = 60; // they will be using one of them
    } elseif (HasAdvance(tmpPlayer, ID_ADVANCE_TECHNOCRACY) && HasAdvance(tmpPlayer, ID_ADVANCE_CORPORATE_REPUBLIC)) { // etc.
    CityLimit = 45;
    } elseif (HasAdvance(tmpPlayer, ID_ADVANCE_DEMOCRACY)){
    if(HasAdvance(tmpPlayer, ID_ADVANCE_COMMUNISM) || HasAdvance(tmpPlayer, ID_ADVANCE_FASCISM)) {
    CityLimit = 35;
    }
    } elseif (HasAdvance(tmpPlayer, ID_ADVANCE_MONARCHY)){
    if(HasAdvance(tmpPlayer, ID_ADVANCE_THEOCRACY) || HasAdvance(tmpPlayer, ID_ADVANCE_BUREAUCRACY)) {
    CityLimit = 20;
    }
    } else {
    CityLimit = 10;
    }
    return CityLimit;
    }
    =================================================
    Since Cradle has a bunch of new governments, what do I need to do with the above code to accurately reflect Cradle's government - especially if there are a lot of max. city variance within the governments that belong to the same age?




    And the following question about the code posted below...
    =================================================

    int_f IsDecentAdvance(int_t AdvanceID)
    {
    if(AdvanceID == AdvanceDB(ADVANCE_GUNPOWDER)
    || AdvanceID == AdvanceDB(ADVANCE_INDUSTRIALIZATION)
    || AdvanceID == AdvanceDB(ADVANCE_TANK_WARFARE)
    || AdvanceID == AdvanceDB(ADVANCE_ADVANCED_INFANTRY_TACTICS)
    || AdvanceID == AdvanceDB(ADVANCE_FLIGHT)){
    return 1;
    }
    else {
    return 0;
    }
    }
    =================================================
    Are these the advances that can potentially enable the code to kick in?
    Yes, let's be optimistic until we have reason to be otherwise...No, let's be pessimistic until we are forced to do otherwise...Maybe, let's be balanced until we are convinced to do otherwise. -- DrSpike, Skanky Burns, Shogun Gunner
    ...aisdhieort...dticcok...

    Comment


    • #17
      Right.

      The int_f GetCityLimit function doesn't work. I was trying to make a string ("text") equal a number. Not possible unfortunately.

      So that code is in there in case I find a workaround.

      the int_f GetAge function is the one that is being used. If you could post, or email me a list of Cradle governments and their respective city limits, I will try to get some code to work it out, based on the personality, strategy being used and governments available to guess (as accurately as possible) what government the AI is using.

      Are these the advances that can potentially enable the code to kick in?
      Yes. I didn't know what to put, and I figured everyone would want to customise anyway. So, to add extra ones, add a copy of the line:
      Code:
      || AdvanceID == AdvanceDB(ADVANCE_TANK_WARFARE)
      In between the first and last ones, with the ADVANCE_TANK_WARFARE changed to the Advance.txt name for the advance you want.

      Similarly taking them out, just delete them, but note deleting the first and last ones is slightly harder, though I think even you could figure out the logic of the code to work out how to take them out.
      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


      • #18
        Originally posted by Immortal Wombat
        If you could post, or email me a list of Cradle governments and their respective city limits, I will try to get some code to work it out, based on the personality, strategy being used and governments available to guess (as accurately as possible) what government the AI is using.
        I guess I should of read further up in the post to see the note about that part of the code not working...

        Anyhow, here are the Cradle lists.

        (Below are the Cradle Governments max cities settings)

        Ancient
        GOVERNMENT_ANARCHY - 75 max cities
        GOVERNMENT_TYRANNY - 10 max cities
        GOVERNMENT_DYNASTY - 10 max cities
        GOVERNMENT_CITY_STATE - 15 max cities

        Bronze/Iron
        GOVERNMENT_OLIGARCHY - 20 max cities
        GOVERNMENT_REPUBLIC - 20 max cities
        GOVERNMENT_DICTATORSHIP - 25 max cities
        GOVERNMENT_TRIBUNAL_EMPIRE - 30 max cities

        Medieval
        GOVERNMENT_MONARCHY - 35 max cities
        GOVERNMENT_THEOCRACY - 40 max cities
        GOVERNMENT_CALIPHATE - 40 max cities

        Modern
        GOVERNMENT_DEMOCRACY - 50 max cities
        GOVERNMENT_COMMUNISM - 50 max cities
        GOVERNMENT_FASCISM - 50 max cities

        Future
        GOVERNMENT_CORPORATE_REPUBLIC - 55 max cities
        GOVERNMENT_TECHNOCRACY - 60 max cities
        GOVERNMENT_VIRTUAL_DEMOCRACY - 65 max cities
        GOVERNMENT_ECOTOPIA - 70 max cities



        (Below are the Cradle Strategies Government lists)

        DEFAULT
        // GOVERNMENT SETTING
        //
        Government GOVERNMENT_CORPORATE_REPUBLIC
        Government GOVERNMENT_FASCISM
        Government GOVERNMENT_CALIPHATE
        Government GOVERNMENT_TRIBUNAL_EMPIRE
        Government GOVERNMENT_DICTATORSHIP
        Government GOVERNMENT_REPUBLIC
        Government GOVERNMENT_DYNASTY
        Government GOVERNMENT_TYRANNY

        // other governments
        // Government GOVERNMENT_TECHNOCRACY
        // Government GOVERNMENT_ECOTOPIA
        // Government GOVERNMENT_VIRTUAL_DEMOCRACY
        // Government GOVERNMENT_DEMOCRACY
        // Government GOVERNMENT_COMMUNISM
        // Government GOVERNMENT_MONARCHY
        // Government GOVERNMENT_THEOCRACY
        // Government GOVERNMENT_OLIGARCHY
        // Government GOVERNMENT_CITY_STATE


        BARBARIAN
        // GOVERNMENT SETTING
        //
        // good for war
        Government GOVERNMENT_TECHNOCRACY
        Government GOVERNMENT_CORPORATE_REPUBLIC
        Government GOVERNMENT_FASCISM
        Government GOVERNMENT_COMMUNISM
        Government GOVERNMENT_MONARCHY
        Government GOVERNMENT_TRIBUNAL_EMPIRE
        Government GOVERNMENT_DICTATORSHIP
        Government GOVERNMENT_OLIGARCHY
        Government GOVERNMENT_DYNASTY
        Government GOVERNMENT_TYRANNY

        // other governments
        // Government GOVERNMENT_ECOTOPIA
        // Government GOVERNMENT_VIRTUAL_DEMOCRACY
        // Government GOVERNMENT_DEMOCRACY
        // Government GOVERNMENT_CALIPHATE
        // Government GOVERNMENT_THEOCRACY
        // Government GOVERNMENT_REPUBLIC
        // Government GOVERNMENT_CITY_STATE


        SCIENTIST_DEFAULT
        // GOVERNMENT SETTING
        //
        Government GOVERNMENT_VIRTUAL_DEMOCRACY
        Government GOVERNMENT_TECHNOCRACY
        Government GOVERNMENT_DEMOCRACY
        Government GOVERNMENT_CALIPHATE
        Government GOVERNMENT_TRIBUNAL_EMPIRE
        Government GOVERNMENT_REPUBLIC
        Government GOVERNMENT_CITY_STATE
        Government GOVERNMENT_DYNASTY
        Government GOVERNMENT_TYRANNY

        // other governments
        // Government GOVERNMENT_ECOTOPIA
        // Government GOVERNMENT_CORPORATE_REPUBLIC
        // Government GOVERNMENT_COMMUNISM
        // Government GOVERNMENT_FASCISM
        // Government GOVERNMENT_THEOCRACY
        // Government GOVERNMENT_MONARCHY
        // Government GOVERNMENT_DICTATORSHIP
        // Government GOVERNMENT_OLIGARCHY


        MILITARISTIC_DEFAULT
        // GOVERNMENT SETTING
        //
        // good for war
        Government GOVERNMENT_TECHNOCRACY
        Government GOVERNMENT_CORPORATE_REPUBLIC
        Government GOVERNMENT_FASCISM
        Government GOVERNMENT_COMMUNISM
        Government GOVERNMENT_MONARCHY
        Government GOVERNMENT_TRIBUNAL_EMPIRE
        Government GOVERNMENT_DICTATORSHIP
        Government GOVERNMENT_OLIGARCHY
        Government GOVERNMENT_DYNASTY
        Government GOVERNMENT_TYRANNY

        // other governments
        // Government GOVERNMENT_ECOTOPIA
        // Government GOVERNMENT_VIRTUAL_DEMOCRACY
        // Government GOVERNMENT_DEMOCRACY
        // Government GOVERNMENT_CALIPHATE
        // Government GOVERNMENT_THEOCRACY
        // Government GOVERNMENT_REPUBLIC
        // Government GOVERNMENT_CITY_STATE


        ECONOMIC_DEFAULT
        // GOVERNMENT SETTING
        //
        // good for war
        Government GOVERNMENT_VIRTUAL_DEMOCRACY
        Government GOVERNMENT_CORPORATE_REPUBLIC
        Government GOVERNMENT_DEMOCRACY
        Government GOVERNMENT_THEOCRACY
        Government GOVERNMENT_TRIBUNAL_EMPIRE
        Government GOVERNMENT_OLIGARCHY
        Government GOVERNMENT_DYNASTY
        Government GOVERNMENT_TYRANNY

        // other governments
        // Government GOVERNMENT_ECOTOPIA
        // Government GOVERNMENT_TECHNOCRACY
        // Government GOVERNMENT_FASCISM
        // Government GOVERNMENT_COMMUNISM
        // Government GOVERNMENT_CALIPHATE
        // Government GOVERNMENT_MONARCHY
        // Government GOVERNMENT_DICTATORSHIP
        // Government GOVERNMENT_REPUBLIC
        // Government GOVERNMENT_CITY_STATE


        ECOTOPIAN_DEFAULT
        // GOVERNMENT SETTING
        //
        Government GOVERNMENT_ECOTOPIA
        Government GOVERNMENT_DEMOCRACY
        Government GOVERNMENT_THEOCRACY
        Government GOVERNMENT_TRIBUNAL_EMPIRE
        Government GOVERNMENT_DICTATORSHIP
        Government GOVERNMENT_REPUBLIC
        Government GOVERNMENT_CITY_STATE
        Government GOVERNMENT_DYNASTY
        Government GOVERNMENT_TYRANNY

        // other governments
        // Government GOVERNMENT_VIRTUAL_DEMOCRACY
        // Government GOVERNMENT_TECHNOCRACY
        // Government GOVERNMENT_CORPORATE_REPUBLIC
        // Government GOVERNMENT_COMMUNISM
        // Government GOVERNMENT_FASCISM
        // Government GOVERNMENT_CALIPHATE
        // Government GOVERNMENT_MONARCHY
        // Government GOVERNMENT_OLIGARCHY


        DIPLOMATIC_DEFAULT
        // GOVERNMENT SETTING
        //
        Government GOVERNMENT_VIRTUAL_DEMOCRACY
        Government GOVERNMENT_CORPORATE_REPUBLIC
        Government GOVERNMENT_COMMUNISM
        Government GOVERNMENT_CALIPHATE
        Government GOVERNMENT_TRIBUNAL_EMPIRE
        Government GOVERNMENT_REPUBLIC
        Government GOVERNMENT_CITY_STATE
        Government GOVERNMENT_DYNASTY
        Government GOVERNMENT_TYRANNY

        // Government GOVERNMENT_ECOTOPIA
        // Government GOVERNMENT_TECHNOCRACY
        // Government GOVERNMENT_FASCISM
        // Government GOVERNMENT_THEOCRACY
        // Government GOVERNMENT_MONARCHY
        // Government GOVERNMENT_DICTATORSHIP
        // Government GOVERNMENT_OLIGARCHY


        Hope this helps
        Yes, let's be optimistic until we have reason to be otherwise...No, let's be pessimistic until we are forced to do otherwise...Maybe, let's be balanced until we are convinced to do otherwise. -- DrSpike, Skanky Burns, Shogun Gunner
        ...aisdhieort...dticcok...

        Comment


        • #19
          Thanks Dave, that's great

          Oh, does Cradle modify personalities.txt?
          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


          • #20
            Originally posted by Immortal Wombat
            Oh, does Cradle modify personalities.txt?
            Some small changes to the settings (I do not remember exactly what I had changed - but I am sure that I changed all expansion settings to 'Maximum'), but I did not add any new personalities.
            Yes, let's be optimistic until we have reason to be otherwise...No, let's be pessimistic until we are forced to do otherwise...Maybe, let's be balanced until we are convinced to do otherwise. -- DrSpike, Skanky Burns, Shogun Gunner
            ...aisdhieort...dticcok...

            Comment


            • #21
              Good. In which case, this code should do the trick.
              I've put it in a separate file to avoid cluttering, as it takes up a lot of lines for what it actually does.
              Its here

              The updated MergeCivs file which you will need also, is here
              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


              • #22
                If anyone downloaded the file yesterday, it had a typo in it, which is now fixed. But you'll need to get it again.
                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


                • #23
                  Which file should I redownload???

                  I downloaded the 'Cradle' version about 3 hours ago and made some alts to it (enable advances), so if you can point out where the error is, I can fix it at my end. I want to make sure that I can launch the game on my setup before posting the final 'Cradle' version.

                  BTW, this next 'Cradle' update will also include the Hurricane code - though it does not seem to be working on my end. I have not seen a Hurricane actually attack anything yet in playtesting. Still, if this can be fixed, the file can be easily updated - as it stands now, the file does not cause any crashes.

                  I get the hurricanes forming on one turn and then crashing and burning the following turn without attacking anything.
                  Yes, let's be optimistic until we have reason to be otherwise...No, let's be pessimistic until we are forced to do otherwise...Maybe, let's be balanced until we are convinced to do otherwise. -- DrSpike, Skanky Burns, Shogun Gunner
                  ...aisdhieort...dticcok...

                  Comment


                  • #24
                    Originally posted by hexagonian
                    Which file should I redownload???
                    The Cradle version IW_citylimits.slc linked to in the post previously.

                    It had if(IsMilitaristic(tmpPlayer)){
                    where is should have been if(IsScientist(tmpPlayer)){
                    It wouldn't cause a crash, just fail to accuratly deal with scientist AIs.

                    BTW, this next 'Cradle' update will also include the Hurricane code - though it does not seem to be working on my end. I have not seen a Hurricane actually attack anything yet in playtesting. Still, if this can be fixed, the file can be easily updated - as it stands now, the file does not cause any crashes.

                    I get the hurricanes forming on one turn and then crashing and burning the following turn without attacking anything.
                    This is bugging me... What size map, and what barbarian settings are you using? It seems the hurricanes only go places they can get to within their movement points.


                    also, if Cradle is running Dale's Air Unit script, find (in the AirMove handler) the line:
                    Code:
                    if(!(IsHumanPlayer(player[3]))) {
                    and replace it with
                    Code:
                    if(!IsHumanPlayer(player[3]) && player[3] != 0) {
                    That way the barbarian storms won't turn around at critical moments.
                    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


                    • #25
                      OK, fixed the citylimits file...

                      Regarding the Hurricanes:

                      I was running the test in the cheat mode on a small map with 3 civs. I ran the test both with barbarians and without barbarians. (originally I ran the test without and noticed the crash/burn, then I thought that I needed to have the barbarians in the game - same results though) I had also tried to increase the movement to 12, vision to 20 and fuel to 48 without success.

                      I am using Dale's code. Is this change to be made in his code (no lines in his code resemble the suggested change) or to your code? (the closest line in your code is the following

                      int_T i;
                      ND_H_NumPlayers = preference("NumPlayers"); // find human...
                      for(i = 1; i < ND_H_NumPlayers; i = i + 1){
                      if(IsHumanPlayer(i)){
                      ND_H_HUMAN = i;
                      }
                      }

                      }
                      Last edited by hexagonian; February 14, 2002, 16:15.
                      Yes, let's be optimistic until we have reason to be otherwise...No, let's be pessimistic until we are forced to do otherwise...Maybe, let's be balanced until we are convinced to do otherwise. -- DrSpike, Skanky Burns, Shogun Gunner
                      ...aisdhieort...dticcok...

                      Comment


                      • #26
                        Originally posted by hexagonian
                        I am using Dale's code. Is this change to be made in his code (no lines in his code resemble the suggested change) or to your code? (the closest line in your code is the following
                        In his code. The player definition may be different, that is the line from the MedMod version I had handy.

                        If you can't find it, don't worry. I just realised, it won't affect the Hurricanes, they are not defined in the code as "Air Units".

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


                        • #27
                          I tried to run a test last night with the mergeciv SLIC and got a slew of SLIC error messages.

                          mergeciv.slc 16 Symbol NUMPLAYERS
                          (I forgot to copy down the rest of the message)

                          mergeciv.slc 48 No Function named IS/W_MC_HumanPlayer

                          mergeciv.slc 163 Syntax error
                          .
                          .
                          .
                          mergeciv.slc 171 Synax error

                          mergeciv.slc 320 Variable 'CityLimit' used in assignment has unknown type.

                          ...and so forth.

                          Several things I did to the file though I do not think these changes would cause the crashes (these are standard SLIC changes)...
                          - change the enable Advances to reflect Cradle advances
                          - Change the prefix name of both SLIC files to CRA_ since these files have changes to them that reflect the Cradle Mod
                          - Change the names in script.slc to reflect the name changes
                          - Change the
                          #include "IW_citylimits.slc"
                          in the mergeciv.slc file to
                          #include "CRA_citylimits.slc"

                          Hope this will help. Do you still have Cradle setup at your end? This might help in the testing.
                          Yes, let's be optimistic until we have reason to be otherwise...No, let's be pessimistic until we are forced to do otherwise...Maybe, let's be balanced until we are convinced to do otherwise. -- DrSpike, Skanky Burns, Shogun Gunner
                          ...aisdhieort...dticcok...

                          Comment


                          • #28
                            Oops, probably should have debugged it. I'll post a corrected file in a few hours.
                            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


                            • #29
                              Ben,

                              Any luck on this...

                              BTW, my computer is down at home (the monitor fried out - its on warranty, so I have to wait a couple of weeks to get a replacement) so I cannot check to see if any code you provide will be compatible.

                              Man, I'm going through withdrawl

                              Still, if you have something to post, go ahead.
                              Yes, let's be optimistic until we have reason to be otherwise...No, let's be pessimistic until we are forced to do otherwise...Maybe, let's be balanced until we are convinced to do otherwise. -- DrSpike, Skanky Burns, Shogun Gunner
                              ...aisdhieort...dticcok...

                              Comment


                              • #30
                                Oh dammit, yeah, I ran against some wierd stuff. Then I decided to download Cradle and test it against the most recent setup, and some of Martin's code was giving me some trouble.
                                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

                                Working...
                                X