Announcement

Collapse

The Infinity Blade Forums Have Moved

We've launched brand new Infinity Blade forums with improved features and revamped layout. We've also included a complete archive of the previous posts. Come check out the new Infinity Blade forums.
See more
See less

AI Behavior Tree Editor (Think)

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

    AI Behavior Tree Editor (Think)

    Hey guys,

    My name is Ivaylo, I'm an AI Programmer working at Guerrilla Games. I have a very good experience with Unreal Engine 3, and also with other engines. One of my game dev passions is the AI. From some time I'm working on a tool for creating and modeling AI behavior trees. The tool is in a very early stage and its not very stable at this point. Basically I will describe the tool, give you some insights of what can be achieved with it at this point, and some future plans for it. I will try to make updates as soon as there is something new to be announced. My plan was that I will be able to share the tool at some point with the community but unfortunately my employment contract won't allow me to share any code. What I can do is share my progress on the tool and on the AI demo I'm working on in my free time. I'm using Think Editor for that demo. I can also share what kind of systems I'm working on, what they are responsible for and so on.


    Working Name: Think Editor

    Motivation: Why I think there is a need for this kind of tool? I have some observations from my time in the industry about creating a great AI. Most of the times when a new project is started and when the designers know what they would want form the AI, some or a couple of programmers (most of the time AI programmers) start to work on a tool for editing AI behaviors (HF State Machines, GOAP, HTN Planners, Behavior Trees, whatever). And this happens very often, almost in every single project, because the tool your team developed for the last game became so specific to the that game and it is not very reusable for the current project and the programmers will put more work modding it to their needs than just to create new tool. And most of the time creating a new tool is not that easy as it sounds. The tool must by very user friendly, because at some point you would want the designers to start using it and one of the main tasks of a tool is to save time, the tool must be bugs free, because you would want to put all of your time and efforts in creating a great and fun AI, not debugging some tool. On the other hand there is no such tool available for indie developers. Having a tested, fully functional and "Meta" (see in the description) tool like this will allow the programmers to work more on the actual AI behaviors, it will also give some tool in the hands of the indie developers, which can decrease the cost of their games (very important!) by saving time and money. I think this project is very unique in its core and in its reasons.

    Description of Think Editor: The Think Editor is an AI behavior tree editor, used for creating and editing behavior trees. The whole concept of the editor is to be very "meta". "Meta" means that the tool can be configured and used for all kind of projects. Basically when a new project starts up, someone will create a Think Editor solution, configure it to match the needs of the team and the project, and save it. Then everyone on the team can load and use this solution, much like Visual Studio Solution. Then during the project development, the team will create their own custom behavior tree nodes, and every node will have its specific user defined properties (ints, floats, strings, enums, arrays....). Then the team can use this user defined nodes with user defined properties to create behavior trees. The important thing is that a behavior tree node is defined just once and saved in the project solution and can be used in as many trees as you want. The user can also define custom enumerations, and use this enumeration as a new property type while creating a new node. How the behavior trees are exported is also user defined. Basically the export process packs the data from the editor and passes it to trough a very simple lua script. So every project will be able to create its own way of exporting the data from the behavior tree (binary, as text, autogenerated C++ code, autogenerated Unreal Script code, ...) by creating and hook their own lua script.

    Implemented functionality so far:

    This is basically the main implemented features. In time (in the next couple of posts) I will add some minor and already implemented features and will go in more details for every major / minor feature and also add a screenshots. There are some features under implementation that I won't mention at this point.

    I'm also creating a demo under UDK to test and implement new features and also an UDK code to support the exported data from the editor.

    1) Graphical node based (Kismet like) editor

    2) Create / Save / Load Think Editor solution

    3) Create behavior tree Filters (directories) for storing a collection of behavior trees

    4) Create behavior trees

    5) Create user defined nodes with custom properties

    6) Create user defined enumerations (much like creating a user defined type)

    7) Exporting (Autogenerated UnrealScript code)

    < -- VIDEO -- >

    Description of the AI Demo: The main aim of this AI demo is to research the behavior trees concept. The level I'm working on is similar to the capture and hold game mode present in the multiplayer in most of the FPS games.

    Overview of the level: < -- VIDEO -- >

    Weapons preview: < -- VIDEO -- >

    Most of the AI systems are in place and stable. Currently I'm working on the actual AI behaviors. This is a video showing my progress (sorry for the low frame rate in this video). Please keep in mind that all of the AI's in it are running the same behavior tree and that I only have a simple combat branch in place. I still don't have any squad logic, objectives or strategies. < -- VIDEO -- >

    Description of the AI systems I have in place:

    1) Behavior Tree and Behavior Tree Nodes <I won't explain each node. You have to be familiar with behavior trees. I will only explain my custom non standard nodes> - It is obvious what that is. Basically every AI controller has a behavior tree that is updated every time the controller is updated. Nodes that I have: Behavior (sequence), Selector, SelectorRandom, SelectorIfElse, Condition (check a condition when we are entering a behavior tree branch), Assumption (check a condition each time a branch is executed). Action (leaf nodes, they will create tasks add them to the task scheduler and monitor their internal status), Parallel, DataHolders(pass some specific data to other node in the behavior tree), DeciratorNOT (used with conditions to negate the condition result), DecoratorAND (used with conditions to succeed if all of the decorator child conditions results are true or fail if at least of the decorator child conditions result is false), DecoratorOR (used with conditions to succeed if at least one of the decorator child conditions results are true or fail if all of the decorator child conditions result is false). DecoratorCooldown(this is like a guard for a behavior tree branch allowing the execution of that specific branch each time the cooldown time has expired).

    2) Task Scheduler and AI Primitive Tasks - Every AI controller has a task scheduler. The task scheduler is responsible for sorting, prioritizing, executing and managing the primitive tasks that are generated from the behavior tree update. I have two types of primitive tasks - instant and latent. Instant tasks are executed for one frame. Most of the task scheduler logic don't apply on the instant tasks. The latent tasks are executed for couple of frames or even couple of seconds.

    3) Blackboard - The blackboard is a place where all of the AI systems can read and write data so they can communicate with each other. From example Primitive Task: Evaluate Weapons will evaluate all of the weapons that are in the AI inventory and will score them and save the scores in the blackboard so the next Primitive Task: Equip Best Weapon can read the result from the evaluation.

    4) NavController - Responsible for navigation mesh queries.

    5) ThreatSystem - This system is responsible for monitoring all of the already identified threats for every AI that is alive. Basically every AI has a list of threats and a whole bunch of additional information about that threat. This additional information is filled out by this and other AI systems. This system will evaluate for each AI how dangerous each of his threats are base on distance, sensory, weapons, covers and so on. The resulting value is called Threat. The AI is using this system to choose which enemy threat is best to engage in order to be most efficient.

    6) SensorySystem - This system is responsible for updating the perception of every AI. Things like which of the AI's in my threats list I can see, do I heard sounds, is a specific threat in my field of view, can I see the feet or the head of a specific threat, am I suppressed and so on.

    7) Position Evaluators - This is a collection of classes responsible for evaluating a world location based on some condition. Every evaluator outputs a penalty value associated with the tested position and based on the condition in that evaluator. For example if I want to pick a good position where I can engage my target I will use a couple of position evauators like (in weapon range, see target, maximum path distance and so on).

    8) PawnsQuerySystem - This system can be used for getting all kind of information about other pawns in your surroundings.

    9) ProjectilesQuerySystem - This system can be used for getting all kind of information about fired projectiles in the last couple of seconds.

    10) Other systems - I have a couple of other systems that I won't mentions here. Things like inventory, movement, animation, aiming, orientation and so on.

    This last video will demonstration some of the systems mentioned above. You can also see these systems debug output < -- VIDEO -- >

    I'm sorry for the brief description of the systems but I can't really go into details. It will take me hours and hours to explain each of them in details.

    Any suggestions, ideas, critiques and questions are welcome.

    Cheers!
    Ivaylo.

    #2
    None of your images work

    Also, make them jpegs, not pngs!

    Comment


      #3
      They are jpegs now, but I'm not realy sure why you cannot access them. I tested it from other PC and it works for me. Can you check them again.

      Cheers!

      Comment


        #4
        I don't have any idea if it's good or how it's going to work in the development flow - but hey, you're selling it well, dude!


        On a side note would I really like to know if there is some more than less extensive tutorial/walkthrough (like Mastering UnrealScript or Unreal University videos) about how to code AI in UnrealScript. I can help myself with what I would consider rather hacky ways, but I would be interested in seeing how a professional/experienced Unreal AI coder would tackle it with proper use of states and everything.

        Comment


          #5
          That means that your system will be like a kismet node pack ?

          Comment


            #6
            Hey ,

            1) Crusha:
            Please don't get me wrong, but this is not a tutorial of how to make an AI, its about a tool. Believe me that there are many "non hacky" ways for creating AI in UDK, everything depends on the needs of the team and the project. Because there are states in Unreal Script doesn't mean that its always the best choice for modeling an AI behavior. The part that I said I'm developing a demo, is not a tutorial too. Its a place where I can test different AI behaviors very fast and test the tool.

            About the selling part , I'dont sell anything to anyone, I just want to see if there is an interest in this kind of tool, to see if there are other developers that think the same way as me, and to see if there is a point of developing it with with the idea of other people using it.

            2) Neongho:
            Yes, but outside UDK, because I don't have the source nor the means to integreat it in the editor. I hope you can check the screenshots from the first post (hope they work ) and see that the tool already has a kismet like graphical representation.

            Cheers!
            Ivailo.

            Comment


              #7
              Originally posted by SpowNzz View Post
              Hey ,

              1) Crusha:
              Please don't get me wrong, but this is not a tutorial of how to make an AI, its about a tool. Believe me that there are many "non hacky" ways for creating AI in UDK, everything depends on the needs of the team and the project. Because there are states in Unreal Script doesn't mean that its always the best choice for modeling an AI behavior. The part that I said I'm developing a demo, is not a tutorial too. Its a place where I can test different AI behaviors very fast and test the tool.

              About the selling part , I'dont sell anything to anyone, I just want to see if there is an interest in this kind of tool, to see if there are other developers that think the same way as me, and to see if there is a point of developing it with with the idea of other people using it.

              Neither did I ask from a tutorial from you nor did I expect you to sell it.

              The mentioning of a tutorial was just a side note because we the AI topic came up here. Just in case anyone had some good links to more in-depth AI related stuff in UnrealScript. Using a wizard can be all good, but it's always better if you have some background knowledge so that you are able to go into the autogenerated code and potentially optimize it yourself. (I know people who manually edit the compiled output of their C compiler to further optimize it.)

              And you can also "sell" something by the meaning of "getting it across to people/making it look really desirable".
              Looking forward to further updates.

              Comment


                #8
                Hey Crusha, I got you!

                About the AI part: there are lots of Unreal Script code that is not autogenerated, in order the autogenerated code to work. Basically the autogenerated code gives you something like a skeleton on which the AI logic to execute, but every single node is implemented in Unreal Script, much like kismet (every kismet node has a specific Unreal Script class). The idea is to reuse the already implemented nodes many times (like Kismet), also this is one of the top features of the behavior trees - reusability and modularity of the AI code. There are many custom coded system and classes wrapped around these autogenerated classes in the demo I talked about and hopefuly in a time I would be able to share some of it, and it can be used as a tutorial of some kind about how to make an AI in different way from the UDK documentation.

                Cheers!
                Ivailo

                Comment


                  #9
                  I supose that it'll be for FPS games right?

                  Comment


                    #10
                    Originally posted by SpowNzz View Post

                    2) Neongho:
                    Yes, but outside UDK, because I don't have the source nor the means to integreat it in the editor.
                    You do not need source access to add kismet functionality. Kismet is all UnrealScript in template form.

                    Comment


                      #11
                      thats graet is there something bad of UDK ? except of the static light?

                      Comment


                        #12
                        Originally posted by Graylord View Post
                        You do not need source access to add kismet functionality. Kismet is all UnrealScript in template form.
                        What I mean is that I don't have the UE3 editor source code and because of that I can't integrate or create the tool into the UE3 Editor. And I don't want to keep it in Kismet for some reasons regarding the "Meta" stuff.

                        Regards,
                        Ivailo.

                        Comment


                          #13
                          Originally posted by Graylord View Post
                          You do not need source access to add kismet functionality. Kismet is all UnrealScript in template form.
                          Not realy, The core idea for the tool is to be used as in many different ganres as possible. And yes, the demo that I use for testing is kind of a shooter, but that don't limit anything. The tool ca be used for races, RTS (keep in mind that there are RTS games like Starcraft I that uses behavior tree for modeling AI behaviors), and other. I'm thinking of exapnding it ouside behavior trees in the future, so it can cover more ganres, but its too early.

                          Btw, everyone that are not familiar with behavior tree conept can make a quick search in google (there are some good documents), and also use some of the free tutorials at AIGameDev that are aimed at beginners.

                          Regards,
                          Ivailo.

                          Comment


                            #14
                            Hello, is this project still alive? What is it's state? I am interested in using it.
                            Thanks for reply.

                            Comment


                              #15
                              Hi guys,

                              The project is still alive. Sorry for not updating the topic for months but the thing is that during the past 2-3 months I was very busy with changing my job and relocating to Netherlands to start working for Guerrilla Games. Right now I'm fixing a couple of major bugs in the behavior tree implementation and I will post an update soon.

                              Cheers,
                              Ivaylo.

                              Comment

                              Working...
                              X