Announcement

Collapse
No announcement yet.

Improving the AI

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

  • Improving the AI

    I haven't seen a lot of discussion on generalized ways to improve the AI - I realize that a lot of that would depend on how the game mechanics were developed, and I'm certainly not an AI programmer, however I would personally like to see less emphasis on giving the AI bonuses in favor of game play solutions that can be dealt with in a cost/benefit way. If that means simplifying the game so be it, because right now there are just too few ways to win on the higher difficulty levels.

    Furthermore, I don't understand the focus on keeping turn times short; while this is important for casual gamers, they are not likely to play the higher levels anyway. I'd much rather see the computer take longer to make decisions on higher difficulties than just hand it units and tech essentially for free. That's how chess programs have dealt with increasing difficulty for years, why can't Civ leverage that as well. Maybe there could be two difficulty sliders, one that would allow for more complicated (longer) decision-making processes and one for AI bonuses, that way you can choose how you want to play.

  • #2
    There is one opposing side in Chess.

    There can be 30 opposing sides in Civ. If each opposing civ took only 10 seconds extra to finish their turn, that would mean that the AI turn would be 5 minutes longer.

    Comment


    • #3
      Originally posted by MrBaggins
      There is one opposing side in Chess.

      There can be 30 opposing sides in Civ. If each opposing civ took only 10 seconds extra to finish their turn, that would mean that the AI turn would be 5 minutes longer.
      If you are playing against 30 civs, then yes you wouldn't want it to take so long- but I never play against more than 10 since i like to play as a builder and like I said, I would MUCH rather the AI play smarter than faster in games with just a few civs - taking 10 more seconds with 10 civs would probably result in turn times comparable to a current 30 civ game. If people are willing to wait for a 30 civ game, why not make use of that patience in a smaller game?

      Also, the really critical decisions - the ones that decide your overall strategy in the game - are made early on, when there are few units to bog down turn time. Having the AI spend more time making decisions early on, and less time late in the game when units are everywhere would at least be an improvement.

      Comment


      • #4
        Well.. 10 more seconds per civ, times 9 civs would be 90 seconds.. an extra 1 1/2 minutes. Thats assuming that its only 10 seconds extra, (and not everyone is a builder - many people go with high numbers of opponents.)

        Certain things take a predetermined amount of time, and the strategy bidding process works better the longer you give it. The benefits regress though... so for instance, 100% more time may only result in 5% better results.

        Firaxis tend to be very conservative with their release, and won't release something if it has the potential to cause trouble, thus they are unlikely to release an AI that can theoretically take a very long time.

        If you want an example of this behavior, just consider their stance on scripting. They could have released a scripting system for events, but choose not to, because potentially a mod might generate errors and thus reflect badly on Civ3. (I guess... but I don't agree with the position... Modders tend to be very proficient in avoiding/fixing bugs.)

        Comment


        • #5
          i'd like to see customizable ai files, and the ai being able to use player strategies via scripts or something.
          Eschewing obfuscation and transcending conformity since 1982. Embrace the flux.

          Comment


          • #6
            Originally posted by pg
            i'd like to see customizable ai files, and the ai being able to use player strategies via scripts or something.
            Agreed, one of the pleasant surprises of CTP2 was how quickly that scripting turned an AWFUL AI into something competitive.

            Comment


            • #7
              The AI should be a lot more hostile, like it was in Civ1. Right now the average game goes like this:

              1: build, build and build
              2: attack, attack and attack...

              It's just silly.

              The AI must learn to move according to its own interests, not according to some arbitrary "politeness" slider. When the AI is in a position to have its cake and eat it too, when it can wipe out a whole country with only slight loss, then it must USE THIS POSITION TO THE FULL.

              I'm no programmer, but I can imagine how a simple program for calculating the interests of the AI would act.

              Say there are only two nations left, me (Babs) and the AI (Persians). What do I do in contemporary Civ3? Why of course, i get a ROP, place my army outside his major cities, and rape. Only a moron would look with contempt upon this; its a legitimate and effective tactic to win the game.

              What would a smart AI do in this situation?

              Well first of all it would NEVER GIVE ME A ROP!

              Second of all, it would be IRRECONCILABLY HOSTILE TO ME BECAUSE I AM ITS ONLY RIVAL. It would wage non stop war on me, because it would understand that its own life was at stake.

              Is this so hard to implement?

              Basically, the movement of the AI would be:

              1: deduce its own interests (acquiring this or that resource, wounding or destroying this or that player, snagging this or that city, etc...)
              2: pursue these interests with a fanatic and single-minded zeal.

              This is all it takes to give the AI a goal.

              Comment


              • #8
                Originally posted by conananas
                This is all it takes to give the AI a goal.
                For a human, perhaps.

                *SNIP*
                Is this so hard to implement?
                It depends on the situation.

                Basically, the movement of the AI would be:

                1: deduce its own interests (acquiring this or that resource, wounding or destroying this or that player, snagging this or that city, etc...)
                The first thing to notice, is that there are interests... E.G. more than one simultaneous interest. Secondly, these are simple for a human to think about, because we can reason and have knowledge. Using these we can make value judgements. Humans instinctively weigh many different issues to come to their generalized interests.

                A computer doesn't have that ability, so it has to simulate it. It assigns priority values to "things" and modifiers to situations, and those priorities have to be universal. Where these different conditions of prioritizing, or the values themselves are wrong for the given situation (and its almost impossible to think of everything that might happen, or be relevent)... thats where the AI will do something stupid/less than smart.

                Making realistic goals, and deciding if a goal is viable, is also very tough, because goals are predictive.

                To paraphrase Matt Damon and John Turturro, from Rounders...
                "I need to capture the Persian capital"
                “And I need a blowjob from Christy Turlington.”
                Its also not what you'd like to do *this* turn... its what you'd like to do several or more turns down the road. Will it be realistic then, based on the current situation? Thats not simple to model, at all.

                2: pursue these interests with a fanatic and single-minded zeal.
                The operative here, is that these interests are plural. Its difficult to pursue multiple interests, with a "single-minded zeal", unless you've got infinite resources.

                You've got all of these different priority values, for all of these different goals... so... you might say...

                "Simple... just assign all of the military units to the highest military priority... right?" Only if you like leaving your cities undefended.

                "So... ok... leave some defenders home... and assign all of the spare offensive units to the highest military priority." That'd work, provided there wasn't Empire C, just waiting for all of those units to move towards Empire B, and choose that time to invade.

                Of course, what you have to do, is assign resources to goals in a bidding process. Why a bidding process? It's because you don't want to assign a task to a resource, if the goal its chasing can't be met. No reason to send a bunch of 10 Knights towards a city, if its defended by 20 Pikemen, behind a city wall.

                An additional problem is a form of decision-lock... that is, that you need to make these decisions every turn, and that the priorities can fluctuate. The problem with this is that a unit might be "stuck" alternating between two different goals. You can't just lock a resource into a task without reevaluating, either, since it might be destined to failure, or it might really need to be doing something else instead.

                The last complexity that really hasn't been solved well, at all, is coordination of tasks to meet goals. The classic
                example is a naval invasion. A human can coordinate pretty well... plan and mass troops, build escorts and transports and time everything to coincide... and adapt if anything comes up. Can an AI do that right now? Well.. you tell me.

                Comment


                • #9
                  Originally posted by MrBaggins
                  There can be 30 opposing sides in Civ. If each opposing civ took only 10 seconds extra to finish their turn, that would mean that the AI turn would be 5 minutes longer.
                  Good point.

                  That's why they should cut down the number of major powers to at most 16.
                  (\__/) 07/07/1937 - Never forget
                  (='.'=) "Claims demand evidence; extraordinary claims demand extraordinary evidence." -- Carl Sagan
                  (")_(") "Starting the fire from within."

                  Comment


                  • #10
                    I understand what you are saying here about cutting the Major Powers back to 16. Yet with the way our technology is outpacing itself, we should be seeing more highend PC's that will happily absorb the requirements to run 30 Civ's...
                    Gurka 17, People of the Valley
                    I am of the Horde.

                    Comment


                    • #11
                      The number of ai's is hardly relevant. Size of the map is much much more important.

                      Sure, each ai decides on who to go to war with, how to win the game, what tech to research, etc. , but these operations take little time in comparison with deciding where to move which unit, what to move, what to build, what to disband... The most time-consuming thing for the ai is the unit for military and the city for civilian things, so what decides on the time taken by the ai to run is not the number of ai but the map of the size. Roughly, time = (small number of civ) * (small time) + (bigger number of cities) * (small time) + (even bigger number of units) * (not so small time).
                      Reducing the number of civs will cut short on the smallest factor. The number of cities and units is map-dependant only in the late game (early on, it's proportional to the number of civs, but as soon as all the map is settled, that becomes false). So unless you play on archipelago worlds where boats let you settle new islands very late in the game, the number of ai doesn't matter much for the time taken to compute things. There IS a quadratic in terms of diplomacy (number of civs X number of civs), but then there's an even bigger quadratic in terms of potential targets (my units X (their units+theri cities) ). So the biggest hit to performance due to the number of ai's is in the early game. Afterwards, it's mostly irrelevant.
                      Clash of Civilization team member
                      (a civ-like game whose goal is low micromanagement and good AI)
                      web site http://clash.apolyton.net/frame/index.shtml and forum here on apolyton)

                      Comment


                      • #12
                        Originally posted by LDiCesare
                        The number of ai's is hardly relevant. Size of the map is much much more important.

                        Sure, each ai decides on who to go to war with, how to win the game, what tech to research, etc. , but these operations take little time in comparison with deciding where to move which unit, what to move, what to build, what to disband... The most time-consuming thing for the ai is the unit for military and the city for civilian things, so what decides on the time taken by the ai to run is not the number of ai but the map of the size. Roughly, time = (small number of civ) * (small time) + (bigger number of cities) * (small time) + (even bigger number of units) * (not so small time).
                        Reducing the number of civs will cut short on the smallest factor. The number of cities and units is map-dependant only in the late game (early on, it's proportional to the number of civs, but as soon as all the map is settled, that becomes false). So unless you play on archipelago worlds where boats let you settle new islands very late in the game, the number of ai doesn't matter much for the time taken to compute things. There IS a quadratic in terms of diplomacy (number of civs X number of civs), but then there's an even bigger quadratic in terms of potential targets (my units X (their units+theri cities) ). So the biggest hit to performance due to the number of ai's is in the early game. Afterwards, it's mostly irrelevant.
                        This would be the case if corruption and waste were non-existant. However with both those concepts in play, larger empires don't use the land to its full potential, thus a map with 2 civs will be able to support significantly fewer units than the same map with 32 civs.

                        Comment


                        • #13
                          thus a map with 2 civs will be able to support significantly fewer units than the same map with 32 civs.
                          Yes but a map with 2 civs will also have less wars and thus less units lost, resulting in more units. I think it balances a bit. Still, managing the cities (through workers or Public Works) requires work based on map size mostly. I agree that 2 vs. 32 makes a difference because the quadratic factor becomes 256 times bigger with 32 civs, but 32 vs. 16 has only a factor of 4, which will not be noticeable.
                          Clash of Civilization team member
                          (a civ-like game whose goal is low micromanagement and good AI)
                          web site http://clash.apolyton.net/frame/index.shtml and forum here on apolyton)

                          Comment


                          • #14
                            LDiCesare is on the money, as usual. Pathfinding is the single most processor intensive function. This is not because it is complex or unoptimised, it is because it is called so often.

                            Even for *every* high level decision, that you would not normally associate with pathfinding, you can be sure that there are at least some calls to the function in the process of making it.

                            Everything related to map, not just moving units, but danger assessment, chokepoint research, long term planing, even city improvements in silly Civ 3 system - calls pathfinding and calls it alot.

                            So the time intensity of AI calculations grows, probably exponentialy, with the size of map.

                            Comment


                            • #15
                              Yes the map size plays a part, but do a little experiment -

                              Play the first 100 or so turns with 2 civs on "Tiny", and then play the same 100 or so turns with 2 civs on "Huge". The huge map certainly does not take exponentially more time per turn, it takes marginally more time.

                              But then compare the Huge map with 2 civs versus 16 civs, and you'll find that the time does go up significantly.

                              Which supports the idea that it is the units, not the map which is the largest factor.

                              Comment

                              Working...
                              X