Announcement

Collapse
No announcement yet.

Exciting AI improvements.

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

  • Exciting AI improvements.

    **********************************************

    Download the Latest Version : CIV1.61_ImpAI_v0.65.zip

    Please note this is for testing purposes only, this AI mod is not yet "production quality", that is not to say that it wont play better than the stock 1.61 AI - it will, in general. But any given version might have horrible bugs and/or AI's which implode messily - in other words, use at your own risk! Of course testing to find such problems is greatly appreciated!

    There are two ways to use this mod - either copy CvGameCoreDLL.dll to your CustomAssets folder (make a backup of the original, if you use another one) - this is so you can use the mod with existing save games, or switch from the mod.

    Alternatively (And especially reccomended if you use other mods) is to create a new folder under mods (for example "IMPAI") and copy the CvGameCoreDLL.dll to that folder, then load like any other mod.

    **********************************************

    My Original First Post:

    Hi guys. I'm often vocal about the inadequate AI - and in some cases, how it's plain moronic. Well I've finally decided to do (slightly) less ranting and slightly more AI modding.

    The code for AI City Placement is bad. I could see that just reading it. There's crazy bits like coast being as bad as tundra, and the resource-value of the city tile is doubled, in spite of the fact the city tile has generic yield (ie the AI thinks it's better to found on grassland than desert). The AI also believes that founding on a resource is a terrible sin.

    It has absolutely no understanding of Lighthouses. It doesn't really understand the value of food resources.

    You can find a simple mod to address the most glaring coast related issues Here.

    Now though I'm working on more thorough code improvement, adding additional improvements such as:
    • City tile awareness. The AI understands founding on a bad tile, makes it no longer bad.
    • Lighthouse awareness. The AI understands that coast tiles are only bad if the city itself isn't coastal. It also understands that seafood is much nicer when worked by a coastal city.
    • Resource Awareness. The AI understands that food resources are the bees-knees, and that it's quite okay to found cramped cities for the sake of resources. It understands that it's okay to found on one resource, if that brings in other resources. It understands better that resources claimed by another city are not so useful.


    Look at these comparison screenshot from my work in Progress mod:

    This screenshot show the default CIV 1.61 AI city founding behavior.

    Despite being saturated with settlers it diligently neglects founding a city at the Corn/Fish/Goldmine site (it's all that nasty coast and desert overriding the extremely marginal resources!). It has also blocked off another fish tile offshore and has failed to make use of the deer in the hungry south.


    Now for the mod. Remarkably the AI has managed to claim EVERY resource on the island. The only poorly placed city is Hamburg, unfortunately the existing code base doesn't even pretend to account for "dryness" of a city (it's unaware that it's not possible to work the gold and both gems). I intend to recode it to value city sites with a net food surplus and to teach it about lighthouses + freshwater lakes.

    Here's a fun one.

    Your eyes are not deceiving you. It's a blue circle offering USEFUL ADVICE, founding on the dry rice to claim fish. My jaw dropped when I saw this, I had altered the code so the AI would found on a resource if doing so would bring in seafood, but actually seeing it in action was great (blue circle code uses AI founding code).

    Unfortunately you can see that the fish circled in red will be blocked off. Regretfully I don't think the AI can be taught about the "blocking" aspect of cities, you see the city placement algorithm is already pretty CPU intensive - to assess not only the value of a potential site but also the reduction in value of other potential sites would increase the complexity too much and result in longer AI turns.

    Anyway, I'm posting this here mainly because the creation forum isn't visited much. I also want to gauge interest in using (and especially testing!) such AI mods - mods which don't change the gameplay mechanics in any way and just improve the AI's understanding of them.

    AI city placement is my first task, next on the list will be the governor and AI build priorities (workboats, granary & lighthouse = good, type thing).
    Last edited by Blake; October 12, 2006, 17:17.

  • #2


    Best.

    Thread.

    Ever!

    -=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


    • #3
      Blake Strikes Again!

      Comment


      • #4
        Great work, Blake. AI improvements are what we were all hoping for when the SDK was released.

        (And I'll be happy to have the AI build cities in better places for me )

        Comment


        • #5
          This is awesome! (And would be perfect for the AU Mod.)

          But why would a warmonger like Blake want to improve AI city locations...

          Comment


          • #6
            Originally posted by Swiss Pauli
            But why would a warmonger like Blake want to improve AI city locations...
            anything to make the AI more challenging!

            because the "cleverer" it is, the less bonuses are needed


            blake, i really do hope they integrate your code into a warlords patch though probably there will have to be a lot more tests, such as non-coastal areas, knowing how easy it is to expand city borders, ignoring some resources within the city range because the benefit is too small (eg incense on desert vs. grassland with a town). etc.
            - Artificial Intelligence usually beats real stupidity
            - Atheism is a nonprophet organization.

            Comment


            • #7
              also, three more points:

              - 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. or seeing that a jungle city has MUCH more potential than a tundra city? etc.

              - considering the 1 extra hammer of founding on a plains-hills?

              - optimising 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).
              - Artificial Intelligence usually beats real stupidity
              - Atheism is a nonprophet organization.

              Comment


              • #8
                Sounds like a heckuva basis for an AU Mod. Well done, Blake.

                -Arrian
                grog want tank...Grog Want Tank... GROG WANT TANK!

                The trick isn't to break some eggs to make an omelette, it's convincing the eggs to break themselves in order to aspire to omelettehood.

                Comment


                • #9
                  As has been mentioned, one of the reasons that the AI code was released was so that someone in the community could work to make it more clever. This is the first I have seen of someone following up on that opportunity, and it is such a wonderful start, too. City placement is such a key deision that any improvement in logic on that subject will have long term effects throughout the game.

                  Here's hoping this is just the first step in the hoped for community contribution to the AI. It would be refreshing to read about work done on the AI instead of just reading repeated complaints.

                  Of course, this will do nothing to help my attempts to rise up from the lower difficulty levels.

                  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.

                  Imagine a dozen or so of such clever ideas, each one associated with a different difficulty level. Maybe, some would have some different sections of their code dependent on dificulty level. We would end up with an AI that truly behaved differently on different levels. Each level would contain a bit more strategic awareness than the previous one. Wouldn't that be interesting?
                  If you aren't confused,
                  You don't understand.

                  Comment


                  • #10
                    Good stuff.

                    Comment


                    • #11
                      Originally posted by eris
                      We would end up with an AI that truly behaved differently on different levels. Each level would contain a bit more strategic awareness than the previous one. Wouldn't that be interesting?
                      That would be a far better approach to difficulty levels than the current method of just giving them a bigger handicap.


                      GREAT JOB!
                      Keep on Civin'
                      RIP rah, Tony Bogey & Baron O

                      Comment


                      • #12
                        Originally posted by Swiss Pauli
                        But why would a warmonger like Blake want to improve AI city locations...
                        So he can capture better cities.
                        Jon Miller: MikeH speaks the truth
                        Jon Miller: MikeH is a shockingly revolting dolt and a masturbatory urine-reeking sideshow freak whose word is as valuable as an aging cow paddy.
                        We've got both kinds

                        Comment


                        • #13
                          Excellent, Blake!

                          I am really looking forward to seeing more AI-oriented modding from you.

                          Comment


                          • #14
                            Wow, great. Does the mod work for Warlords ?

                            This mod will help early warmongers since they get better cities from the AIs . However, later wars might be harder since the correctly-positioned cities help the AIs with researches and technologies to upgrade their troops.

                            Somewhat off topic, is it hard/easy to mod AI's trade behaviour ? I play at Monarch level and win all the time but I don't want to move up to Emperor since all the AIs, except one, refuse to trade techs with me (it happens like clockwork after the first rounds of basic tech trades). The only civ leader who still trades with me is almost always Mansa and he wants a big (50+%) premium on the beakers for the techs he trades. I still win 50% of the time on Emperor but the trading behaviour is so annoying I don't enjoy playing at that level any more. I don't mind if they stop trading because they are annoyed at me, but they're not. My army is consistently at the bottom of the ranking at the beginning of the game so it's not like any of them feel threatened by me either.

                            But maybe the AIs only trade in reponse to battleship diplomacy. In that case, I approach the game the wrong way .

                            Comment


                            • #15


                              Awesome.

                              Edit: Looking at the third image, I don't think that the "unfortunately" is warranted. It doesn't look like it's possible to get either fish resource without blocking off the other, though the explanation you give may still hold for other situations.
                              Last edited by Thedrin; September 27, 2006, 17:20.
                              LandMasses Version 3 Now Available since 18/05/2008.

                              Comment

                              Working...
                              X