Announcement

Collapse
No announcement yet.

Improving the AI: Part I: The Worldbuilder section of alphax.txt

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

  • Improving the AI: Part I: The Worldbuilder section of alphax.txt

    Introduction

    In an overly ambitious step, I decided to do a series (hopefully) of articles on some relatively easy changes one can make to improve the performance of the AI in Alpha Centauri. Most of the things I discuss will apply equally to either Smac, or Smax.

    Here is an outline and probable index of the chapters briefly discussing what I hope to write about in each:

    Part I: The Worldbuilder
    Can changes to the Worldbuilder give the AI a better chance?
    Do settings you choose at startup affect the AI's performance?

    Part II: A review of previous studies
    Lots of Links to previous discussions about improving the AI. Much of this has focused on editing the Factions.

    Part III: Faction Tweaks or Super-AI
    An overview of faction tweaks that will boost the performance of the AI
    An overview of using various 'versions' of a faction without getting lost

    Part IV: Further changes to Alphax.txt parameters
    Artillery, Retool restrictions, Terraforming prerequisites, etc.. There are many subtle things to do in the Alphax.txt. I'll outline what I've learned. There is still plenty more to explore here.

    Part V: For the Ambitious: Changing the Tech Tree
    Pointer to an article by Darsnan and Rubin on changing the technology tree
    A list of the major targets for change: Industrial Automation, Clean Reactors, etc..

    Part VI: Scenarios for Master players
    A small intro to scenarios by the Masters for the Masters. There are many scenarios available that will challenge even the very best Smac(x) player. I'll put a few links here.

    Eventually I'll change the chapter order, but I just felt like writing the worldbuilder section right now as I've been playing with it today.

    -Smack
    Aldebaran 2.1 for Smax is in Beta Testing. Join us for our first Succession Game

  • #2
    Part I: The Worldbuilder

    Introduction to editing the Alphax.txt

    If you've never edited the Alphax.txt, please go check out Darsnan's and Rubin's introduction here: Alphax.txt editing

    It's easy to edit, but it's easy to break the game if you are not careful. As with all things like this, make backups and keep them clearly labeled and in a safe place. If you produce a game crash, it is almost always fixable by simply putting the original files back in place. Secondly, never play a normal Pbem with a modified alphax.txt unless all parties are aware you are doing that. Some changes cause MP not to work at all. Other changes are considered cheating, and rightly so. The point is, if you like pbems, you must be doubly cautious about keeping your 'clean' version of Smax separate from anything you change. I know it seems obvious to some, but it can't hurt to mention.

    In Darsnan's and Rubin's (D+R) article, the various sections of the Alphax text are nicely outlined. I'll be discussing the #Worldbuilder section, which controls how the game builds random maps, based on your selections at startup and on the variables in it's section.

    One really nifty thing about the alphax.txt is that you can keep it open in the background and switch back and forth to Smax while you test changes, rather than re-starting Smax. With something like the worldbuilder, it's best to do the change while you are on a map, rather than at the main menu. Changes apply after returning to the main menu, not while you are there.

    Here's the #Worldbuilder section from an unmodified Alphax.txt:

    Code:
    [SIZE=2]from the Alphax.txt
    #WORLDBUILDER
    384, ; Land base        (Seeded land size of a standard world)
    256, ; Land modifier    (additional land from LAND selection: x0, x1, x2)
    12,  ; Continent base   (Base size of a land mass seed)
    24,  ; Continent modif. (Increased size from LAND selection: x0, x1, x2)
    1,   ; Hills base       (Base # of extra hills)
    2,   ; Hills modifier   (additional hills from TIDAL selection: x0, x1, x2)
    4,   ; Plateau base     (Basic plateau size)
    8,   ; Plateau modifier (Plateau modifier based on LAND selection: x0, x1, x2)
    8,   ; Rivers base      (Basic # of rivers)
    12,  ; Rivers rain mod. (Additional rivers based on RAIN selection)
    14,  ; Solar Energy     (Latitude DIVISOR for temperature based on HEAT) Smaller # increases effect of HEAT selection
    14,  ; Thermal band     (Latitude DIVISOR for thermal banding)  Smaller # widens hot bands
    8,   ; Thermal deviance (Latitude DIVISOR for thermal deviance) Smaller # increases randomness
    8,   ; Global Warming   (Latitude DIVISOR for global warming)   Smaller # increases effect of warming
    5,   ; Sea Level Rises  (Magnitude of sea level changes from ice cap melting/freezing)
    5,   ; Cloudmass peaks  (Size of cloud mass trapped by peaks)
    3,   ; Cloudmass hills  (Size of cloud mass trapped by hills)
    1,   ; Rainfall coeff.  (Multiplier for rainfall belts)
    15,  ; Deep water       (Encourages fractal to grow deep water)
    10,  ; Shelf            (Encourages fractal to grow shelf)
    15,  ; Plains           (Encourages highland plains)
    10,  ; Beach            (Encourages wider beaches)
    10,  ; Hills            (Encourages hills x TIDAL selection)
    25,  ; Peaks            (Encourages peaks)
    1,   ; Fungus           (Fungus coefficient based on LIFE selection)
    3,6,12,18,24 ; Ratio    (Continent size ratios)
    36   ; Islands          (Higher # increases island count)
    [/SIZE]
    If you've played the game a few times with the various settings, then some of the above will make sense. If you are new to Smax, come back here in a few hundred games, or when you tire of the AI's poor performances, whichever is first.

    The main changes I have tried to induce with the worldbuilder are as follows:[list=1][*]Make fewer small islands[*]Keep continents to a medium size and encourage separate continents[*]Discourage deep water and encourage shallow water[*]Discourage high plateaus[*]Encourage rain-making peaks[/list=1]

    There are certainly other goals that might improve the AI. I will outline why I chose those goals.

    1. The AI does not 'land and expand' islands very well. Instead they tend to build a sea-base next to an island and never terraform the island at all. The exception is their home island, which they DO actually try to use terraforming to raise, if it's small. The remedy is to keep islands few and far between, which encourages the AI to 'land and explore' on big continents, rather than park sea colony pods near worthless fungus-covered islands.

    2. Along with reducing the number of tiny islands, it's nice to have lots of medium continents rather than a single huge one, or, all tiny islands. This is a trade off, and lots of opinions on this matter are valid. For example, a single large continent full of AI factions encourages them to trade tech. On the other hand it encourages war early on. Secondly, factions that have a whole medium continent to themselves tend to move into 'builder mode', making lots of base facilities, which vastly improves their chances in the mid-game. Thirdly, and perhaps most importantly, several medium continents leads to the most equitable starting positions, on average. All too often with a single large continent, all the factions will either be grouped in a corner of that continent, or they will all be on tiny islands surrounding the continent. This is a goofy feature of the Starting-location algorithm, an algorithm that we can't change, unfortunately.

    3. Deep water vs. Shallow water. Again, a trade off. The AI makes lots of seabases, in general. Unfortunately, it will do this whether or not the sea is profitable compared to the available land. To this end, shallow water, which allows the best and cheapest terraforming, is far better for the silly AI than a bunch of bases in the Marianas trench. Yes, in my experience, shallow water encourages the AI to build even more sea bases. That's the trade off. However, this also allows them to ICS as much as they want. Millions of Hive seabases in a world of shallows is much better than a half-million Hive bases in unproductive deep water.

    4. High plateaus make excellent energy parks for human players. The AI ignores them entirely for base building or any other use, except to cross to attack another faction. This is one of those 'obvious things' to change that isn't clear until you look again at how the AI makes bases.

    5. While reducing the number of plateaus, it's a nice thing to concurrently raise the number of peaks and/or hills. Hills and peaks lead to rainy patches. They cause streams to meander, and they bring a few rocky squares into the neighborhood, something the AI likes a lot with it's penchant for building mines.

    So how to achieve these goals? Here's my version of the #worldbuilder section for Smax. If it hasn't been made clear yet, back up your copy of alphax.txt (these apply to alpha.txt as well) before making any changes, and please, do not forget what version you are using if you are playing multi-player games. Most 'modders' create a whole new install of Smax for testing out their tweaks and changes. This is a very good idea.

    Code:
    [SIZE=2]
    #WORLDBUILDER
    384, ; Land base        (Seeded land size of a standard world)
    100, ; Land modifier    (additional land from LAND selection: x0, x1, x2)
    48,  ; Continent base   (Base size of a land mass seed)
    24,  ; Continent modif. (Increased size from LAND selection: x0, x1, x2)
    5,   ; Hills base       (Base # of extra hills)
    2,   ; Hills modifier   (additional hills from TIDAL selection: x0, x1, x2)
    3,   ; Plateau base     (Basic plateau size)
    4,   ; Plateau modifier (Plateau modifier based on LAND selection: x0, x1, x2)
    12,  ; Rivers base      (Basic # of rivers)
    12,  ; Rivers rain mod. (Additional rivers based on RAIN selection)
    14,  ; Solar Energy     (Latitude DIVISOR for temperature based on HEAT) Smaller # increases effect of HEAT selection
    14,  ; Thermal band     (Latitude DIVISOR for thermal banding)  Smaller # widens hot bands
    8,   ; Thermal deviance (Latitude DIVISOR for thermal deviance) Smaller # increases randomness
    8,   ; Global Warming   (Latitude DIVISOR for global warming)   Smaller # increases effect of warming
    5,   ; Sea Level Rises  (Magnitude of sea level changes from ice cap melting/freezing)
    5,   ; Cloudmass peaks  (Size of cloud mass trapped by peaks)
    3,   ; Cloudmass hills  (Size of cloud mass trapped by hills)
    1,   ; Rainfall coeff.  (Multiplier for rainfall belts)
    1,  ; Deep water       (Encourages fractal to grow deep water)
    5,  ; Shelf            (Encourages fractal to grow shelf)
    10,  ; Plains           (Encourages highland plains)
    2,  ; Beach            (Encourages wider beaches)
    2,  ; Hills            (Encourages hills x TIDAL selection)
    35,  ; Peaks            (Encourages peaks)
    1,   ; Fungus           (Fungus coefficient based on LIFE selection)
    3,6,12,18,24 ; Ratio    (Continent size ratios)
    5   ; Islands          (Higher # increases island count)
    
    [/SIZE]
    I'll come back and explain the changes in a bit.

    -Smack
    Last edited by smacksim; July 9, 2004, 01:42.
    Aldebaran 2.1 for Smax is in Beta Testing. Join us for our first Succession Game

    Comment


    • #3
      On the changes I've made: Keep in mind that many possible changes might improve the AI. Please post changes you found helpful.

      Numbers in red are the original values, numbers in black are the new values. Don't copy-paste this for applying the changes! I'll attach a 'clean copy' at the bottom.

      Code:
      [SIZE=2]
      #WORLDBUILDER
      384, ; Land base        (Seeded land size of a standard world)
      [COLOR=red]256, [/COLOR] 100, ; Land modifier    (additional land from LAND selection: x0, x1, x2)
      [COLOR=red]12, [/COLOR] 48,  ; Continent base   (Base size of a land mass seed)
      24,  ; Continent modif. (Increased size from LAND selection: x0, x1, x2)
      [COLOR=red]1, [/COLOR] 5,   ; Hills base       (Base # of extra hills)
      2,   ; Hills modifier   (additional hills from TIDAL selection: x0, x1, x2)
      [COLOR=red]4, [/COLOR] 3,   ; Plateau base     (Basic plateau size)
      [COLOR=red]8, [/COLOR] 4,   ; Plateau modifier (Plateau modifier based on LAND selection: x0, x1, x2)
      [COLOR=red]8, [/COLOR] 12,  ; Rivers base      (Basic # of rivers)
      12,  ; Rivers rain mod. (Additional rivers based on RAIN selection)
      14,  ; Solar Energy     (Latitude DIVISOR for temperature based on HEAT) Smaller # increases effect of HEAT selection
      14,  ; Thermal band     (Latitude DIVISOR for thermal banding)  Smaller # widens hot bands
      8,   ; Thermal deviance (Latitude DIVISOR for thermal deviance) Smaller # increases randomness
      8,   ; Global Warming   (Latitude DIVISOR for global warming)   Smaller # increases effect of warming
      5,   ; Sea Level Rises  (Magnitude of sea level changes from ice cap melting/freezing)
      5,   ; Cloudmass peaks  (Size of cloud mass trapped by peaks)
      3,   ; Cloudmass hills  (Size of cloud mass trapped by hills)
      1,   ; Rainfall coeff.  (Multiplier for rainfall belts)
      [COLOR=red]15, [/COLOR] 1,  ; Deep water       (Encourages fractal to grow deep water)
      [COLOR=red]10, [/COLOR] 5,  ; Shelf            (Encourages fractal to grow shelf)
      [COLOR=red]15, [/COLOR] 10,  ; Plains           (Encourages highland plains)
      [COLOR=red]10, [/COLOR] 2,  ; Beach            (Encourages wider beaches)
      [COLOR=red]10, [/COLOR] 2,  ; Hills            (Encourages hills x TIDAL selection)
      [COLOR=red]25, [/COLOR] 35,  ; Peaks            (Encourages peaks)
      1,   ; Fungus           (Fungus coefficient based on LIFE selection)
      3,6,12,18,24 ; Ratio    (Continent size ratios)
      5   ; Islands          (Higher # increases island count)
      
      [/SIZE]
      I'll attempt to explain line-by-line. Keep in mind that many of the changes work together to produce the desired results:

      256, 100, ; Land modifier (additional land from LAND selection: x0, x1, x2)
      This is the amount of extra land per size above a standard world. The smaller this number, the more important your other settings become, because extra land is sort of uncontrollable, whereas adding land via extra peaks or hills is more quantifiable and predictable. However, you do want to add some land based on world size, or super-gigantic worlds will be mostly ocean no matter what.

      12, 48, ; Continent base (Base size of a land mass seed) I'm not as clear on this. but it seems vaguely to do what it vaguely says, that is, make each continent a certain size initially, then tack on extras like plateaus, extra land, hills, etc.. Further testing needed.

      1, 5, ; Hills base (Base # of extra hills)
      2, ; Hills modifier (additional hills from TIDAL selection: x0, x1, x2)
      These two things have a huge impact on your map. Each extra hill is multiplied extensively on a huge map, not just 5X2. More like (5 x number of continents generated). The tidal selection (percent water) is a nice bonus that allows further refinement of your generator. By lowering this number further you can keep the nuance between various settings even smaller if you know what you are looking for in a map. By increasing the modifier you make drastic changes between the tidal settings. This kind of modifier appears a few times in the worldbuilder. That's how it works.

      Plateau Base + Modifier lines work just like the hills modifier. Adding more plateaus doesn't seem to add more land though. It adds to the # of plateaus on existing land, which rarely extends the continent into the sea like the Hills setting seems to do.

      Rivers -> 12. I like rivers

      15, 1, ; Deep water (Encourages fractal to grow deep water)
      10, 5, ; Shelf (Encourages fractal to grow shelf)
      Strangely, I had to lower both of these values to get the kinds of maps I wanted. Perhaps this is because these values are applied after generating the continents. They seem to eat away at existing landmasses, ruining all the things we've made before. This needs more research.

      Plains seem similar to Plateaus. More research.

      10, 2, ; Beach (Encourages wider beaches)
      10, 2, ; Hills (Encourages hills x TIDAL selection)
      25, 35, ; Peaks (Encourages peaks)
      Beach. Try increasing this radically. It makes steep sloped beaches, not flat beaches. I think this is the most mis-named variable of the bunch. Thus, I reccomend you play with it last. Hills appear here as well, along with their big cousins, Peaks. It seems Peaks need Hills to grow upon, as you'll notice if you increase the Peaks value without correspondingly more Hills. This is where I add more land based on tidal selection, rather than via the land modifier (the 100 at the top). Thus, extra land is mostly in the form of rolling hills and peaks, which seems to do wonders for the AI, hides some landmarks a bit more, and causes the rivers to meander a bit more before dumping into the sea. Rivers speed up the AI as well as the player. Since the AI sometimes gets funny notions about travelling all over the map, this dampens the pain of that a tiny degree.

      Basically the key is that the amount of land on a map is determined by many many factors put together, not just the top two. For instance, increasing hills increases the amount of land. Strangely, increasing peaks only increases the amount of land, if there are hills for it to 'work on' in making peaks. Also, encouraging shallows and deep water 'chew away' at the amount of land created.

      So all in all, I found somewhat of a balance that creates just about as much land (a little more typically) as the original worldbuilder, but it:

      Has fewer tiny islands
      Has more shallows than deep water
      Has a high likelihood of generating several medium continents instead of a massive one
      Has few plateaus, but lots of peaks

      -Smack
      Last edited by smacksim; July 9, 2004, 01:36.
      Aldebaran 2.1 for Smax is in Beta Testing. Join us for our first Succession Game

      Comment


      • #4
        Here's the Worldbuilder section described above, for improving AI performance on random maps.
        Attached Files
        Aldebaran 2.1 for Smax is in Beta Testing. Join us for our first Succession Game

        Comment


        • #5
          Some examples with my world settings. A Huge world with all average settings. You can see that there are distinct landmasses and few small islands. This favors the AI, as well as being generally more fun to play on, IMO Hard to see is that the ocean is nearly all shallow.
          Attached Files
          Last edited by smacksim; July 9, 2004, 01:07.
          Aldebaran 2.1 for Smax is in Beta Testing. Join us for our first Succession Game

          Comment


          • #6
            Changing to 'Mostly Land', 30-50 percent ocean, is not as dramatic, because the land modifier is reduced from 256 to 100. The total land amount is made from more static variables, such as number of hills based on map size. This is the easy way to 'fine tune' your random map generator for any amount of land. So here's 'Mostly Land' and otherwise average:
            Attached Files
            Aldebaran 2.1 for Smax is in Beta Testing. Join us for our first Succession Game

            Comment


            • #7
              Finally (And yes, I'll soon subscribe to Apolyton Plus Mark ), here's 'Mostly Water' and otherwise average huge world:
              Attached Files
              Aldebaran 2.1 for Smax is in Beta Testing. Join us for our first Succession Game

              Comment


              • #8
                So you can see that these three amounts of land overlap quite a bit under my preferred settings. It's easy enough to add more land by lessening erosion, or to make a true water world by increasing erosion on an 'All Ocean' map. My favorite setting with this version of the world builder is All-Ocean but low erosion. This makes all those peaks we added more useful, while maintaining that sense of 'Wow, I have to cross a lot of ocean to go probe them'
                Attached Files
                Aldebaran 2.1 for Smax is in Beta Testing. Join us for our first Succession Game

                Comment


                • #9
                  And these settings let the mapbuilder create such maps automatically? You didn't had to add some tiles afterwards?

                  Have you tested small or normal maps with these settings?
                  He who knows others is wise.
                  He who knows himself is enlightened.
                  -- Lao Tsu

                  SMAC(X) Marsscenario

                  Comment


                  • #10
                    Yes, yes, yes, and yes

                    Took awhile to figure out, but the maps are random. The above maps are the first or second 'roll' as well.
                    Aldebaran 2.1 for Smax is in Beta Testing. Join us for our first Succession Game

                    Comment


                    • #11
                      Parts II and III are moving over here
                      Last edited by smacksim; July 10, 2004, 20:58.
                      Aldebaran 2.1 for Smax is in Beta Testing. Join us for our first Succession Game

                      Comment


                      • #12
                        Here's my latest Worldbuilder section of alphax.txt You can copy paste it into your own. It should work with smac or smax, but I havn't tested it with smac.

                        #WORLDBUILDER
                        384, ; Land base (Seeded land size of a standard world)
                        100, ; Land modifier (additional land from LAND selection: x0, x1, x2)
                        72, ; Continent base (Base size of a land mass seed)
                        24, ; Continent modif. (Increased size from LAND selection: x0, x1, x2)
                        5, ; Hills base (Base # of extra hills)
                        2, ; Hills modifier (additional hills from TIDAL selection: x0, x1, x2)
                        3, ; Plateau base (Basic plateau size)
                        4, ; Plateau modifier (Plateau modifier based on LAND selection: x0, x1, x2)
                        12, ; Rivers base (Basic # of rivers)
                        20, ; Rivers rain mod. (Additional rivers based on RAIN selection)
                        14, ; Solar Energy (Latitude DIVISOR for temperature based on HEAT) Smaller # increases effect of HEAT selection
                        14, ; Thermal band (Latitude DIVISOR for thermal banding) Smaller # widens hot bands
                        8, ; Thermal deviance (Latitude DIVISOR for thermal deviance) Smaller # increases randomness
                        8, ; Global Warming (Latitude DIVISOR for global warming) Smaller # increases effect of warming
                        5, ; Sea Level Rises (Magnitude of sea level changes from ice cap melting/freezing)
                        5, ; Cloudmass peaks (Size of cloud mass trapped by peaks)
                        3, ; Cloudmass hills (Size of cloud mass trapped by hills)
                        1, ; Rainfall coeff. (Multiplier for rainfall belts)
                        0, ; Deep water (Encourages fractal to grow deep water)
                        10, ; Shelf (Encourages fractal to grow shelf)
                        10, ; Plains (Encourages highland plains)
                        3, ; Beach (Encourages wider beaches)
                        2, ; Hills (Encourages hills x TIDAL selection)
                        35, ; Peaks (Encourages peaks)
                        1, ; Fungus (Fungus coefficient based on LIFE selection)
                        3,6,12,18,24 ; Ratio (Continent size ratios)
                        5 ; Islands (Higher # increases island count)
                        Aldebaran 2.1 for Smax is in Beta Testing. Join us for our first Succession Game

                        Comment


                        • #13
                          I'm still not 100% happy with it. I'd like to further reduce the highland plains, but that requires re-adjusting several other variables to keep the land total even. Also, it's no magic pill. There's a lot of randomness in the worldbuilder, it's just that I think this reduces the amount of 're-rolls' you'll need to get a pretty nice planet.

                          Cheers,

                          Smack
                          Aldebaran 2.1 for Smax is in Beta Testing. Join us for our first Succession Game

                          Comment


                          • #14
                            I've tried messing with these variables myself somewhat, and I noticed that I get different sort of maps depending on whether I create the maps by
                            1) a quickstart in the main menu, or
                            2) slowly generating the map with the scenario editor.

                            Is it possible some variables are not taken into account when maps are created with the normal gamestart method?
                            Contraria sunt Complementa. -- Niels Bohr
                            Mods: SMAniaC (SMAC) & Planetfall (Civ4)

                            Comment


                            • #15
                              You see, when you "quickstart" a game it uses "fast generate map" option, so it's different from the "slow generated" map by the amount of optimisation.

                              The "slow generate" algorithm runs longer and optimises map more, thus you get different map.

                              All variables are taken, the difference lies in how many times they're evaluated.
                              -- What history has taught us is that people do not learn from history.
                              -- Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

                              Comment

                              Working...
                              X