Should the Service TickNode be called at this rate?

I created my own Service, and overrided the TickNode assuming that this would only be called according to the interval set in the Behavior Tree. However its being called what at what I imagine is the tick rate.

29163-servicetick.png

The OnSearchStart was called twice (was that supposed to happen?) as shown the image then with 10s intervals, as it should, but the TickNode is constantly being called even though I confirmed that the Interval variable was set at 5.0 as it should.

Hi ,

Can you show me what your service looks like? Also, which version of UE4 are you using where this occurs? I have a couple of ideas of what may be happening, but if I can get some more details it would help.

Sure thing, thank for the reply.
I’m using the 4.6.1 version with the following code:

From the .h file:

UCLASS()
class MYRTS_API UBTService_SearchEnemy : public UBTService_BlackboardBase{
	GENERATED_BODY()

	UBTService_SearchEnemy(const FObjectInitializer& ObjectInitializer);
	
protected:
	virtual void TickNode(UBehaviorTreeComponent* OwnerComp, uint8* NodeMemory, float DeltaSeconds);

	virtual void OnSearchStart(struct FBehaviorTreeSearchData& SearchData);
};

From the .cpp file:

UBTService_SearchEnemy::UBTService_SearchEnemy(const FObjectInitializer& ObjectInitializer)
	:Super(ObjectInitializer){
	NodeName = "Search Enemy";
}

void UBTService_SearchEnemy::OnSearchStart(struct FBehaviorTreeSearchData& SearchData){
	Super::OnSearchStart(SearchData);
	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Magenta, FString::Printf(TEXT(" search start")));
}

void UBTService_SearchEnemy::TickNode(UBehaviorTreeComponent* OwnerComp, uint8* NodeMemory, float DeltaSeconds){
	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Magenta, FString::Printf(TEXT("tick interval: %f delta: %f"), Interval,DeltaSeconds));
}

I resolved the situation, apparently it required me to add the call the same function on the parent by using Super::Ticknode(…). It’s weird because I looked at the BTAuxiliaryNode::TickNode and it was empty, so I didn’t thought to call super, but apparently BTService::TickNode has some code and I missed it.

Does this mean that the function is always being called, but somewhere the parent just stops the execution of inherited?

BTService implement TickNode, which random next tick time and call BTAuxiliaryNode.SetNextTickTime(…, NextTickTime). AuxiliaryNode will remember this NextTickTime and call TickNode when reach the time.

If supper::TickNode is missed, AuxiliaryNode won’t know the correct NextTickTime, so call TickNode every game loop tick.