Announcement

Collapse
No announcement yet.

Happy Buildings for AIs

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

  • #16
    It only happens in the early stage of the game where the computer player builts cities untill no space is left.
    I dont think they have monarchy at the beginning and still they built city after city (15plus i think)

    Well i downloaded the splitter but i have absolutly no clue how to make it available hehe.
    Maybe you give me your e mail and i just send it to you ?

    Comment


    • #17
      Originally posted by Foro
      Another thing i saw is that the AI is building a LOT of cities now and it seems to me that they have more cities then their goverment system would allow.
      I tried this code to prevent the AI from gaining new cities by settling, but unfortunatly it doesn't work:

      Code:
      HandleEvent(SettleOrder)'MG_SettleDenied' pre {
      //	if(!(IsHumanPlayer(player[0]))){
      		if((player[0].cities)>=(GovernmentDB(player[0].govttype).TooManyCitiesThreshold)){
      			return STOP;
      //		}	
      	}
      }
      I replaced the to many cities threshold by a number, but if I reach this number of cities the settling goes on. If we don't find the problem you should set MaxPlayers higher than NumPlayers in your userprofile.txt to get new civs instead of Barbarian cities.

      To use splitter you should first put the savegame into a *.zip to attach it here. Afterwards you have it open splitter, there you see two buttons on the top, klick on the left one with the sheet of paper on it. Now you can search for your *.zip file. When you have it in the splitter you you have to select the size of the single parts of the file. Default setting is 1.44 MB Disk change it to Bytes and enter into the box beside 200000. So the file will be splitt into blocks of 200000 bytes. The size limit for this forum.

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

      Comment


      • #18
        will try what you told me but right now i am busy workling wont be able to do anything untill monday

        Comment


        • #19
          What about changing strategy to stratgey with settlerunitscount 0?

          Comment


          • #20
            Actual I increased this SettlerUnitsCount for most of the strategies, to get more settlers. I also started a new game on a 70X140 map of Aplyton ultra gigantic map version. Two civs are wiped out by the Barbarians and if you find a place that is not occupied by someone you get trouble with the Barbarians and the Barbarian level is just bvoring hordes and I have now a level above raging hordes you could call it: Raging Boring Cities. Unfortunatly that weaks the AI, maybe your settings concerning happiness will help, you know the thing with martial law, that is also a city difence. But this sollution could be too slow another probability would be something like militias. I don't consider adding new units to the game, but a free unit for each city, when it is created would be OK. Of course that would be the most advanced defence unit is available for the player. So far I allready gave the AI enough advatages, therefore it should be for both human and AI.

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

            Comment


            • #21
              I ment makeing new strategy with that setting,
              and execute it when AIs is in tyranny and have 10+ cities.

              Comment


              • #22
                Originally posted by Martin Gühmann
                Actual I increased this SettlerUnitsCount for most of the strategies, to get more settlers. I also started a new game on a 70X140 map of Aplyton ultra gigantic map version. Two civs are wiped out by the Barbarians and if you find a place that is not occupied by someone you get trouble with the Barbarians and the Barbarian level is just bvoring hordes and I have now a level above raging hordes you could call it: Raging Boring Cities. Unfortunatly that weaks the AI,
                Try changing your maxplayer setting in userprofile.txt to something above what your Number of Players setting is in that file. I'm not sure if this will work with cities conquered by Barbarians, but I know that cities that have revolted that normally revert to Barbarian status will revert to a new civ, and they then work rather well in the game. Normally, at least from what I can tell, Barbarians are spawned mainly against the human player, and generally go after them first, but they will also attack the AI cities/units too.

                Originally posted by Martin Gühmann
                ...another probability would be something like militias. I don't consider adding new units to the game, but a free unit for each city, when it is created would be OK. Of course that would be the most advanced defence unit is available for the player. So far I allready gave the AI enough advatages, therefore it should be for both human and AI.
                I am convinced that a militia unit is almost a required addition to any setup, especially if you use a higer barbarian setting. The reason why is that it does prevent the occasional AI city from falling to barbarians. I'm not sure that merely creating a unit when a city is built willl help though, because I'm not sure that the AI will leave that unit in the city as a garrison unit in the early going. But I think that the militia SLIC code that is in MedMod/Cradle will overwrite a created militia unit's ability to move, so adapting that code to your setup, and using existing units as the militia units should work.

                However, the tga files that are used to indicate the unit on your unit and army screens will be the same as the normal unit, so there will be a little guesswork every time you want to move units out of a city. Creating a series of militia units might be a little more work, but it allows you to create a tga file that will be different from the normal unit tga and will make gameplay smoother.
                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


                • #23
                  Originally posted by hexagonian
                  Try changing your maxplayer setting in userprofile.txt to something above what your Number of Players setting isin that file. I'm not sure if this will work with cities conquered by Barbarians, but I know that cities that have revolted that normally revert to Barbarian status will revert to a new civ, and they then work rather well in the game.
                  Unfortunatly this deosn't work, I allready have MaxPlayers higher than NumPlayers. And Barbarians doesn' manage happiness so badly that they will lost a city. And also if a Babarian city reverts to a new civ some troops will send from the neighbour Barbarian city or from nearby to conquer it back. I tried to established a new city on a island with two Barbarian cities at first they send some troops to me to get/destroy my city. I had to sent a big garrison to this place first to hold this city. And I also AI cities on the radar map that was conquered by the Barbarians that were just founded. These cities were destroyed or conquered and work than for the Barbarian's. They are now unit production bases and can build advanced units. They wiped out two civs and these civs didn't rached the city limit.

                  Originally posted by hexagonian
                  Normally, at least from what I can tell, Barbarians are spawned mainly against the human player, and generally go after them first, but they will also attack the AI cities/units too.
                  The Barbarians are a real pain in my game, because of these many Barbarian cities and Barbarian level is just one above ruins only. I saw a Barbarian stack of three unit in front of one of my cities defended by only one unit, I thought the Barbarians will take it and next turn this stack was gone and my city still belonged to me.

                  Originally posted by hexagonian
                  I am convinced that a militia unit is almost a required addition to any setup, especially if you use a higer barbarian setting. The reason why is that it does prevent the occasional AI city from falling to barbarians.
                  I have the feeling that it doesn't happen occassinally in my game now but regulary, maybe one third or the half of AI cities is conquered or destroyed by the Barbarians.

                  Originally posted by hexagonian
                  I'm not sure that merely creating a unit when a city is built willl help though, because I'm not sure that the AI will leave that unit in the city as a garrison unit in the early going. But I think that the militia SLIC code that is in MedMod/Cradle will overwrite a created militia unit's ability to move, so adapting that code to your setup, and using existing units as the militia units should work.
                  Wes already make shure that all strategies use this line:

                  DefensiveGarrisonCount 1

                  If I understand it correctly this line should cause the AI to leave one defence unit in its city. So I hope that this unit will be in the city until the city is established. Or it use it to kill a lonly Barbarian unit. I hope.

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

                  Comment


                  • #24
                    It look that defensive strategies in strategy.txt override evry other
                    garrison count strategy.
                    So you should have something like this:

                    STRATEGY_DEFENSE_NONE {

                    // minimum number of units to keep in cities as a garrison
                    OffensiveGarrisonCount 0
                    DefensiveGarrisonCount 1
                    RangedGarrisonCount 1
                    }

                    Since I think taht AI doesn't see barbarins as threat so if these lines stay at original 0,0,0 his cities won't be defended.

                    And in BuildListSequences.txt
                    put garrison units at top of evry list.
                    It works, exept if barbarians have a realy THE BEST UNITS.
                    So you should change Anarchy to something like this
                    (& force barbs. to use it):

                    FoodCoef 0.5

                    That way barbarian cities will slowly die out (by strarvation),
                    so it won't happen that barbarians overrun entire continent.
                    Of cousre to make them BUILD more modern units, you should give them
                    War Advances through SLIC.

                    Comment


                    • #25
                      Originally posted by Martin Gühmann
                      I have the feeling that it doesn't happen occassinally in my game now but regulary, maybe one third or the half of AI cities is conquered or destroyed by the Barbarians.
                      Try this then - go into strategies.txt and you will see that the barbarians use a limited number of GoalElements in the total GoalElements section - most of the other priorities are set at 0. (I have cut and pasted part of the GoalEelements up from an old Cradle setup as an example).

                      GoalElement { Goal GOAL_ATTACK Priority 805000 MaxEval 50 MaxExec 25 }
                      GoalElement { Goal GOAL_ENSLAVE_SETTLER Priority 390000 MaxEval 5 MaxExec 3 }
                      GoalElement { Goal GOAL_SLAVE_RAID Priority 390000 MaxEval 5 MaxExec 3 }
                      GoalElement { Goal GOAL_HARASS_CITY Priority 500000 MaxEval 25 MaxExec 25 }
                      GoalElement { Goal GOAL_HARASS Priority 560000 MaxEval 25 MaxExec 25 }
                      GoalElement { Goal GOAL_PILLAGE Priority 600000 MaxEval 10 MaxExec 5 }
                      GoalElement { Goal GOAL_PIRATE Priority 553000 MaxEval 10 MaxExec 5 }
                      GoalElement { Goal GOAL_WANDER Priority 0 MaxEval 0 MaxExec 0 }
                      GoalElement { Goal GOAL_DEFEND Priority 0 MaxEval 0 MaxExec 0 }
                      GoalElement { Goal GOAL_SEIGE Priority 355000 MaxEval 25 MaxExec 4 }

                      The AI uses 2 goals to take a city
                      GOAL_ATTACK
                      GOAL_SEIGE

                      Now this is just a suspiscion of mine, but I 'think' GOAL_SEIGE is the main one the AI uses to determine if it will attempt to take a city. Because I knew early on that I wanted Barbarians to be more of a factor in my game, I dropped the SEIGE priority to a lower number, and pushed the ATTACK priority much higher. Using this in conjunction with a milita unit drastically cut down on Barbarians taking AI cities. (there I go again pushing the Militia SLIC) There was a tradeoff in that Barbarians now launch less attacks on my cities, but they will do so from time to time, and woe to any small force that runs into a barbarian stack outside of a city.

                      I also copied the entire MILITARISTIC settings and used it to overwrite all the other entries in the STRATEGY_BARBARIAN section, except for the GoalElement section. And make sure you take ANARCHY out of the Barbarian government choices (and give them a government sequence similar to what is in the other sections), because if any barbarian cities to rise up, they can work through the tech tree and create better units.

                      And to handle any cities lost to a revolt change your userprofile setting for MaxPlayer to a number greater that the NumPlayers setting, because then those revolting cities become civs. I like this final element the best.
                      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 Martin Gühmann


                        GovernmentDB(player[0].govttype).TooManyCitiesThreshold

                        -Martin
                        I think ".govttype" is a leftover from CTP1 that doesn't work anymore. I have a vague recollection of trying to use it and getting an error message about it not being a member of the player structure.

                        Comment


                        • #27
                          Originally posted by hexagonian
                          The AI uses 2 goals to take a city
                          GOAL_ATTACK
                          GOAL_SEIGE

                          Now this is just a suspiscion of mine, but I 'think' GOAL_SEIGE is the main one the AI uses to determine if it will attempt to take a city.
                          Here are the according lines for these two goals from the goals.txt:

                          Goals.txt
                          GOAL_SEIGE {
                          RallyFirst

                          SquadClass:CanAttack
                          SquadClass:CanDefend
                          SquadClass:HasZoc
                          SquadClass:CanCaptureCity

                          TargetType:City
                          TargetOwner:HotEnemy

                          Execute ORDER_ATTACK

                          ThreatBonus 500
                          EnemyValueBonus -250
                          AlliedValueBonus 1000
                          PowerBonus 500
                          DistanceToHomeBonus 0
                          DistanceToEnemyBonus 0
                          ChokePointBonus 500
                          UnexploredBonus -999999
                          ObsoleteArmyBonus 100
                          TreaspassingArmyBonus 0

                          ThreatenTypeestroyCity
                          ThreatenBonus 5000

                          ForceMatch:Offensive

                          TargetProtectionWonder WONDER_THE_FORBIDDEN_CITY
                          }

                          GOAL_ATTACK {
                          RallyFirst

                          SquadClass:CanAttack

                          TargetType:AttackUnit
                          TargetType:SpecialUnit
                          TargetOwner:HotEnemy

                          Execute ORDER_ATTACK

                          ThreatBonus 100
                          EnemyValueBonus -250
                          AlliedValueBonus 1500
                          PowerBonus 500
                          DistanceToHomeBonus 0
                          DistanceToEnemyBonus 0
                          ChokePointBonus 50
                          UnexploredBonus -999999
                          ObsoleteArmyBonus 100
                          TreaspassingArmyBonus 0

                          ThreatenTypeestroyCity
                          ThreatenBonus 5000

                          ForceMatch:Offensive

                          TargetProtectionWonder WONDER_THE_FORBIDDEN_CITY
                          }
                          Both goals are executed by the ORDER_ATTACK, but the targets are different. The target of the GOAL_SEIGE is a city and the target of the GOAL_ATTACK is a unit. To have more city captures you should modify the GOAL_SEIGE.

                          From your above example the GOAL_ATTACK is considered 50 times per turn but the maximum number of executed attack goals is 25. That is OK for attack goals, but the MaxExec number for the seige goal is to low if you want to see much city captures. I raise the MaxExec number in my strategies.txt. Now the AI is settling like nuts as wanted but in combination with my slic these new cities are undefended and the Barbarians have an easy job. Therefore the next version will give all players a free defence unit for each city, and the slic file will only force the city to build a happiness building if the city contains a unit. You could try to increase the MaxExec number for the seige goal to get more city captures.

                          Also the GOAL_HARASS_CITY is a attack goal on a city. From a look into the documentation about the goals it should be possible to define new better and more appropriate goals.

                          Originally posted by player1
                          I think that yours startegy.txt isn't that good I was thinking about HAPPY seq. Priority 7500 & 0.5 Unhappiest

                          You should look at Commerce for Ai thread.
                          There I gave an interetigns way to mak AI build more "happy" improvments.
                          Basicily you shuould make it a VERY high priority like 11500 or 12000, exept in starting strategies in which it should be like 1000. Then A percent should be a 0.1 Unhappiest. Then in Buildlistseqences.txt you should top GarrisonUnitBuildList in front of BuildingBuildList BUILDING_BUILD_LIST_HAPPINESS so computer will use a Martial Law & won't make cities undefended.

                          In yours settings big commercal & scientific cities & several others would not build "happy" building at all (since their priorities are bigger than for happines).
                          Understanding your settings player1, why 0.4 for most productive cities if you say it is not very effective to have 0.5 of unhappiest cities. And there is another problem I avoid it to build buildings like factories and oil refinary until pollution reducing buildings are available, because more production cause more pollution and more pollution causes more unhappiness and more unhappiness does hurt the AI more than the human.

                          And another thing I didn't find this very low priority of 1000 for happiness sequence. I found the lower priority for the settling strategies but actual this isn't so much lower than the priority for the defence sequence.

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

                          Comment


                          • #28
                            Understanding your settings player1, why 0.4 for most productive cities if you say it is not very effective to have 0.5 of unhappiest cities.

                            The reason for this is that production is more important than unhappiness, and most all cities need production.

                            And there is another problem I avoid it to build buildings like factories and oil refinary until pollution reducing buildings are available, because more production cause more pollution and more pollution causes more unhappiness and more unhappiness does hurt the AI more than the human.

                            You shouldn't do that seriously unhappiness can be fought with happiness like movie theaters and entertainers, most of the time the production is worth the unhappiness.

                            If you put happiness buildings in the production list, like after the oil refinery it should help the AI with happiness.

                            And another thing I didn't find this very low priority of 1000 for happiness sequence. I found the lower priority for the settling strategies but actual this isn't so much lower than the priority for the defence sequence.

                            I didn't find it either, so I created a new one

                            Comment


                            • #29
                              Originally posted by Martin Gühmann
                              Understanding your settings player1, why 0.4 for most productive cities if you say it is not very effective to have 0.5 of unhappiest cities. And there is another problem I avoid it to build buildings like factories and oil refinary until pollution reducing buildings are available, because more production cause more pollution and more pollution causes more unhappiness and more unhappiness does hurt the AI more than the human.

                              And another thing I didn't find this very low priority of 1000 for happiness sequence. I found the lower priority for the settling strategies but actual this isn't so much lower than the priority for the defence sequence.
                              -Martin
                              First, my stratgeies.txt is optimized for my mod I am making, where pollution levels (and pollution unhappuines for governments) are lower but global warming comes quicker.

                              Second,
                              my settings work like this:
                              you have 8 cities with:
                              1) 72 unh.
                              2) 74
                              3) 74
                              4) 74
                              5) 75
                              6) 78
                              7) 72
                              8) 73
                              Now since pririties for unhappiness is very high, but % are low,
                              just cities 1) & 2) will start building happines buildings (Bassilica for instance).
                              After it finished Bassilicas we have:
                              1) 75 !!!!!!!
                              2) 74
                              3) 74
                              4) 74
                              5) 75
                              6) 78
                              7) 75 !!!!!
                              8) 73

                              Now cities 1) & 7) will stop building unhappines buildings, and
                              citiy 8) will build one, etc.

                              So, after some time almost all cities would build needed buldings.

                              Of course happines sequence should have garrison units at top so
                              cities will be defended before it starts building happines buildings,
                              and also if city stays too long in happines seq.

                              In fact I put a happiness seq. in strating strategies with 8100 pririty but
                              I' am not shure about will it be compatibile with your strategies.txt, so
                              I said to use 1000 priority.

                              This is my strategies.txt:
                              Attached Files

                              Comment


                              • #30
                                And here is my BuildListSequences.txt:
                                Attached Files

                                Comment

                                Working...
                                X