Announcement

Collapse
No announcement yet.

AI -- the Thread

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

  • #61
    My favorite topic hasn't seen the light of day for a few months, and there's some new folks about. So how about some suggestions or constructive criticism

    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


    • #62
      Now that you mentioned it...

      I find the model qutie sensible, but it seems to describe only half of what goes on in AI, namely the behaviour and how it is structured. However, I think that there's a whole another side to the way the computer operates: the way it observes the world. What does the AI know about the game world? What's the underlying model or worldview it operates under?

      Now, of course it is taken for granted that the AI knows what the game engine tells it... position of units, terrain, so and so much money in the treasury et cetera. But, in addition to all this AI should be able to grasp more abstract concepts like fronts, feints, bluffs, defensive or offensive units, strategically important cities/places, and so on. Perhaps this could be implemented in kind of another tree-like hierarchy parallel to the one described earlier, and the "plans" might use this information when determining actions?

      (...but what do I know )

      Comment


      • #63
        Leland, there used to be a thread explaining how the map was "read" by the AI. Looking deep into the old dusty threads, you can probably find it. I don't have the time to unearth it now, but it explained how strategic importance of locations was computed (roughly: a place has more importance than another if many shortest-paths from a square to another go through this square- I hope that is understandable).
        Role of units is not very hard to get through as units (or elements in them) have abilities like carry, ranged fire support, scouting, wall-breaching, etc. Attack/defense role is a bit harder to check as the model doesn't really provide attack/defense phases a la civ. Though in combined arms, having a tough front row and artillery behind is a good tactic. There are lots of information available to allow the AI to chose which units to build and how to group them effectively. Finding the good formula will be hard, but the info exists, which is already something.
        Things like fronts, feints, leading armies into ambushes etc. we are still far away from indeed.
        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


        • #64
          Thanks for the comments Leland, and the response Laurent.

          As Laurent said we're partway (in modeling, not much code yet) into even some of the hard things. The Map AI info he was talking about is on the Map AI Page on Clash Web Site. Check out the Map AI Demo that Jim Cockram did using my Map AI theorizing. Its about half way down the page.

          The map AI can provide info about geographic boundaries and regions, so I think, in addition to the things Laurent mentioned, we will also be able to do fronts. Strategic places/locations also comes out of the map AI and IIRC are even roughly discussed in the writeup.

          Feints and such are going to be the hardest part, but I think we can do reasonable heuristics on that. Specifically you don't commit a substantial part of your forces for sure till you are certain the enemy is committing a substantial part of theirs. The GA stuff can help with that also. And besides, that is the hardest part for people too!
          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


          • #65
            Thanks for the info, most enlightening. However, what I was more after was some sort of generic framework for the way AI "sees" the world, analogous to the framework that was described in the last page for how AI does things (Plans, Actions, etc.)... it seems that the map regions and such are features that several different kinds of Plans need to know about, which is why it looks like you'll need to figure out some sort of skeleton where you put all these heuristics and algorithms for analysing various concepts of the game world, as opposed to just stuffing all that analysis code inside determineActions methods.

            I am by no means an expert, but since killer AI is one of the stated goals of Clash and no doubt will settle for nothing less than state-of-the-art (well, eventually...), I do have some academic interest in how you'll intend to solve the design issues involved. Algorithmic details I'll gladly leave to active contributors.

            (End ramble.)

            Comment


            • #66
              I expect you may be right after some reflection. I'm not sure we'll need everything you've described. . . I think we'll figure it out as we get a ways into coding and actually using the AI Plan stuff.

              Thanks for the ideas, Leland.
              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


              • #67
                I'm bumping this a bit so I'll find it more easily next time I look for it:

                I am going to try to implement the stuff we talked about. Just counting the number of classes needed makes me sick, but, well, a good AI is what I want, so...
                I'll try to get the Delenda scenario, from Carthage as a good AI to start with. It should basically be variations on 'Destroy Rome', so the highest level ponderings on whether it would be a good idea to go at war or not and such won't be taken into account. I'll have enough work without, and I want Hannibal to attack. I'll create at least two plans, naval and land attack.

                I'd like most of the plans to be scriptable or flexible enough that we don't run into a problem if someone finds a tactic the AI can't think of, so it should be adjustable by changing values in resource files (or adding a tactic description) rather than recompiling some stuff. I am not sure I will be able to do that and that will not be my first priority, but it would help a lot when adjusting the AI if anyone could do it, not just a programmer.
                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
                  Originally posted by LDiCesare
                  I am going to try to implement the stuff we talked about. Just counting the number of classes needed makes me sick, but, well, a good AI is what I want, so...
                  I'll try to get the Delenda scenario, from Carthage as a good AI to start with. It should basically be variations on 'Destroy Rome', so the highest level ponderings on whether it would be a good idea to go at war or not and such won't be taken into account. I'll have enough work without, and I want Hannibal to attack. I'll create at least two plans, naval and land attack.
                  Sounds great Laurent! And being able to put together an attack with siege weapons etc will be a good intermediate-level test of the AI.

                  I'd like most of the plans to be scriptable or flexible enough that we don't run into a problem if someone finds a tactic the AI can't think of, so it should be adjustable by changing values in resource files (or adding a tactic description) rather than recompiling some stuff. I am not sure I will be able to do that and that will not be my first priority, but it would help a lot when adjusting the AI if anyone could do it, not just a programmer.
                  Agree completely!
                  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


                  • #69
                    I have set up a few classes for the various plans.
                    Here are the 4 types I have started with:
                    Complex plans:
                    "Choice" plan (OR plan). Used to select the most successful subplan.
                    Sequential plan: The plan requires subplans to be executed in order. Failure of one subplan means the whole plan fails.
                    Parallel plan: The plan requires subplans to be executed, but not in any order. Failure of one subplan doesn't mean the whole plan fails.
                    Simple plans: Actions.

                    Each plan has a Success object. Successes are object, but could be numbers.
                    The question is: how do I compute the success of a complex plan:
                    An "and" plan has roughly a success which is the multiple of all the success value of the sub plans. An "or" plan success is the sum of the success values of sub plans.
                    However, there are rescaling factors in both cases. Plans probably need to have a success expressed as a proportion (0-1) (although it could be negative in case of failure), and a "value". That is, successful plan A means a certain value is reached. Value is different from success. That would allow me to have success as simple arithmetics when I manage complex plans, and value objects could hold more complex data if needed.
                    Opinions?

                    About Actions/simple plans:
                    I started a simple implementation in which an action runs its simulations in its own thread. That will certainly ot hold for very long, as you can't have thousands of threads running efficiently. Any ideas on how to regroup computations together so that it makes sense? I think of things like regrouping plans that seem to have lots of success into a same thread with high priority, maybe having one thread per civ, or two per civ, one for high priority (short term) and one for low priority plans (long term and plans which look unlikely to work but aren't trashed yet).
                    I won't go very far on the threaded part yet, but I want to put it in from the start because it is not very difficult, and we will have less trouble refactoring a bad thread design than making one up when the rest is complex (synchronization issues in particular).

                    I must make assumptions and simulation code next, then try to pour in some intelligence in the system.
                    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


                    • #70
                      Hi Laurent, everything you've said so far sounds pretty good to me. On the threads, I don't have a particularly good idea at this point. Your suggestions in terms of a number of threads per civ sounds reasonable so far. Another reason its good to start the threading now is that we don't want to slow the game down further
                      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


                      • #71
                        I know that heuristic AI is a dead end, but is there any way to do a quick fix so that scenario designers can give the AI instructions on what to do? Right now the AI can´t even switch unit production to a better unit when it discovers a new technology. Something simple that allows me to use events to change the parameters of the AI would be a big help.

                        For example, I would like to set the files so that a certain civ starts with a defensive attitude and production orders to invest a lot in technology. Then when it hits a horses knowledge of 1, a technologyevent changes the production orders to chariot 100% and the highcommand attitude to attack.

                        It also would be good to allow different task forces to have a different military attitude, so that, for example, the Carthage civ could be set on "stonewall" while Hannibal is set to "banzai".

                        Also, can you tell the AI to avoid fights it will lose badly? Right now it gladly tosses puny units at walled cities with enormous garrisons.

                        Comment


                        • #72
                          Originally posted by Richard Bruns
                          I know that heuristic AI is a dead end, but is there any way to do a quick fix so that scenario designers can give the AI instructions on what to do? Right now the AI can´t even switch unit production to a better unit when it discovers a new technology. Something simple that allows me to use events to change the parameters of the AI would be a big help.

                          For example, I would like to set the files so that a certain civ starts with a defensive attitude and production orders to invest a lot in technology. Then when it hits a horses knowledge of 1, a technologyevent changes the production orders to chariot 100% and the highcommand attitude to attack.
                          That should be doable. I can work on the econ side of it. Laurent, do you see any problems with this part?

                          Also, can you tell the AI to avoid fights it will lose badly? Right now it gladly tosses puny units at walled cities with enormous garrisons.
                          I've pushed for this a number of times. There were issues on it in my discussions with Laurent. You can probably find it a page or two back in the mil thread. Laurent, any re-appraisal on this?
                          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


                          • #73
                            My only gripe about the whole point is the time needed to code it. I am starting to do all the stuff needed to get simulation stuff in the "real" ai, and it will take time... I'd rather not get sidetracked.
                            Switching production could be easier to do because it is an option needed for the real ai too.
                            I think it will be some time before I can provide the changes however, because I will have to stabilize the whole code while doing the ai stuff, which impacts a lot of stuff here and there.
                            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


                            • #74
                              OK now I made my rant, I actually coded the production order stuff. I won't be coding the intelligence for siege however, because I think it is too complicated. I'd have to hardcode it instead of coding the actual ai which is supposed to be able to handle it efficiently with a totally different code. So I'd rather do the actual ai, unless someone has an idea of a simple algorithm (simple meaning simple to integrate, so it will hard to assess from the outside).

                              Anyway, since I have this change which allows a lot of improvement in scenarios and some other stuff (allowing elements of manpower 1 to survive without lasting forever...). Richard, Mark, do you think it'd be worth to make a new jar to send so you can actually use the improvements you asked for? Or do you think you may have more requests so it'd be better to wait a bit?
                              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


                              • #75
                                Slightly more on-topic.
                                I am coding the fight simulation stuff. This happens to need a copy of all known military units to simulate. That doesn't look like a problem at first, as I just need to clone() them. However, transport units carry other units, which are referenced by taskforces. Keeping the links between all these is a lot of work. I have decided to make some simplifications so the simulated command structure may not always be accurate, although at task force level, it will be. This shouldn't be a problem until we get big layered commands which are embarked onboard another command fleet.
                                But.
                                It raises a complexity problem. So before I make any more choices, here is my dilemma:
                                Do I try to simulate everything (i.e. movement + fight) or make it simple in a first run (fight only)?
                                Otherwise put, I think it's better to make simple, limited simulations first, and only afterwards add complexity (moves...).
                                I may also need a model of the world for the ai, including all known enemy units. Is there provision for scouting/assessing enemy forces without sending armies in the surrounding squares?
                                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

                                Working...
                                X