Announcement

Collapse
No announcement yet.

Exciting AI improvements.

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

  • #16
    This is magnificent.

    Even people like me who are still struggling against the upper levels' stock AI will find this most interesting because it will give us more challanging games on the medium levels where the game mechanics allow more variety in the strategies employed.

    Comment


    • #17
      - your lighthouse-consideration is great. what about other "potentials"? such as a financial civ maximising the coastal tiles and "rivered" tiles more than others do.
      Well.... just because financial benefits more from coast, doesn't necessarily mean financial should try to get more coast within their city radius. In any case there are other considerations such as Colossus.

      I considered tweaking the code for creative - so it wouldn't care so much about tiles being outside the inner circle. But there are other considerations such as Stonehenge, and the fact that hostile culture makes the outer-circle tiles less useful.

      or seeing that a jungle city has MUCH more potential than a tundra city? etc.
      It actually already does this. The code checks for the maximum of yield with and without the "Feature", so jungle will be considered as grassland (2 food) while tundra is just tundra.
      A lot of the code is actually pretty good.

      I did tweak weightings a bit so it values the higher food tiles more relative to plains and such.

      - considering the 1 extra hammer of founding on a plains-hills?
      I think this is probably too small a consideration. If I do it'll be generalized, like it'll recognize 3-0-0 grassland sugar as a superior place to found. This is complex however because there are some resources you absolutely don't want to found on, like grassland pigs.

      - optimizing the use of lakes with coastal access! usually these are really powerful because they have 3 food and 2-3 commerce in addition to the GL trade routes).
      This one is a little bit tricky. The problem is the "isCoastal" function is the same one which results in 1-tile lakes giving The Great Lighthouse trade routes, so it's hard to differentiate between lake and coast - that is why Hamburg is getting founded on the lake. This bug isn't in Warlords I think. I just have to workaround it in 1.61.

      Is there any way to link this code to a difficulty level? Something like "if DifficultyLevel > Noble then consider these aspects." This could be the beginnings of a graduated AI intelligence according to difficulty level, a development many would like to see instead of just the well known and well-griped-about AI bonuses.
      It's an admirable idea, but the code is also tied to start location selection and blue circles and other things.
      Not to mention that it's a lot more work, making a "dumb" algorithm is almost as much work as a smart one (my success in writing this mod is nearly entirely due to my deep knowledge of game mechanics, not programming prowess), part of the problem here is a "dumb" AI is going to be haphazard (ie randomness) while the city founding code relies on being quite deterministic. Also, ultimately I feel the governor/AI etc should be a model for the new player.

      Wow, great. Does the mod work for Warlords ?
      At the moment I intend to restrict coding and testing to CIV 1.61 since the game mechanics don't change in Warlords. However for that same reason it should be very easy to transfer the changes to Warlords. I don't however plan on doing so until after the Warlords patch - but source will be available if anyone wants to compile the changes for Warlords.


      Somewhat off topic, is it hard/easy to mod AI's trade behaviour ?
      It's not that hard although personally I'm quite happy with the AI diplomacy.

      ~~~

      To everyone else with and other encouragement, Thanks! I'm happy to see that there is indeed strong demand for an improved AI.

      I wrote some new code so it can tell the difference between salt coast and fresh water coast, Progress!



      I was so happy to see that city founded there, just as it should be! And just by chance the AI was building a lighthouse at the time . By the time I'm through with it, it'll be whipping the lighthouse .

      Comment


      • #18
        Oh man yes! I hadn't considered that, but if you can coax the AI into learning to use the whip....

        -=Vel=-
        The list of published books grows. If you're curious to see what sort of stories I weave out, head to Amazon.com and do an author search for "Christopher Hartpence." Help support Candle'Bre, a game created by gamers FOR gamers. All proceeds from my published works go directly to the project.

        Comment


        • #19
          Great Stuff ! Well done

          Comment


          • #20
            Blake,

            As you can see by my rating, I am very much a "lurker". I just had to write and tell you exactly how impressed I am with your work on this. You and Vel are AWESOME!

            With a SMARTER AI placement, I may be able to go back DOWN in difficulty level and find a challenge. I am currently stuc kat the point where one level is too easy and the next seems too linear or tough for me...

            THank you tons!

            Comment


            • #21
              Very nice!!!

              Make sure when you have a distributable .dll or however one distributes these things that it gets into the Directory. I belive Solver or Locutus can put things into the directory.
              <Reverend> IRC is just multiplayer notepad.
              I like your SNOOPY POSTER! - While you Wait quote.

              Comment


              • #22
                I'm going to post an uh beta test of sorts, once I've finished fixing up the placeholder resource code since it's horribly flawed at the moment (Basically it concludes that grassland dyes is a 4f, 3h, 5c tile because the existing function for "max theoretical yield" is good like that).

                Testing on the Great Plains indicates that the main flaw is founding 1 tile off a river. To be honest this isn't such a big deal for AI's since they have relaxed caps and free workers to build roads, but I'll probably tweak it so a river is at least as attractive as a hill.

                Whether or not I go for a full rewrite of the code (ie doing a more rigorous evaulaion of the point value of the terrain) depends on whether I'm happy with the modifications, there is such a thing as "good enough", since all land must eventually be claimed by cities, further improvements would only help optimize the founding order. You've probably noticed the AI are a bit keen to found jungle cities - I might add a special case for that, reducing the attractiveness of Jungle resources (since most require IW+Calendar).

                Originally posted by Velociryx
                Oh man yes! I hadn't considered that, but if you can coax the AI into learning to use the whip....

                -=Vel=-
                The AI already understands whipping after a fashion. So I'll have a code base to start with. The problem is, the AI doesn't understand using whipping as a staple means of production. I'll basically train it to whip Granaries, Workboats and Lighthouses (if the latter two make sense), possibly workers/settlers (if granary) and otherwise use the whip to help keep the unhappy/unhealthy pop under control.
                Altough to see maximum benefit from this I'll need to tweak the governor code and/or AI governor usage and that section of the code gives me a headache.

                Comment


                • #23
                  They should hire you Blake!
                  -- 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


                  • #24
                    Originally posted by Blake
                    I considered tweaking the code for creative - so it wouldn't care so much about tiles being outside the inner circle. But there are other considerations such as Stonehenge, and the fact that hostile culture makes the outer-circle tiles less useful.
                    yeah, i can imagine that hostile culture makes everything much more difficult. i doubt that the AI rushes theatres, libraries and monasteries to grab land at the border. but i think that's too much to expect from AI considerations.

                    It actually already does this. The code checks for the maximum of yield with and without the "Feature", so jungle will be considered as grassland (2 food) while tundra is just tundra.
                    A lot of the code is actually pretty good.


                    but the problem is that jungle is NOT grassland - it's future grassland. so the AI should expand there only if he knows he can clean it up... so not right at a critical border (eg. vs humans, hostile other enemies, etc). he should not really prioritise this spot unless a) resource domination (eg. 3 sugars, dyes, etc), b) another civ could get it before him (eg. a spot) or simply no better spot..

                    I did tweak weightings a bit so it values the higher food tiles more relative to plains and such.

                    I think this is probably too small a consideration. If I do it'll be generalized, like it'll recognize 3-0-0 grassland sugar as a superior place to found. This is complex however because there are some resources you absolutely don't want to found on, like grassland pigs.


                    i guess you'd need to use 3 values: unworked, worked, settled. if we consider the game-deciding phase, a plain hill can give 0,4,0 with a mine. the city would give you 2,2,0. a grassland hill is 1,3,0 vs. 2,1,0...

                    i think especially in the very early game this can be a great advantage... of course depending on the surrounding environment. with tons of floodplains i will surely not build on the hill but instead mine it...

                    as for the "[never] found on" resources (grassland pigs): all grassland (incl. jungle/forest) based commerce-only resources (like dyes, silks) are actually quite good for founding on. ok, you may lose the 3-4 trade units, but you will a) gain the resource without working on it and especially b) free up another tile (often another jungle) for a town which quite quickly pays!

                    This one is a little bit tricky. The problem is the "isCoastal" function is the same one which results in 1-tile lakes giving The Great Lighthouse trade routes, so it's hard to differentiate between lake and coast - that is why Hamburg is getting founded on the lake. This bug isn't in Warlords I think. I just have to workaround it in 1.61.


                    odd... because the food is calculated correctly, also in 1.61. how i that solved? couldn't you use that function? civ3 had a rule of >21 (iirc) tiles of water --> not a lake anymore.

                    I was so happy to see that city founded there, just as it should be! And just by chance the AI was building a lighthouse at the time . By the time I'm through with it, it'll be whipping the lighthouse .

                    - Artificial Intelligence usually beats real stupidity
                    - Atheism is a nonprophet organization.

                    Comment


                    • #25
                      re whipping:
                      this change could be really dangerous because of all the side effects!

                      when do we whip?
                      a) to maximise growth like whipping granaries, lighthouses, workers and settlers --> this is where the AI should also use it.

                      b) to stay under the happiness cap --> less of a problem for the AI with all the bonuses. but he should know that whipping just 1 person is usually too little until recovery time, 2 or even 3 is what we mostly go for. but can the AI handle knowing which cities will recover when (AIs don't micromanage!)

                      c) to stay productive in fast-growing but slow-producing cities --> this is probably ok because captured floodplain cities don't seem to massively lack infrastructure (well, not more than can be expected)
                      - Artificial Intelligence usually beats real stupidity
                      - Atheism is a nonprophet organization.

                      Comment


                      • #26
                        I can't wait for the Warlords post-patch version of this, Blake. Great work, I hope you can keep it up!

                        Comment


                        • #27
                          Programming the AI to play a better game is going to start making their bonuses really pay off, even on the medium levels.

                          Next thing, you’ll be finding that you need to make friends at Monarch level for fear of the AI rush.

                          But it looks very impressive Blake. Does it significantly improve the AI performance or simply give you better cities to capture?

                          Comment


                          • #28


                            This should become part of the official game version!
                            "As far as general advice on mod-making: Go slow as far as adding new things to the game until you have the basic game all smoothed out ... Make sure the things you change are really imbalances and not just something that doesn't fit with your particular style of play." - WesW

                            Comment


                            • #29
                              Originally posted by lockstep


                              This should become part of the official game version!
                              QFT.

                              Good Job Blake. Keep at it
                              You just wasted six ... no, seven ... seconds of your life reading this sentence.

                              Comment


                              • #30
                                Originally posted by Krill
                                QFT.
                                Had to check wikipedia (Internet slang phrases) for that one. I hope you meant 'Quoted For Truth', not the other interpretation.
                                "As far as general advice on mod-making: Go slow as far as adding new things to the game until you have the basic game all smoothed out ... Make sure the things you change are really imbalances and not just something that doesn't fit with your particular style of play." - WesW

                                Comment

                                Working...
                                X