Announcement

Collapse
No announcement yet.

AI -- the Thread

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

  • #46
    One excellant idea I heard (I think Vel mentioned it as a suggestion for Civ3 somewhere, and I really liked the idea) was that of a Playbook (like in football). Now turning it into my idea...


    The AI can have Plays made available to it (added to it's PlayBook), which it can use as a high-level way of planning invasions/defenses. This is one thing, more than any other, that AIs seem to suck at in every game I've played. It can build up forces, plan a base, and collect resources with the best of 'em, but when it comes to actually launching an attack...man-o-man, do AIs suck.

    When considering how human players play, they use abstract plans, much like a football "Play".

    The AI could even, one day in the distant future, develop and refine Plays on it's own by generating a history of all the decisions the AI made during a game, then (perhaps with assistance from a human) evaluate the decisions it made and find out how some of it's plans worked. So if something went really Badly, but something else went Well, and it wasn't just random-number luck in either case - it could try a different course of action, and thus learn from previously played games.


    But in the more immediate future, a Play would consist of something such as "If Target has some power amount in comparison to me in the late middle ages, and I think I have suchnsuch chance of a successful campaign against them, then act really nice to Target and perhaps give them (ultimately useless) gifts while building an attack force of high movement attack units and a garrison force to defend areas I take, but leaving behind suchnsuch sized Sally Force to deal with any counter-attacks or counter-invasions...then Kill Them."

    There really aren't that many Plays that even humans use, but AIs rarely even manage to use those effectively. A few examples would be:

    Raid-n-Sue: Hit a weaker country fast and hard with a relatively small attack force, then move in a good defense force to defend from a counter-invasion, then use your superiority to negotiate a quick and beneficial peace agreement.

    Scorched Earth Blitz: Attack with a large and exclusively fast attack force, raping and pillaging (and razing) whatever you take. The key is to keep moving and do as much damage as possible to cripple the enemy force before they have a chacne to counter-attack, then retreating back to your own (defended) territory before you take any heavy losses.

    Then you can later form a more standard attack force and conquer the force you are now much more powerful than.

    Diversion, Attack, Assault: Launch a small diversionary strike, but large enough to draw some forces towards it. Then land your previously unknown forces from the sea (or from land if your diversion was via sea) in a relatively distant local to cause your enemy to have to pick where he'll send his forces.

    Then after waiting a bit to give him chance to think that the main invasion was coming from the sea and going there, and possibly tryin to take back what you got in your original invasion, throw the rest of the units you held behind at the enemy a little bit away from your diversionary force, and maybe adding a few defensive units to your diversionary force to keep it from being crushed.

    The result is leaving a very good chance that your enemy will be totally confused as to where it should send it's forces first, possibly forcing an error of spreading too thin and loosing on multiple fronts, or sending too little defense to some fronts and overdoing others causing hard losses in the those undefended areas.

    Requires a pretty big force to pull off, and is risky, but if the target bungles defense it could loose in a Big way.



    And many other such plans. Just even basic plans, even if they are sometimes overly rigid, would really take a lot of load off the AI to simulate things that might happen in the future and make it seem a whole lot smarter.

    There are also plenty of thumbnail sketching type tactics that are used by players to determine such things as chance of success or failure, and such simple rules could be used in the near-term in lieu of more sophisticated solutions.
    Better to be wise for a second than stupid for an entire lifetime.

    Creator of the LWC Mod for Civ3.

    Comment


    • #47
      Hi Plutarck:

      I think we can put Playbook sort of stuff in the DetermineActions object. I had stuff like that in mind too. But we need to get things to the basics before we push too much on the sophisticated stuff . When the time comes though this sort of thing will be critical to doing a good job in an acceptable amount of time.
      Project Lead for The Clash of Civilizations
      A Unique civ-like game that will feature low micromanagement, great AI, and a Detailed Government model including internal power struggles. Demo 8 available Now! (go to D8 thread at top of forum).
      Check it out at the Clash Web Site and Forum right here at Apolyton!

      Comment


      • #48
        Hi Everybody:

        I am bumping this up because I could Really use some comments or criticisms of the AI Plan proposal starting with my post of 13-02-2002 22:56 . Since the last enlarged revision I've only heard from two people! Even if military AI isn't your thing, the framework will be used for other types of AI too, so its important to hear if it sounds adequate for those purposes too.

        Decent AI is supposed to be one of the core things that makes Clash unique. Please read it over and give me your thoughts, especially on what you think is missing, or inadequate. If its great, I'd like to hear that too .

        Thanks,

        Mark
        Project Lead for The Clash of Civilizations
        A Unique civ-like game that will feature low micromanagement, great AI, and a Detailed Government model including internal power struggles. Demo 8 available Now! (go to D8 thread at top of forum).
        Check it out at the Clash Web Site and Forum right here at Apolyton!

        Comment


        • #49
          I STILL would really like to see some comments or criticism on the main proposal several posts up. You can't miss 'em there are two about as long as your arm.

          Anyone? I'm handing out three official Clash brownie points and a gold start to anyone who comments...
          Project Lead for The Clash of Civilizations
          A Unique civ-like game that will feature low micromanagement, great AI, and a Detailed Government model including internal power struggles. Demo 8 available Now! (go to D8 thread at top of forum).
          Check it out at the Clash Web Site and Forum right here at Apolyton!

          Comment


          • #50
            Brownies?
            Back to A.5: We can do it as you said, considering AND and OR to be various levels:
            You have a plan like:
            -(Attack Sicily AND Attack Normandy) OR (Attack Normandy) OR (Attack Sweden AND (Attack Denmark OR Attack Spain))-
            you would describe it as a OR complex plan contain three sub-plans, one being a AND plan
            made of a simple plan and a OR plan.
            That's what I ment, do I have brownies?

            Another point:
            Does the evaluation function change with external factors?
            Considering the appeal of an attack against a country will vary based on preferences which can vary based on government, a government change can turn a successful plan into a not-desirable one. I think of a policy like: "Don't use nukes" rather than "Don't go to war", which has an effect on the envisioned strategy. I am not sure whether other more strategic peace/war policies should intervene at this level.
            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


            • #51
              Hey Laurent:

              Sure, you get brownie points for the comments/question. Unfortunately the only brownies I'm giving out now are virtual

              The complex plan logic would work pretty much as you say.

              I am not sure I get completely your example on externalities. Things like government changes would be most likely to cause a change in the diplomatic AI that might make peace more likely. I don't see a big effect of a government change upon actions on the ground. The way that would happen would be that GrandStrategy could call for a pause while the diplomatic situation was being renegotiated. Hope this adresses your issue.

              Thanks for the comments/questions!
              Project Lead for The Clash of Civilizations
              A Unique civ-like game that will feature low micromanagement, great AI, and a Detailed Government model including internal power struggles. Demo 8 available Now! (go to D8 thread at top of forum).
              Check it out at the Clash Web Site and Forum right here at Apolyton!

              Comment


              • #52
                Mark:
                I read your posts, but I have probably missed some of its details. Anyway here is some thoughts/suggestions.

                First of all I would like to say that I think the plan tree idea is very good. Below is a suggestion of how to make it more stable (but it is all just thoughts, so I might be wrong of course). It will be mostly relevant for military operations, rather than grand strategy.

                About success and objectives:
                I think this is a simpler variant of the model, than the one you proposed (if I understood it correctly, which I am not sure of), but I think it is less gullible.
                When a plan is given resources, it should both be given resources to be used, but not expended, and resources to be used, and if necessary expended.
                For example, a plan to attack city A is given 8 units of infantry, but should only accept to lose 4 of them. If more is killed, then the AI should reevalute if the plan should be transferred more resources or cancelled. If it is cancelled, that might also makes one or more higher level plans failures as well.
                Success is only when the mission goal is accomplished. A plan is always either not yet accomplished, failed or successful. Perhaps a time limit should be a goal for some plans.
                The value of a successful plan is decided BEFORE it is put into action, not during.

                About the flexibility:
                Redeploying can be the death of any tactic AI if it is not very carefully implemented. I remember an old tactical wargame that I used to play. Its AI was OK, when I engaged it on one front it could give good resistance. But once I learned to engage it from two fronts I always beat it, because the AI kept moving lots of units back and forth between the fronts to respond to my moves, rather than using them to attack my units. It was not unusal to see the AI move a tank to one front, let it fight there for two turns, then suddenly disappear into the fog of war, only to three turns later appear on the other front. For those three turns, the tank had only been moving, when it would have been more useful fighting, even if perhaps not at the most optimal place.
                So I think it is important that the AI actually tries carry its plans through, rather than starting on a plan, then decide it really wants do something else, and then change plans again before anything is fulfilled. A too reactive AI is an AI that is very easy to trick. That is one of the reasons for having a simplified success-rating, that is not reevaluted often.

                Another reason is that if you use a plan tree, is that every level of the tree wants to be sure the lower level plans actually do what they are supposed to, not go about doing something else that turns out more economical, but fails to achieve the main goal. That is also the way it works in many military organisations. If the division staff orders a battalion to take a point, it counts on the battalion to take the point, even if it gets an opportunity to kill half the enemy army instead. Because if the battalion does not take the point, it might pose a threat to other plans the division staff has in mind, but the battalion does not know of.
                Suggestions upwards in plan hierarchy should be rare, or at least only approved of, when it is MUCH better than the original objective (again, to avoid AI baiting).

                Reserves:
                A higher level plan should in addition to lower level plans have some resources in reserve that can be transferred to plans that do not fulfill its objectives, or seem not to be able to fulfill them. The primary communication upwards in the tree should be to request more resources. They should not take resources from a plan, until it is either completed or abandoned, to ensure nothing is done half-heartedly, or the player tricks the AI to redeploy troops.
                When a plan has transferred all its reserve resources to its child plans, and still have one or more unfulfilled child plans, it has failed, and should be reevaluated.

                Intelligence (as in military intelligence):
                This is could be a very difficult thing to handle. It is important for the AI to do good recognaissance in advance so it knows what it is about to face, since the plans (according to my suggestion) should not change that often. The AI should for example not go to war, unless it thinks it has good chances to win it. It should not invade an area unless it plans to really take it.
                Perhaps some higher level plans should begin with a ”scout area plan”, and first when it is finished decide a few child plans to split its resources between.

                About OR-plans:
                I think they are only viable before proper recognaissance is done, just to keep some flexibility, but the AI should then commit itself to specific tasks that it really tries to achieve.

                Looks like the post turned out much longer than I planned.
                To sum up everything above: let the AI stick to its plans and follow them through, unless they are too costly or higher level plans start to collapse.
                One of the biggest mistakes in war (and sometimes in computer games as well) is indecisiveness.

                RM

                Comment


                • #53
                  Hi RM, thanks for all the detailed ideas! I think your analysis of things we need to watch out for is spot-on. I have to admit that I do believe most of the problems you're worried about won't be as bad as you fear, but maybe you'll be the one that's right...

                  I have to admit I hadn't thought much about intelligence about enemy forces and dispositions yet. And how to get them by scouting, spying or whatever. Need to cogitate a bit more on that one.

                  Since coding here isn't imminent, I'm just going to think about your suggestions for a bit, and see what others think. Thanks for the coments, and for being willing to wade through it!
                  Project Lead for The Clash of Civilizations
                  A Unique civ-like game that will feature low micromanagement, great AI, and a Detailed Government model including internal power struggles. Demo 8 available Now! (go to D8 thread at top of forum).
                  Check it out at the Clash Web Site and Forum right here at Apolyton!

                  Comment


                  • #54
                    Intelligence gathering:
                    We could have a general factor about assumptions, like if they are 10% sure, 50% sure, 90% sure. That way we know if the plan is confident in those assumptions. A plan would not be allowed to fire if its assumptions are less than a given figure (60%?), thus one sub-plan would always be "Make sure assumptions are correct/we have enough intelligence". The minimum confidence could vary based on the returns of the plan: You can gamble if you believe it will reap huge benefits.
                    How to increase the assumptions confidence is another problem, but it could be done by:
                    -spying
                    -exchanging maps/knowledge with neighbours (typically the Germans in early 20th century worked a lot with French and thus knew their defenses on the Maginot line very well)
                    -sending scouts (planes being excellent for that).
                    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


                    • #55
                      Hi Laurent:

                      You've raised some important issues here! Sorry it took me so long to respond...

                      I'm not sure I like your approach, but don't have anything really good to offer at this point. I guess my preference is to wait and see how the AI works out with plans based on different levels of information, and then determine how the AI should use that information in combination with its specified risk tolerance.
                      Project Lead for The Clash of Civilizations
                      A Unique civ-like game that will feature low micromanagement, great AI, and a Detailed Government model including internal power struggles. Demo 8 available Now! (go to D8 thread at top of forum).
                      Check it out at the Clash Web Site and Forum right here at Apolyton!

                      Comment


                      • #56
                        Dropping in...

                        Interesting thread so far, though my concern is your efforts are heading in the wrong direction.

                        To me, the important thing about designing AI is not how to do it, but what needs to be done. For example, Computer Player A just runs into Player B. Now what? How to proceed from there?

                        It seems that there lacks a clear (or vague) definition of what a computerised emperor should do. What should it do when invaded? When will it want to launch its own invasion? Will it attempt to colonise the new continent just discovered, or will it do it later? Will it be an expansionist or a perfectionist? Or will it shift objectives around as situations develop?
                        (\__/) 07/07/1937 - Never forget
                        (='.'=) "Claims demand evidence; extraordinary claims demand extraordinary evidence." -- Carl Sagan
                        (")_(") "Starting the fire from within."

                        Comment


                        • #57
                          Hi Ranger.
                          Interesting question. I think we are not in the wrong direction because that is what needs coding, and once you know how the machine thinks, you can give it higher level "orders".
                          To answer partly/vaguely:
                          I think AIs have to behave differently (have a personality) to be an interesting challenge. This can be modelled by the ruler and/or ethnic group having some preferences about warfare, research, expansion...

                          Now how does the AI handle contact?
                          1)Appraise other civilization: - military strength - economic strength - scientific advancement - population - attitude - other civs relationships - map
                          I insist that there must be a way to gather this information, as every simulation depends on it. Trading for such info and scouting are both acceptable.
                          2)Based on that info, check a list of possible attitudes:
                          -Attack them -Prepare to defend from them (subplans: Build defense force/offer tribute) -Trade with them -Ally with them -Threaten them into tribute

                          Now each of these options is a plan unto itself, albeit high level one, as described per Mark. As long as no clear attitude has been decided, it is probable that few resources would be used to simulate an attack plan. It would do just to see if it is worthwhile, which means the returns of the attack plan would be taking lots of population/resources. Probably very few options would be run.
                          NOTA BENE: This means we have to tell a plan how many options at most it can envision, so it will not spend hours of processing power trying to accomplish something which is anyway highly unprobable.
                          Once an attack plan is simulated, an idea of how much damage can be dealt to whom in case of conflict is obtained. This leads to decisions like whether or not to go to war, whether or not to demand tribute and how much, or if it is a good idea to have trade/science relations with that neighbour. Considering these 3 options as exclusive, and forgetting alliances for a while, each can be seen as a plan with a total revenue from it (cost/gains of war, cost/gains of tribute, cost/gains from trade). The best plan is then chosen.
                          Note that 'best' depends on the cost, which itself will be biased based on the preferences (militaristic/trading/...). A civ that values conquest could multiply by 2 the result of attack plans and divide by 2 that of trading partnership for instance, and vice versa

                          I bet Mark will have a few things to say.
                          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


                          • #58
                            Originally posted by Urban Ranger
                            Interesting thread so far, though my concern is your efforts are heading in the wrong direction.

                            To me, the important thing about designing AI is not how to do it, but what needs to be done. For example, Computer Player A just runs into Player B. Now what? How to proceed from there?
                            Hi Urban Ranger:

                            Thanks for looking it over, and your comments. Sometimes criticism is much more important to hear than complements.

                            But in this case you're Wrong, Wrong, Wrong!!!

                            Sorry couldn't resist... I would have put the [monty python] tag around the "Wrongs" if it wouldn't have spoiled the effect...

                            Anyway, silliness aside, you are very right that we need all those details. But what I think needs to come first, and Laurent talked about this some too, is a framework in which to handle it. We've each thought a lot about these things, and could certainly have long profitable discussions about 'em. That the sort of thing we in fact did a few years ago in the project. The problem is that lots of things that are far from appearing in the game get lots of discussion, and progress on the actual coded game slows enormously. So for now we are mostly focusing discussions around:
                            1. What has been implemented, and how to improve it
                            2. What is soon about to be coded, and what to do on it.

                            There are two major game components in Demo 6, military and economy. The economy can Almost run itself at this point in the game, leaving the big hole in AI as Military Tactics and low-level strategy. That's why we have in this thread been discussing the framework and how to make it work for D6-type situations. So the most useful things you could contribute at the moment are ideas as to how to do those things right. But I understand those aren't the most glamarous or interesting parts of the AI challenge...

                            So, UR, in terms of the details you are looking for, we will start out with some AIs that are ideas of our own, but we are hoping that refined strategies come From Players. That is one of the big advantages we have of doing a completely open series of alpha and beta releases. For relatively straightforward military tactics and strategies there are Already some details under DetermineActions parts of several of the plans. You may well have missed 'em since they are in amongst a Lot of text. Just search this page for DetermineActions and you'll see 'em fairly quilkly. Would like your comments on them.

                            It seems that there lacks a clear (or vague) definition of what a computerised emperor should do. What should it do when invaded? When will it want to launch its own invasion? Will it attempt to colonise the new continent just discovered, or will it do it later? Will it be an expansionist or a perfectionist? Or will it shift objectives around as situations develop?
                            We hope to get to some of these in the coming months. But without diplomacy working, its hard to refine what you do with an invasion, beyond the straight military stuff. But dealing with invasions is something we will be doing at least at a purely military level in the not-too-distant future. There are already some comments on these ideas on the AI web page near the end. In the part where I talk about fighting on a 'front' IIRC.

                            For the high-level sorts of planning and evaluation you talked about its the critical stuff that goes into the DetermineActions part of a plan. As Laurent said, we'll have a bunch of settings for each player that determine aggressiveness, risk aversion, and a number of other tendencies for the AI. These tendencies will be used in two places:
                            1. Shaping DetermineActions with modifiers. The pacifist civ won't look at many warlike alternatives.
                            2. Weighing the results that are simulated as Laurent said.

                            Whew, that's about enough for now. Some other (fairly obvious) points about strategy are on the AI web page, I will just put one quote up here for your info below.

                            We Will do all the important things you're talking about, but its going to take some time, and we need to IMO maintain the discipline to do it in usable-sized chunks. Both Laurent and I are Very interested in the AI aspects of Clash, but much of the rest of the game needs to be there before the challenging but very interesting parts of the AI design will really matter.

                            Cya,

                            Mark

                            From the AI web page (ref at top of this thread):

                            The crucial job of a Civ's realpolitik AI is to put it into as advantageous a position as possible with regard to its rivals. This AI will look ahead 5-30 turns for opportunities and threats on the diplomatic, military, social (e.g. revolts) and economic fronts. For a militarily aggressive power this means diplomatically isolating smaller powers so that they can be conquered one at a time. (The smaller powers will of course realize what is going on and will tend to unite to defend themselves) Another attractive possibility is taking out a powerful adversary while he's down due to a revolt or other calamity. For more peaceful powers (or aggressive but realistic small powers) the object of diplomacy is to make peace with everyone, buying time to grow by peaceful expansion or economic/technological advancement. Failing total peace they will generally attempt to form a defensive coalition that contains as much of the local area as possible.
                            Project Lead for The Clash of Civilizations
                            A Unique civ-like game that will feature low micromanagement, great AI, and a Detailed Government model including internal power struggles. Demo 8 available Now! (go to D8 thread at top of forum).
                            Check it out at the Clash Web Site and Forum right here at Apolyton!

                            Comment


                            • #59
                              Posted from email.

                              me :
                              Evolving strategies genetically requires a good fitness function. And for games of this size, those are hard to generate. Preventing the AI from being predictable is a good thing, but you can do this in another way : evaluate the effectiveness of various moves or short-term strategies and choose a cut-off point. From the strategies that make the cut-off point we can choose one at random. Alternatively choose one strategy such that the likelihood of being chosen is proportional to the evaluated effectiveness.

                              mark :
                              I basically agree with what you say. First of all, I think we are helping ourselves out a lot in the fitness function area by having the AI be hierarchical with relatively contained levels, each with their own fitness function. I think I'm most in line with your final comment, in that
                              the selected strategy should be some random draw based on a function of the fitness of each strategy. I don't think I'd make it proportional, since then even a boneheaded strategy could have a moderate chance of being selected. But it depends on exactly how we make the fitness function, so I'll defer detailed discussion of that until later.

                              me :
                              The hierarchical AI model I like, and I think that's the only way to get decent results for a game like this. Modelling AI efficiently in this manner is pretty much game-dependent though I suspect - you probably don't want the AoW 1 type AI where it starts taking forever to take its turns.
                              The second draft of the plan seems pretty complicated.
                              And generic planning is really hard to implement. But I like the specific low-level plans like "AreaAttackPlan". I think they'd work well.

                              Mark :
                              The low-level plans would be the thing we would try out first as the proof-of-concept. I agree with you that the higher-level stuff is a bit complicated, but I think in time we can do a good job on it.

                              Me :
                              Unfortunately the game itself, although it looks beautiful, seems to run *really* slowly on my celeron
                              300. Is there a known reason for this? Because testing
                              may be extremely painful if I can't get it running faster."""

                              Mark :
                              I have a 300 MHz Pentium III machine, and it runs fairly quickly on Dawn and Jericho, a bit slow on Delenda and definitely slow on Attila. I think the issue here is the Celeron processor combined with the relatively low
                              clock speed. There is another guy who describes his computer as a "Gateway piece of ****" and he has problems that I suspect are similar to what you are
                              going through. If the other aspects of what we are doing are sufficiently intriguing, I think we can design scenarios with smaller maps for you to test out the AI on. First you would need to verify that the game runs
                              basically decently in the Dawn scenario. If that's the case, then we can reduce that slowness by reducing the map size for your AI testing scenario.
                              We have not done any speed optimization at all on the code, and only a little is planned for the near future. That's because were taking a radical programming approach that suggests we should put off optimization until the very end so we know what it is that really needs to be optimized.

                              Me :
                              But what I really want to say is that the current AI
                              spec seems quite complicated, although I'm not sure
                              how much of it you've implemented. I mean it sounds
                              good but for a demo shouldn't one start with something
                              small and make the interface to the AI able to support
                              a more complex one?

                              Mark :
                              Absolutely none of that spec has been implemented. What is in the demos now is a much cruder AI that Gary slapped together so we would have Something.
                              As I think is discussed in the AI thread we would start to implement this by doing the lower-level parts of the plan first, which seems to be the things you most agree with. If you are saying that we don't need to implement
                              the most complicated parts even of the lowest-level AI first, then I agree with you. Getting something that uses the framework interface first, as you suggest, seems like a good strategy. But I do think it should be done with the eventual aim of converging on the plan, although that could be months in the future. Let me know what you think about this approach..

                              Comment


                              • #60
                                Welcome to the Clash forums Polemos!

                                Thanks for posting our email exchange, it may be useful for others who are new to the Clash AI concept.

                                I hope to hear more of your comments on the Plan stuff in the near future!

                                -Mark
                                Project Lead for The Clash of Civilizations
                                A Unique civ-like game that will feature low micromanagement, great AI, and a Detailed Government model including internal power struggles. Demo 8 available Now! (go to D8 thread at top of forum).
                                Check it out at the Clash Web Site and Forum right here at Apolyton!

                                Comment

                                Working...
                                X