BehaviorTree Service Events

I have some general questions on the events in services that you can implement using Blueprint (sub-classing BTService_BlueprintBase). Specifically, you can override the following events:

  • Receive Tick
  • Receive Tick AI
  • Receive Search Start
  • Receive Search Start AI
  • Receive Deactivation
  • Receive Deactivation AI
  • Receive Activation
  • Receive Activation AI

What’s the difference between the AI and the Non-AI counter parts? Is there an in depth documentation somewhere that I can read about them?

Thanks,
Oscar

Hey Oscar,

There’s no in-depth documentation on this, but the concept is extremely simple: the AI versions get called when BT is being run for an AI controller AND given event’s AI version is implemented. We do detect if given version is implemented or not, and if you don’t implement the AI versions the regular ones will be called.

Let me know if it needs more clarification :slight_smile:

Cheers,

–mieszko

I was hoping to gain some insights into the difference between the events. Based on the name, it seems, for example, receive search gets called when the behavior tree is searching for a task to execute? Therefore this is more suited for a decorator? Additionally, what’s the difference between activation and tick? I noticed that in a service activation gets called several times (sometimes once, but sometimes up to 7 times) every few seconds (or perhaps it is the time specified in the service 1 ± 0.5 ?).

  • SearchStart is called when given node is encountered while searching for next task to execute
  • Activation and Deactivation are triggered when node becomes/ceases to be part of active subtree
  • Tick is when the node ticks. For task and decorator nodes that would be every tick, for services it depends on the properties

Please double-check if you observe different behavior in terms of Activation event, because what you describe doesn’t sound right.

So currently I’m using the “Receive Activation AI” event to find a random point (a Blueprint node that’s out of the box). I added additional debug rendering to show what that point is and the line to it and also prints out a count each time this service is executed. When I run the game, I see multiple lines and points being drawn and the count is printed out more than once. The number would vary from frame to frame. It is not spamming because in the Behavior tree I have a wait task right after the MoveTo task (to the point randomly selected in the service). What I do see is different number of executions and therefore, random points and debug drawings being executed after the MoveTo has completed each time.

It seems like what you are suggesting is that I should be using Tick AI and the service would be ticked according to the random time gaps?

I’d need a screenshot of your BT setup to be able to tell what’s going on :slight_smile:

Thanks Mieszko, I am using a different approach now and basically if there was any problem, I am getting around it. I think I should have used the Tick or Tick AI instead of on activation for a service. I see a lot of tutorials use “Receive Execute” which is not found in BT services or tasks I think. What is its replacement?

ReceiveExecute is available only in Task nodes.