Announcement

Collapse
No announcement yet.

DESIGN: AI Improvement discussion

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

  • #16
    Ahh, MrBaggins, there is a good reason why AI programming is a whole separate part of programming. While I could draw up formulas to determine how good a unit is (its comparative value), with a different fromula being used for different states (defensive war, offensive war), making the AI see all those values as something part of a bigger whole AND making those into a strategic overview of the entire map... that's something very hard.

    Anyone here ever programmed any AIs?
    Solver, WePlayCiv Co-Administrator
    Contact: solver-at-weplayciv-dot-com
    I can kill you whenever I please... but not today. - The Cigarette Smoking Man

    Comment


    • #17
      Originally posted by Solver
      Ahh, MrBaggins, there is a good reason why AI programming is a whole separate part of programming. While I could draw up formulas to determine how good a unit is (its comparative value), with a different fromula being used for different states (defensive war, offensive war), making the AI see all those values as something part of a bigger whole AND making those into a strategic overview of the entire map... that's something very hard.

      Anyone here ever programmed any AIs?
      Measurements at a strategic level produce 'needs' or tasks at a lower (tactical or operational) level; modifiers(multipliers actually) to the comparitive values.

      While it would be nice to have a seasoned AI programmer available to us, those are pretty thin on the ground... and most likely involved in commercial projects.

      I think if we are serious about making CtP2 significantly better, we have to experiment with conceptual ideas based on existing AI concepts, like fuzzy logic engines, or whatever we have available in the CtP2 engine, and adapt them to our needs.

      I'm not suggesting that we need to invent a genetic AI, or adaptive AI or anything quite so blue sky.

      Comment


      • #18
        But here's the problem, with all that fuzzy logic engines, I have an idea of what it means, but none at all on how it works or how to work with it... I'm confident that I won't be able to understand any of the AI-related code.
        Solver, WePlayCiv Co-Administrator
        Contact: solver-at-weplayciv-dot-com
        I can kill you whenever I please... but not today. - The Cigarette Smoking Man

        Comment


        • #19
          Mr Baggins:
          Its feasible my work on threat mapping (it was adapted from work in electrical engineering, if I recall correctly) could substantially improve the 'understanding' of the AI.

          Once the AI understands where threats are, and what "close" and "far" are, with regards to its cities, it can act more intelligently.
          I'd be interested in seeing this. I'm almost positive there are threat maps generated by the executable and I've sort of simulated one (a target map actually) in CTC_New_Tactics.slc.

          Mr Baggins:
          I usually, and I'm sure most others do, play CTP2 at levels where the AI starts with significant advantages in an extra starting city, PW and gold.

          I don't believe that you can adequately assess the capability of the AI when considering that it has a headstart.
          Solver:
          Ahh, but obvious cheating removes the fun for many. If the AI has its cities grow way faster, starts with an extra one (HUGE advantage), then it's hardly that fun anymore, is it?
          IMO, giving the AI big start advantages is a very poor way to proceed. For one thing it just postpones the inevitable: once the human catches up with the AI, the game becomes tedious. In Call to Conquest, if you chose the QuickStart option you start with 5 settlers and the AI starts with 5 or 6 settlers: not nearly so big a relative advantage.

          Martin:
          Also the pop assignment must be improved, the AI has to check if a city is unhappy how much is lost if it adds an entertainer in comparison to a global slider adjustment, of course it has to consider the fact that entertainers can be freed then. But entertainer usage has to be tied on the happiness level of a city. More difficuild is the usage of all the other specialists. But possible conditions could be a low level of food for the farmers for instance.
          Yes the pop assignment system seems to be very coarse. This is something we'll really have to look at.

          Martin:
          I don't think the current build list are such a good idea, maybe the only function can be what the AI should build, but it has to build a theater for instance if the happiness is low, gold improvements if the gold income from the city is low and so on, the AI should be allowed to change from a unit to a building immediatly, but it should be more difficuilt for wonders.
          I've developed my own system for units: see CTC_unit_building_system.slc. It's set up so that later in the game the AI will build proportionately more Tanks, Planes, Cruise Missiles and so on. With a little work it can be adapted to any mod.

          Martin:
          An invasion code is needed, so that the AI knows how to invade an enemy by land and by water.
          Yes :groan: . This is going to be difficult :groan:

          Martin:
          Code for Aircrafts is needed the AI needs to know how far such a thing can fly with its fuel. And it needs to know that it shouldn't group land units and aircrafts within one stack.

          Also land stacks with special units and civilians should be taken in consideration for attack, but the AI needs to know that civilians have to be removed from such stacks, if it should go into the battle.
          See SaveThePlanes.slc for some of this. If we could tell how much fuel a plane has left, it would be a lot easier.

          @ Hexagonian:

          IIRC, you more than once complained that the AI was ok until you got a science lead, at which point it was game over. I think I may have recently put my finger on why this is happening. Consider the following:

          Code:
          AI_MAX_BEHIND_TECHNOLOGY_COST	0.5 0.5 0.7 0.7 0.9
          AI_MAX_AHEAD_TECHNOLOGY_COST	1.3 1.3 1.2 1.2 1.1
          As the game progresses these sequences converge to 1.0: by the end of the game the AI is getting no significant science bonuses or penalties regardless of it's relative strength. This is going into the next patch for CTC:

          Code:
          AI_MAX_BEHIND_TECHNOLOGY_COST	0.5 0.5 0.4 0.4 0.3 ## should decrease through time
          Here if the human is running away with the game, the AI gets more help to catch up rather than less.

          For more about CTC See this post

          BTW: I'm pretty sure that we don't have to worry about fuzzy logic. It was in CTP1 (.fli = fuzzy logic inferencing) but was dropped from the visable CTP2 files. I read someplace that Steve Mariotti (CTP1's lead programmer) was heavily into fuzzy logic but I think they dropped it when he left.

          Comment


          • #20
            colonizing AI

            Another good AI adjustment would be to get the AI able to manage overseas colonizing. Civ3 is aggressive at sending settlers on transports but not good at managing the colony or defending it. This would be a good tweak, and probably already done through slick.
            Formerly known as "E" on Apolyton

            See me at Civfanatics.com

            Comment


            • #21
              Yes, Civ 3 AI does a very good job of colonizing land. Sometimes it's foolish (a 3-tile island 50 tiles away from closest land), but most of the time, it's good. With CtP2, I happen to get a lot of uncolonized land, especially after burning some AI cities...

              So, maybe add the concept of "rebuilding" to the AI, where it, after the war is over, tries to somehow restore itself to pre-war status, rather than living with the decreased capabilities.
              Solver, WePlayCiv Co-Administrator
              Contact: solver-at-weplayciv-dot-com
              I can kill you whenever I please... but not today. - The Cigarette Smoking Man

              Comment


              • #22
                I'd like to see the entire AI system rewritten from the ground up.

                CTP1 had a fuzzy logic system that, in THEORY, might've worked if there had been a defuzzifying method and about 99.999% less obfuscation.

                CTP2 had a literal logic system which didn't allow for much fuzziness.

                I know nothing of fuzzy logic, nor of how to defuzzify, but I'm sure someone out there can think of something.

                "Put on your fuzzy logic thinking caps." -MrFrodo
                -30-

                Comment


                • #23
                  Thanks for dropping by .

                  Whole AI rewritten... good, but ambitions, damn so. And the problem is, that I don't think we have someone here with AI/fuzzy experience.

                  BTW, mind telling us if you play CtP2 with any of our mods ?
                  Solver, WePlayCiv Co-Administrator
                  Contact: solver-at-weplayciv-dot-com
                  I can kill you whenever I please... but not today. - The Cigarette Smoking Man

                  Comment


                  • #24
                    I've used similar influence maps to what MrBaggins suggested in my game for the AI. Seems to work pretty good. So I'm at least someone who knows how to put them in and get them working.

                    Comment


                    • #25
                      Originally posted by Peter Triggs @ Hexagonian:
                      IIRC, you more than once complained that the AI was ok until you got a science lead, at which point it was game over. I think I may have recently put my finger on why this is happening. Consider the following:

                      Code:
                      AI_MAX_BEHIND_TECHNOLOGY_COST	0.5 0.5 0.7 0.7 0.9
                      AI_MAX_AHEAD_TECHNOLOGY_COST	1.3 1.3 1.2 1.2 1.1
                      As the game progresses these sequences converge to 1.0: by the end of the game the AI is getting no significant science bonuses or penalties regardless of it's relative strength. This is going into the next patch for CTC:

                      Code:
                      AI_MAX_BEHIND_TECHNOLOGY_COST	0.5 0.5 0.4 0.4 0.3 ## should decrease through time
                      Here if the human is running away with the game, the AI gets more help to catch up rather than less.
                      Actually, this is the way I had it set up in Cradle - there was a lot of this type of help (production, gold, food) for the AI civ languishing at the bottom in my CRA_Diff.DB file.

                      The problem was still tied into the sizes of the empires. By mid-game, when I was at the caps for the government I was in (30-40) I'd still see the small civs (4-8 cities) falling behind technologically. So' I'd like to see more civs close to the caps, because it would make the overall toughness of the game greater. I did give the AI a higher priority to build cities in Cradle 1.34-1.35, but that ended up opening another can of worms where civs would end up exceeding the cap.

                      Using the caps is a two-edged sword. It's supposed to be an equalizer, because it places a limit on expansionistic human players. Cradle has a SLIC file that allows captured cities to be disbanded, and allowing the cap to be avoided - but when I played single-player Cradle, I had a house rule not to disband cities. It made for a more interesting game, IMO.

                      But since the AI doesn't recognize it, the AI either stays well below it or expands beyond it with no regard to the unhappiness penalties that occur. The end result in that situation is a bunch of rioting AI cities that do the AI civ no good. And make the unhappiness penalties too small and the cap means nothing to the expansionistic human player.

                      This problem is compounded on gigantic maps because of the amount of land for settling. I tended to play Cradle on smaller maps, so I did not run into the revolt problems in my games.

                      This is why, out of all the issues regarding the AI, city cap management is the most critical for me. If we can nail this one down, I think you will see a greatly improved AI ...

                      Even if it means giving the AI the ability to raze unneeded cities.

                      And I would also like to hear if the Activision programmers ever played any of the Mods.
                      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
                        Using the caps is a two-edged sword. It's supposed to be an equalizer, because it places a limit on expansionistic human players. Cradle has a SLIC file that allows captured cities to be disbanded, and allowing the cap to be avoided - but when I played single-player Cradle, I had a house rule not to disband cities. It made for a more interesting game, IMO.

                        But since the AI doesn't recognize it, the AI either stays well below it or expands beyond it with no regard to the unhappiness penalties that occur. The end result in that situation is a bunch of rioting AI cities that do the AI civ no good. And make the unhappiness penalties too small and the cap means nothing to the expansionistic human player.


                        I increased the cap somewhat myself, I found it otherwise that I have way too few cities for my satisfaction...

                        But point is, yes, AI is either an 8-city puke or a 30-city monster with 65 happiness at them. But, with the source, we can give the AI, say, a 0.2 multiplier for unhappiness bonuses...
                        Solver, WePlayCiv Co-Administrator
                        Contact: solver-at-weplayciv-dot-com
                        I can kill you whenever I please... but not today. - The Cigarette Smoking Man

                        Comment


                        • #27
                          My initial discussion on threat mapping was here:

                          http://apolyton.net/forums/showthrea...26#post1713326

                          then I found some text on influence mapping:

                          here and here

                          The method I've been working on to 'process' the influence map, is to add influence to a map for each army, iteratively in all directions, for a multiple of its move, decaying the move by a terrain value, and using a flag to avoid reprocessing a square. The 'influence' is the strength of the army, and the multiple is the amount of turns you wish to predict.

                          I've been working on optimization, and trying to see if an abstract system just using distances will approximate the same thing, far computationally cheaper.

                          Comment


                          • #28
                            I thought the AI_MAX_BEHIND_ and AI_MAX_AHEAD_ options were based on a combination of factors... not just science/gold... and hence far less useful:

                            If the AI builds tons of obsolete units, for instance, but is falling behind in science and general economy, that doesn't show up on the power graph until far too late.

                            My thought as to a better solution to the science problem, is an "elastic lead" or "knowledge spread".

                            Consider if there were 8 players in a particular game. Civilization 1 researches a particular tech. All other civs researching that tech gain 1/7 of the total necessary points to research the goal. If another civ starts to research it, they gain a bonus at the start of research equal to (x/7) of the goal, where x is the number of civs already having researched the technology.

                            Comment


                            • #29
                              Peter:

                              I've seen and have been very impressed by the great work you've done on your mod. I can't help but feel however, that SLIC is the wrong place to implement good basic AI. Whatever you can do in interpretted code, you can do quicker (usually much quicker) in native code.

                              I feel that SLIC should have more "informational helpers" available to it, so most of what we wish to achieve could be done through simple conditions and strategy changes, rather than reams of code.

                              I think one of the fatal flaws in the system as it stands, is that it treats units as one of a very few types and doesn't have special handling for ships, transports/carriers and planes. I also feel that settlers plus an escort should be a special case, with specific definition.

                              I personally was a big fan of the army descriptors in CtP1 .fli's and thought they were a good solution to the problem, even if the rest of AI wasn't necessarily great.

                              Comment


                              • #30
                                Originally posted by MrBaggins
                                The method I've been working on to 'process' the influence map, is to add influence to a map for each army, iteratively in all directions, for a multiple of its move, decaying the move by a terrain value, and using a flag to avoid reprocessing a square. The 'influence' is the strength of the army, and the multiple is the amount of turns you wish to predict.

                                I've been working on optimization, and trying to see if an abstract system just using distances will approximate the same thing, far computationally cheaper.
                                MrBaggins:

                                If you combine pathing using A* on your movement influence map, you can do the right thing, very quickly and very well. Also avoids "reprocessing a square". I've got my influence map putting neg influences on mountains/strong enemies/etc, and positive influences on roads/target/etc. Then through the pathing at it with a start and end co-ord. Quite simply you get the best path (from the A*) while avioding any obsticles (using the influence map). Very efficient.

                                BTW, works fantastic for laying roads too.

                                Comment

                                Working...
                                X