No announcement yet.

Behavior Tree ticks

  • Filter
  • Time
  • Show
Clear All
new posts

    Behavior Tree ticks

    Hello , I am French, sorry in advance for my writing mistakes.

    So i've been wondering about the tick system in Behavior Tree, let me explain:

    In the begining of the Behavior Tree witch I added breakpoint , right after pushing play , the Behavior Tree execution is at the first task (Picture1) waiting to be execute, the first task end successfully then the Behavior Tree is waiting at the second task. when the second task end successfully the execution goes back to the root.

    So here are my questions :
    - First : Is a tick needed at the begining of the tree . So to explain a bit more , let's say at the begining of the execution ( TICK 0) do we need a TICK to go to the first task (So TICK 1) or are we at TICK 0 when we are waiting to execute the first Task ,
    - Second let's say we end the first task at TICK n do we begun the execution of the next task at TICK n or at TICK n+1(do we need one tick to go to the next task to be execute) (Picture 2)
    - Third , at the end (picture3) do we need a tick to go back to the root, more precisely , let's say the last task end at TICK n , When does the next task (the first one will be execute) TICK n+1 TICK n+2 ...

    In my understanding for now (let's say we just need 1 tick to complete task1 & task2) , we begin the first task at TICK 0 , after this tick we begin the second task at TICK 1 then after that we go back to the root who use the next tick so TICK 2 we are at the root and the next execution will be TICK 3 at the first task

    I hope I have been able to explain , feel free to ask me more detail about my question if needed

    ps: when I talk about "ticks" I only talk about the one of the behavior tree (let's say for exemple that the behavior tree is a closed system)

    Thank you , Ryseur

    1. You don't need a tick to "start" the behavior tree, it automatically starts when you run it from the root to the first execution path.
    2. It does take one frame (tick) to go back up the tree, you can see this if you run the behavior tree one frame at a time you will see where the highlighted path is at each frame
    3. Yes, it takes another tick to move back up each time and then back down.

    Hit play on your game, then pause, open up the behavior tree and then hit the frame by frame forward button and you will see exactly what is executing in each frame. No need to guess, there is a way you can see it for yourself.