Announcement

Collapse
No announcement yet.

DESIGN: AI Improvement discussion

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

  • #61
    You don't have to recalculate the entire map, just those sections that change.
    Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

    Comment


    • #62
      LD:

      What you say is true, but remember the terrain influence map will never change. It's the threat map that's dynamic. If you setup the threat map to calculate threats in an area, then it's not going to be changing too much every turn. In the game you can only move a unit a couple of tiles. Sure roads and such speed this up, but the general threat in the area is still going to be reasonably static. What I did was this:

      - Have in my node struct the threat level value (means the unit remembers the threat of each node in its path when calculated).
      - Have the threat map update each turn (only need to do it once per player).
      - Have each unit compare threat levels in the nodes in its path against the new threat map (takes no time at all).
      - If the threat level has changed by a set amount, recalculate the pathfinding (giving the unit a new path).

      So effectively, the unit picks out a path to the target. It moves for a few turns, keeping an eye on the threat changes on its path. If the threat changes by the set change amount on its path, it calculates a new path taking the new threats into account. So as an enemy moves across its path, the unit will deviate around the enemy unit, eventually going back to its original path.

      Comment


      • #63
        *BUMP*

        Currently thinking that the AI will need a good re-work of its diplomatic priorities. In every game I have played, for instance, the AI never seems to value peace for anything. I'm rather tired of civs regularly declaring war at me 2-3 turns after ceasefire.

        At same note, make them respect borders.

        And I'm interested in how far can we go in creating a non-cheating AI. In SAP2, for instance, AI gets a pretty decent science bonus, you know... and extra PW, too.
        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


        • #64
          A little *bump* now the source is out.
          Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

          Comment


          • #65
            A while back I was considering different AI mechanisms, but went on sabatical waiting to see if they'd actually release the source code. Now that they have... maybe time to continue the discussion?

            I thought about approaching the issue of problem solving from a data centric POV, but with a programatic twist.

            For example, consider AI's chosing technology.

            You could (and CtP2 does) use an ordered list (per personality in the case of CtP2).

            An issue with this approach is that its not reactive to circumstances.

            An approach I considered was a text file, that assigns "base values" to certain options, then allows for conditions within the file, to assign modifiers (multiplication, division, addition, subtraction) to those base values, based on game state information.

            These values form the basis for simple probability based choice. As a simple example, consider that the result of this file produces the following options (out of available techs) for the "next technology" of a particular AI.

            Seafaring 3
            Iron Working 5
            Ceremonial Burial 2

            In my conceptual system, there is a 3/10 chance of Seafaring being chosen, 1/2 for Iron Working and 1/5 of Ceremonial Burial... thus it will likely be Iron Working, but will not be predictable to the human opponent.

            Essentially the AI, will be slightly unpredictable, but will probably build approapriately.

            Consider how the preceeding information might be generated with an extremely simplified file.

            Code:
            AI_TECH_GOALS.TXT
            
            Base
            {
            TECH_SEAFARING    =1
            TECH_IRONWORKING   =1
            TECH_CEREMONIALBURIAL  =1
            TECH_CODEOFLAWS  =1
            }
            
            IF MAPSTATE(HomeContinentSize) < 300 //Home continent smaller than 300 tiles
            {
              TECH_SEAFARING *3
            }
            
            IF GAMESTATE(MilitaryGrowthDelta,10) < -25 //Miltary growth 25% lower than average over 10 turns
            {
              TECH_IRONWORKING +4
            }
            
            IF GAMESTATE(GovernmentCityCap,0) - GAMESTATE(PlayerCities,0) <5 //Current Player is within 5 cities of the city cap
            {
               TECH_CEREMONIALBURIAL +1
               TECH_CODEOFLAWS +1
            }
            Of course the file would be significantly more complex than this, but would allow for rapid development of AI strategy and intuitive understanding of changes.

            Multiple layers of conditions simulate considering a complex system. The probability ensures non-predetirmined behavior.

            You could introduce messaging between goal files to reduce redundant expensive gamestate calls, and to introduce "personality" ala CtP2 within a flat system.

            There would be GOAL files for General empire settings, General production, city specific production, city specific worker assignment and technology.

            Thoughts? comments?

            Comment


            • #66
              Basic idea sounds good, but why make it random? I'd rather have the AI be slightly less predictable (but with a complex gamestate checker it'd soon be too complex to follow for humans anyway) but always have it make the best possible decision, i.e. pick the tech with the highest priority.
              Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

              Comment


              • #67
                Randomness is good because for map dependant criteria (seafaring for example), playing on a given map type will allow for more unpredictability.
                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


                • #68
                  Make it 'perfect' for Deity, and increasingly random for lower difficulty levels, thereby increasing the chances that it makes the 'wrong' decision?
                  Concrete, Abstract, or Squoingy?
                  "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

                  Comment


                  • #69
                    I think what you're suggeting is essentially a fuzzy logic system, and putting it in that framework might make it more general and easier to understand and implement, or then again it might just cause excessive confusion and obfuscation, as seemed to happen with the CTP1 fuzzy logic system.

                    Comment


                    • #70
                      Its a psuedo-fuzzy system. The conditional operands on the values definitely are fuzzifying, but its less granular than a real fuzzy system.

                      The advantage is that it is much more approachable in human terms, easily extendable, and...

                      Has a very simple defuzzification process... the output using the values as probabilities.

                      The main issue with CtP1 fuzzy AI, as I recall was the defuzzification.

                      Comment


                      • #71
                        A Different Approach?

                        Some proposals for a different approach to the CTP2 AI:

                        1) What if "civilization type" actually meant a different AI strategy? For example, some civs would just find war completely abhorent and would focus their attention on trade, science, or exploration. Others could be aggressive and miltaristic, with a set of strategies tuned toward that goal. On the surface this might sound even more diffcult than programming a "single" AI, but in reality it's easier - after all, it simply narrows the list of options that each AI mode has to choose from (as opposed to "one strategy fits all" programming which tries to mimic the human ability to handle every eventuality). Some additional features of this kind of system could include:
                        - hard coded (but preferably "moddable") advantages such as lower unit or building costs, faster research times, and/or greater movement allowances depending on the AI "focus".
                        - strategies that change. For example, continued warfare against a trading civ could "flip" them to militaristic.
                        - similar civs types would be more likely to ally (or even merge!)
                        - AI mode could be tied to government type (another way in which they might alter over time).

                        2) Speaking of "one strategy fits all", that wasn't true in human history, so why is it always a feature of civ games? Sure there are minor cultural tweaks, but in the end it's all about building cities, researching techs, and building an army large enough to dominate the planet. But not all cultures chose this path, and the fact that it's the current winner doesn't mean that no other options should be available at the start. One interesting alternative would be two or three "nomad" civs that roam around a defined area (such as was true in the north american plains or the russian steppe) that generate gold and units directly from the terrain (no city/building interface) and which have the ability to explode into vast conquering hordes from time to time. Another alternative would be a piratical "city sacker" civ akin to the Dark Ages Vikings or the Sea Peoples of the Late Bronze Age. The common thread here is a narrowly focused AI that adds an air of extreme unpredicability to the early and middle stages of the game.

                        3) Not specifically an AI issue, but I'd think real hard about whether techs should even be AVAILABLE for trade. Casting an eye back on history, let's face it - Civilizations DID NOT TRADE OR SELL KNOWLEDGE! Did it spread out beyond the originating civ? Sure. But this was usually a result of conquest or as a side benefit from trade or a common religion (or - espcially in the modern world - via spies). But kings flat out didn't trade techs and maybe it's time we thought about eliminating this utterly ahistorical feature of the civ genre. Personally, I think it would greatly enhance game play. One of the neat features of the Cradle mod is that it's almost impossible to trade for techs, and as a result you HAVE to pay attention to research (by contrast, what's going on in Civ3 is an abomination). I'm not saying it should be impossible to acquire techs from other civs, but please consider restricting it to "real life" methods. (And maybe include a toggle button for those who simply can't imagine life without the ability to trade or purchase technologies!)
                        To La Fayette, as fine a gentleman as ever trod the Halls of Apolyton

                        From what I understand of that Civ game of yours, it's all about launching one's own spaceship before the others do. So this is no big news after all: my father just beat you all to the stars once more. - Philippe Baise

                        Comment


                        • #72
                          Some sort of "tech through trading" should be available though.

                          A lot of spies were traders who went into other nations, looked at the technology that nation had, then took the info back to their own nation. On the way they did honest trading as well.

                          Comment


                          • #73
                            Sorry to just jump in like this.
                            But i think this sounds very good.
                            If you conduct trade you get substantial financial gain, but technology/science should "leak" between the trading civilizations. This could help keep the game at a balance.

                            (Maybe this should be in another thread, Feel free to move this).

                            Originally posted by Dale
                            Some sort of "tech through trading" should be available though.

                            A lot of spies were traders who went into other nations, looked at the technology that nation had, then took the info back to their own nation. On the way they did honest trading as well.

                            Comment


                            • #74
                              Re: A Different Approach?

                              Originally posted by Kull
                              Some proposals for a different approach to the CTP2 AI:

                              1) What if "civilization type" actually meant a different AI strategy? For example, some civs would just find war completely abhorent and would focus their attention on trade, science, or exploration. Others could be aggressive and miltaristic, with a set of strategies tuned toward that goal. On the surface this might sound even more diffcult than programming a "single" AI, but in reality it's easier - after all, it simply narrows the list of options that each AI mode has to choose from (as opposed to "one strategy fits all" programming which tries to mimic the human ability to handle every eventuality). Some additional features of this kind of system could include:
                              - hard coded (but preferably "moddable") advantages such as lower unit or building costs, faster research times, and/or greater movement allowances depending on the AI "focus".
                              - strategies that change. For example, continued warfare against a trading civ could "flip" them to militaristic.
                              - similar civs types would be more likely to ally (or even merge!)
                              - AI mode could be tied to government type (another way in which they might alter over time).

                              2) Speaking of "one strategy fits all", that wasn't true in human history, so why is it always a feature of civ games? Sure there are minor cultural tweaks, but in the end it's all about building cities, researching techs, and building an army large enough to dominate the planet. But not all cultures chose this path, and the fact that it's the current winner doesn't mean that no other options should be available at the start. One interesting alternative would be two or three "nomad" civs that roam around a defined area (such as was true in the north american plains or the russian steppe) that generate gold and units directly from the terrain (no city/building interface) and which have the ability to explode into vast conquering hordes from time to time. Another alternative would be a piratical "city sacker" civ akin to the Dark Ages Vikings or the Sea Peoples of the Late Bronze Age. The common thread here is a narrowly focused AI that adds an air of extreme unpredicability to the early and middle stages of the game.

                              3) Not specifically an AI issue, but I'd think real hard about whether techs should even be AVAILABLE for trade. Casting an eye back on history, let's face it - Civilizations DID NOT TRADE OR SELL KNOWLEDGE! Did it spread out beyond the originating civ? Sure. But this was usually a result of conquest or as a side benefit from trade or a common religion (or - espcially in the modern world - via spies). But kings flat out didn't trade techs and maybe it's time we thought about eliminating this utterly ahistorical feature of the civ genre. Personally, I think it would greatly enhance game play. One of the neat features of the Cradle mod is that it's almost impossible to trade for techs, and as a result you HAVE to pay attention to research (by contrast, what's going on in Civ3 is an abomination). I'm not saying it should be impossible to acquire techs from other civs, but please consider restricting it to "real life" methods. (And maybe include a toggle button for those who simply can't imagine life without the ability to trade or purchase technologies!)
                              A lot of 1 & 2 is already represented in the CtP2 AI, in the form of personalities. These are a good idea. The problem is that the behaviors aren't different enough. You don't want to give different civs different bonuses. Thats illogical... all civ's are basically the same, their differences come in different resources, and behaviors.

                              The problem with radically different behaviors, is that to include them in the game, they have to be viable.

                              An economic approach. A resource approach (like communism, but successful.) A diplomatic approach. A military approach. A scientific approach.

                              We have to consider ways of ensuring that there isn't just 2 ways to play CtP2. Expansionist/Science Victory and Expansionist/Military Victory.

                              I considered the problem a long while back, and came upon an idea based on OCC challenge. Make a government with extremely limited empire size, and punitive distance penalties. Give them superb city bonuses. Of course, it will need to be balanced, but could simulate countries that either have very limited space or are naturally insular.

                              3. I agree. Insta-advance is dumb. Including trade as a factor in tech spread would simulate what needed to be simulated, well. The fact that the AI's are mostly behind tech wise in CtP means that tech trading is almost never worthwhile. Usually the AI's are pissed at the human too... of course. Civ3 is the obvious lesson why easy diplomatic tech trading=bad thing.

                              Comment


                              • #75
                                As far as I am concerned the work on the AI should first focus on the use of military units as the AI civs often have a good number of units but are unable to stack them properly and move them towards the good targets.
                                "Democracy is the worst form of government there is, except for all the others that have been tried." Sir Winston Churchill

                                Comment

                                Working...
                                X