Announcement

Collapse
No announcement yet.

Commerce Improvements for AIs

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

  • Commerce Improvements for AIs

    Here a sollution for the problem that the AI never builds commerce improvements like ports, drilling platforms, trading posts, outlet mall, and nature preserves. This code construct such tile improvements automaticly as soon as the AI has enough PW to build them in the city square.

    To install this slic file just unzip the content of this *.zip file into your \ctp2_data\default\gamedata\ directory. And open the the scrip.slc file (of course MM2_scrip.slc for MedPack2 or APOL_script.slc for ApolytonPack, unfortunatly this file is not Cradle comapartible) and add at the end of that file the line:

    #include "MG_ComImpsForAIs.slc"

    All what you have to do after installation of this file: Open the the chat window in the game by typing (') of coarse without the brackets and type /reloadslic.

    -Martin
    Attached Files
    Last edited by Martin Gühmann; October 8, 2001, 12:19.
    Civ2 military advisor: "No complaints, Sir!"

  • #2
    cool,

    I just started a new game in MM2 it's in 2500 BC so starting a new one shouldn't hurt. From what you said this sound pretty random, is there a way to check a cities science rate with slic. how about you explain this, will it stop at a certain time, because if it just builds commerce improvements everywhere that's bad, but I'm sure you though about that right?

    Edit: Just opened the file and read the intro, medmod 2 doesn't allow commerce improvements on hills, but that can be changed. The mm2 advances that allow mall and nature preserve are plastics and ecotopia, and radii change at 9, 36, 44, and 56. I got another problem I have a tree cutting slic that Peter made and Ben edited, and it converts forest and jungles into grassland for the first raduis then terraforms any forest or jungles for the second raduis, so this might not work for me how about making it build on swamps and tundra. they already build there, but not enough.

    I'snt there a way to set priorities through slic for what gets built first?
    Last edited by Cube; September 25, 2001, 14:56.

    Comment


    • #3
      You can only set order to a very limited extent...
      Each handler can fire 'pre' (before) or 'post' (after). The Commerce one above fires 'post'. Check if the treecutters handler has the 'pre' bit or 'post' bit, and get them in the right order.
      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


      • #4
        So far as I know the the treecutter fires when a city grows. I guess I don't have the latest version or your version of the treecutter, therefore I'd like to see it if you would attach your treecutter file here. Of course there are a lot of events that can be used to trigger such actions.

        Here is the list of Events from the slic documentation that occurs every turn once:

        BeginTurn
        WormholeTurn
        PlayerPatience
        PeaceMovement
        PollutionTurn
        BeginTurnAllCities
        BeginTurnProduction
        BeginTurnSupport
        BeginTurnImprovements
        BeginTurnAgreements
        ResetAllMovement
        AttemptRevolt
        BeginTurnEndGame
        BeginTurnGovernment
        FinishBeginTurn
        FinishBuildPhase
        StartMovePhase
        ProcessUnitOrders
        AIFinishBeginTurn
        UnitBeginTurnVision
        BeginTurnUnit
        CityTurnPreProduction
        CityBeginTurn
        CityBeginTurnVision
        BeginTurnArmy
        BeginTurnExecute
        EndTurn

        Maybe not every events of these can be used. And maybe other events works only for the AI. For GoodMod I used this event list to select the events and make shure that the slic code works in the correct order. Of course if you have a code triggered by the BeginTurn event it will be executed first if you have a code that is triggered by the EndTurn event. Than this code is triggered at least.

        Originally posted by Cube
        I just started a new game in MM2 it's in 2500 BC so starting a new one shouldn't hurt.
        It would hurt just to reload slic.

        Originally posted by Cube
        From what you said this sound pretty random, is there a way to check a cities science rate with slic. how about you explain this, will it stop at a certain time, because if it just builds commerce improvements everywhere that's bad, but I'm sure you though about that right?
        Actual it is very stupid. It builds everywere commerce improvements were it is possible and the AI didn't build any other improvements. So if you start a new game AI builds at first some food and production improvements until the necessary advances are discovered. Than the space is filled commerce improvements. Maybe a PW cheat for the AI would help. But I would make it more effective as the one that player 1 offered in the forum maybe by removing the /10. And the handler should fire between the BeginTurn and BeginTurnImprovements Event. So that the PW gained by the PW cheat could be used for other tileimprovements.

        From my last MedPack 2 game (it is a little bit older) I had well developed AI a mass of tile improvements. So it doesn't hurt the AI so much. The bigger problem in MedPack is the happiness problem for AI. Also with maxing out the sliders concerning happiness the AI doesn't build enough happiness buildings to prevent revolutions.

        Originally posted by Cube
        Edit: Just opened the file and read the intro, medmod 2 doesn't allow commerce improvements on hills, but that can be changed. The mm2 advances that allow mall and nature preserve are plastics and ecotopia, and radii change at 9, 36, 44, and 56.
        You are right it is not fully compartible with MedPack 2. The code builds such improvements in MedPack but not very effectively. To custumize that code just use your suggestions concerning citysize and terrains.

        Today I made a more effective version with a longer code maybe it would be better if I use fuctions for it but now it is typed, therefore here is the second version of that code. The advances is that at first only the inner rings of all cities are searched for the propper terrain. After the first round the second cycle is checked and so on. And this time only the terrain tiles that are part of the city radius are used for such tileimprovements.

        -Martin
        Attached Files
        Civ2 military advisor: "No complaints, Sir!"

        Comment


        • #5
          I put in mm2_scenario.slc, so i'm just going to post that. I changed the handler that terraforms the second radius from post to pre, but I don't know what it does.
          Attached Files

          Comment


          • #6
            Originally posted by Martin Gühmann
            Actual it is very stupid. It builds everywere commerce improvements were it is possible and the AI didn't build any other improvements. So if you start a new game AI builds at first some food and production improvements until the necessary advances are discovered. Than the space is filled commerce improvements. Maybe a PW cheat for the AI would help. But I would make it more effective as the one that player 1 offered in the forum maybe by removing the /10. And the handler should fire between the BeginTurn and BeginTurnImprovements Event. So that the PW gained by the PW cheat could be used for other tileimprovements.
            When AI uses 20% PW tax
            Pw-cheat code adds 2*(total AI pop) PW
            Your version would give 20*(total AI pop) PW
            Is'nt that too much.
            For exampe AI has 8 cites size 8, PW tax 20%
            Your version would give 20*64=1280 PW evry turn!
            My setting approximately doubles AI's PW income.
            Your's will make it 11x bigger.

            Comment


            • #7
              Here are the some numbers of my latest game year 1945:

              Player 1

              5351 14 hours#
              4506 12 hours
              3648 10 hours
              2800 8 hours
              1938 6 hours

              Population 1209 55 Cities PW tax 30%


              Player 2

              111 14 hours
              93 12 hours
              76 10 hours#
              56 8 hours
              39 6 hours

              Population 83 3 Cities PW tax 20%


              Player 3

              2022 14 hours
              1708 12 hours
              1385 10 hours#
              1070 8 hours
              704 6 hours

              Population 135 13 Cities PW tax 20%


              Player 4

              307 14 hours 356 at 30% PWtax settings
              259 12 hours
              209 10 hours
              161 8 hours
              107 6 hours#

              Population 118 5 Cities PW tax 25%

              I am exploiting the population as much as possible. The AI doesn't do this. I cure unhappiness with entertainers the AI uses the global sliders. The PW income depends also on the lenght of the workday. The above numbers shows how big the income would be if the players uses different workday settings the setting marked with # are the settings that are used by the players.

              For example player 4 looses more than two thirds of the possible PW income, because of inpropper settings player 3 the civ behind me looses I guesss with the a PW tax of 30% half its possible PW income, because of inpropper settings to cure pollution and unhappiness. And I guess player 3 will reduce its settings in the turns, because of unhappiness. Your PW mod will give player 3 only 2*135PW = 270PW. That is to less in comparision to the loss of more than 1000 PW.

              Better is the calculation for the other AI players in PW gain, but in comparision to the human player it is to less. Of course my empire is much bigger, but that means there is no change for these AIs to be competive in any way. Only player 3 might have a change but my invation army could wipe player 3 out in a certain time. And note an advaced farm cost 500 PW and a trading post 250PW that means that player 2 will never build anything else before I will send some fusion tanks over the little channel.

              So I thing the PW mod must be more effective for such small AIs maybe not ten times bigger but maybe five times.

              -Martin
              Civ2 military advisor: "No complaints, Sir!"

              Comment


              • #8
                For happines improvments try this:
                In startregies.txt in all discovery
                strategies in BUILD_LIST_SEQUENCE_HAPPINESS
                put:

                BuildListSequenceElement {
                Priority 11500 //higher then defense seq. in war
                BuildListSequence BUILD_LIST_SEQUENCE_HAPPINESS
                Bottom 0.1 //just most unhappy cities
                HappyCities
                Advice BUILD_HAPPINESS_ADVICE
                }

                in start strategies put:

                BuildListSequenceElement {
                Priority 1000 //don't build at start
                BuildListSequence BUILD_LIST_SEQUENCE_HAPPINESS
                Bottom 0.1
                HappyCities
                Advice BUILD_HAPPINESS_ADVICE
                }

                so they won't build shrines instead of settlers.


                And in BuildListSequences.txt in
                BUILD_LIST_SEQUENCE_HAPPINESS put:

                BuildListElement { GarrisonUnitBuildList }

                at front, so cities won't be undefended,
                and to make martial law.

                I tried this in my Mod, and AI cities
                have 80+ happines (sometimes).

                Comment


                • #9
                  If human is AI player he would get extra 3627 PW.
                  It's almost the same as human 10hrs PW income.

                  player 2: extra 166 PW, original 76, 14hrs: 111PW
                  player 3: extra 270 PW, original 1385, 14hrs: 2022 PW
                  player 4: extra 195 PW, original 107, 14 hrs: 307 PW

                  All AI benefited in more than 2x bigger PW income,

                  exept player 3.
                  He has 2.5x lower production (original PW)
                  than player 1, but has almost 10x lower
                  population too.
                  How is that possibile?????????

                  There is a question: Is 2x increase enough?
                  At start of the game they pretty quickly build
                  almost all possibile improvments (quicker than
                  human and also before AGR. REV.)

                  Maybe latter in the game, when human player outnambers
                  AI in pop, should be some extra bonus.
                  Maybe after some turn, perheps?

                  Maybe in your new game with this slic, there would
                  not be such huge gap in human vs AIs pop.

                  Maybe it would be a little strage to have small civ
                  with all newest tile improvments built, and yours with
                  maybe 30% of newest improvments.
                  (it's a too obvius CHEAT)

                  P.S: For preveting humans to maximize sliders,
                  chage goverments in govern.txt like this:

                  RationsExpectation XX //depending od gov.
                  PositiveRationsCoef 2
                  NegativeRationsCoef 6
                  WorkdayExpectation XX
                  PositiveWorkdayCoef 2
                  NegativeWorkdayCoef 6
                  WagesExpectation XX
                  PositiveWagesCoef 2
                  NegativeWagesCoef 6

                  It's +2 for lowering sliders & -6 for raising
                  sliders.

                  Comment


                  • #10
                    After considerations, and testing with a new game,
                    I doubled PW bonus (/5).
                    Here it is v1.01
                    Attached Files

                    Comment


                    • #11
                      Originally posted by player1
                      exept player 3.
                      He has 2.5x lower production (original PW)
                      than player 1, but has almost 10x lower
                      population too.
                      How is that possibile?????????
                      Player 3 built a lot more of production improvements than I do.

                      Originally posted by player1
                      P.S: For preveting humans to maximize sliders,
                      chage goverments in govern.txt like this:
                      And how you prevent the AI from maxing out the sliders concerning happiness?


                      -Martin
                      Civ2 military advisor: "No complaints, Sir!"

                      Comment


                      • #12
                        Just make AI to build more happines improvments,
                        like I did (see my earlier post about happines).
                        After that it is even possibile that they max sliders (a little chance).

                        Comment


                        • #13
                          If it's still a problem, lower effect of entertainers to +1 happ. (pop.txt)
                          and lower pollution unhappines by 50% (govern.txt)
                          That way human wouldn't exploit entertainers too much .

                          Comment


                          • #14
                            player1: Settler --> Chieftain

                            Comment


                            • #15
                              I'm going to try those settings, I already put them in, and I'll see if the AI actually builds more happiness buildings. Do I have to start a new game or will it take affect right away. I'm going to start one anyway. I never noticed, but in medmod that priority is used for the bottom 0.5 happy cites. The science priority settings are set for the top 0.8 commerce cities so I changed that to 0.4 commerce cities.

                              Comment

                              Working...
                              X