No announcement yet.

AI Behavior Tree - Service or Task? how to choose?

  • Filter
  • Time
  • Show
Clear All
new posts

    AI Behavior Tree - Service or Task? how to choose?

    TL;DR: What are the guidelines to create a service vs a task for a specific action?

    I'm looking into Behavior Tree and I'm looking into some guidelines on when to use a service vs task.

    For example, I was thinking on using a task to find the AI enemies (like the player), using a perception component.
    I then looked at the ActionRPG example, and noticed they have a service to doing something like that.

    I then thought perhaps it's about an actual action (like moving) vs updating the blackboard. But I found a node in the same ActionRPG example
    with a task for "Finding new location round target", which is the same thing.

    So what is it? What are some points/guidelines that can help one decide if he should use a service or a task a behavior tree?


    Have you seen what the documentation has to say about the issue? Maybe there is a snippet in there that clarifies the best way of implementing your idea. Unfortunately, I personally do not have an answer for you.

    Decorator Nodes: Also known as conditionals. These attach to another node and make decisions on whether or not a branch in the tree, or even a single node, can be executed.

    Service Nodes: These attach to Composite nodes, and will execute at their defined frequency as long as their branch is being executed. These are often used to make checks and to update the Blackboard. These take the place of traditional Parallel nodes in other Behavior Tree systems.


      Yup, looked already. Tried to look all over the documentations and examples.
      There doesn't seem to be any guideline as far as I can tell, and I'm not really sure when to use which.


        The service is to get information that is then used to make decisions: "Finding new location round target", "low hit points?"...

        The tasks are more the physical actions of the character: "Move to target", "Use health potion"...


          Services best sit on the selector or sequence nodes. They are good at making calculations on that node.
          Tasks do exactly that.

          Services biggest thing is that they can run parallel, like you can have an AI run via a task and shoot via a service.

          Check out my page, I'm really excited about it.

          Please check out my AI package: Action AI System Feat. Stealth

          or get it from itch