[BUG] Service timing in behavior trees

Hi there,

yesterday, I upgraded my project to version 4.12 prev. 5 and my AI was jumping around the map like a mad chicken. Turns out my waypoint picker service is getting called something about twice a second, although it should be called every 10 seconds (pic)

I’ve tried it for selectors and simple parallel nodes and the specified tick time doesn’t work with neither of them. Different from the behavior in version 4.11.2, so maybe a bug?

Kind Regards

as far as i understand, services are not timers for the branches below just by themself. if you want the branch to depend on the service, you would have to do a little extra logic there. Sorry for the totally undescriptible names but i hope you get the idea. My Service runs every 1s and assigns a message to the blackboard, the task runs if the value is set and unsets it on the same task, the task will abort itself when value is unset and the tree will stay on the service, until the value is set, then the branch will re-activate. not 100% as your example but i think it explains enough to apply on your case. just add an extra decorator on your simple parallel and reset the value when you are done (on MoveTask for example).

This was one on 4.11.2

No, I think, you got me wrong. Of course a service isn’t a timer for successing tasks. My WaypointPicker just rolls a dice every 10 seconds and sets a waypoint in the blackboard. The MoveTask then moves to that destination. Before 4.12 the service indeed picked a waypont once every 10 seconds. Now, the service runs about twice (can’t determine the exact frequency) a second (although it is set to 10 seconds)

in my screenshot the service does run and sets the Message value every 1 second so maybe you are setting something wrong on your service. my test is done in 4.11.2

yes, and as I stated in my post: it’s broken in 4.12 Preview

and this is on 4.12 preview 5, you can see the service is selecting every 1 sec, instead of randomly spamming the selecting (thats why its repeating the same value). for this example, i didnt let the task abort itself.

then, why is your service running every second? because you’ve specified it? But that’s what I’ve done as well, but my value (the service is basically just setting a vector every 10 seconds) is set about twice a second. Regardless whatever task is running after that

the question is: what has changed between 4.11.2 (where everything was fine) and 4:12 prev 5?

you are right, i just couldnt timed it correctly cause the interval was too short. tested the same BP on 4.11.2 and 4.12, 4.12 runs it twice every second (it basically always uses the default interval settings on services). steps to reproduce are straightforward.

  • create tree
  • add interval on service
  • add integer assignation on service
  • you will see the resulting integer will always be the doble as the elapsed time

sorry to kinda mislead you. hopefully Epic staff sees this.

I’ve just tried it with what you may call 4.12+ and wasn’t able to repro it. Make sure your service has both CallTickOnSearchStart and RestartTimerOnEachActivation set to false. Let me know if it helps or not (ping me on twitter or something :slight_smile: )

Cheers,

–mieszko

hi Mieszko. thanks for the follow up. sadly i dont have the project so i couldnt test it right away, i did try to replicate the issue but not even the ticking worked, and other stuff came up so decided to fix my own stuff first! now i got my 4.12 engine compiling (40min of waiting…) ill try this again later on the day.

Just checked… they’re both unchecked.

Tick Time is set to 10 but the variable value changes still about twice a second.

Ok, this is the situation now

Updated my 4.12 preview 5 to 4.12.0 (release)

created a new project, added a pawn, set up an ai controller, attachted a behaviour tree with a blackboard to it and created a service which doesn’t do anything but printing the time delta. The service should run every 5 seconds. When I run the scene, I see a message every 0.4 to 0.6 seconds on the screen.

If I change the engine version to 4.11. I get the message every 5 seconds. The mentioned parameters (calltickon… restarttimeron…) are both set to false.

I also have tested it on a different system. Same Result.

Hi Mieszko, i tried this on 4.12 release (built from source) and the master branch (4.13) and it still gives me the same error. if i set the observer to break the task, then it will wait for the next service tick (dont have the exact example but i remember it working fine like that), it just doesnt work if you just let it go through without any type of break.

all the setup is on this screenshots, blackboard is empty, actors, ai controller (only the run tree on begin play), everything was made on new templates. i have uploaded the project as well (4.12) if you need to check for anything else but thats pretty much it

  • new project
  • new character
  • new aicontroller
  • new blackboard
  • new tree
  • new bttask
  • new service
  • set service to 5seconds (or whatever higher enough to not be confused with the low timed tick)
  • set task to print something and finish task with finish execute (success or not makes no difference)
  • make tree with service on node
  • see the print spam.

the project will be uploaded in a few minutes (slow internet)

UPDATED 4.12 project https://drive.google.com/open?id=0BxVkFZ_FgTxQU3NfMm5jQTM3dU0

related post

however, it doesnt explains why it works (or maybe it was broken on 4.11) differently before. however, that post says the same as my previous point…that you have to break the task/node before the service starts opening the branch again.

Will try this as soon as possible, but my prediction is: the service in the sequence node will run every 0.5 seconds no matter what you specify

you are right, it still spams and the task doesnt even care about the decorator which is even more fun…

i got my other behavior trees running fine so i doubt im messing with the “how it works” basics.

Just checked.

Still broken in version 4.12.2

I have the same issue, just upgraded and it has broken a lot of the AI. I can figure out a workaround but it is quite important this gets fixed.

Seems to be fixed in 4.12.3