Wander task and manual ticking

Ormy

New member
Hello!

I'm been having trouble where I need to tick my behavior trees manually but wander task doesn't set new targets and my agents walk to their first destination and then stops. It works if manager is set to every frame or manually tick in update. I can see the Wander-task green as it should. Any idea what might be going on here? I really need to tick them manually for good performance. Thank you!
 
Setting it to manual should be no problem. I would start debugging this by placing a breakpoint within Wander.OnUpdate and seeing why it doesn't set a new target.
 
Setting it to manual should be no problem. I would start debugging this by placing a breakpoint within Wander.OnUpdate and seeing why it doesn't set a new target.
Was afraid that's the case. I'll start debugging it tomorrow then. I did some already but it seems like it goes through the update once or twice and when the agent arrives to their first destination, they just stop and don't even try anymore, like the update doesn't loop. I've done a custom version of the wander for my own needs but the normal one didn't work either so can't be from that. I'll have a fun day tomorrow then :D
 
Setting it to manual should be no problem. I would start debugging this by placing a breakpoint within Wander.OnUpdate and seeing why it doesn't set a new target.
Hello. We debugged this. Running doesn't loop at all. It goes through it once and stops. Could you have any idea why? I'll try installing it on a fresh project and see if ours is somehow broken.
 
If it stops then some other task is likely stopping the tree from executing.
 
If it stops then some other task is likely stopping the tree from executing.
It doesn't stop as in don't run the task or tree anymore. Tree is going and task too. No other trees are enabled. Animals should just wander endlessly until they need to do something else. Now they walk to a single spot and won't even try another destination. Task status is running, bebugged that too. We circled the problem for now by ticking the tree when animals arrive to their destination.
 
If it stops then some other task is likely stopping the tree from executing.
Should the wander keep wandering in the movement example scene if you put it to manual there? It's seems to be similar to what I'm experiencing. It starts, goes green like it's running but the bot is not moving. Thanks for the help :)
 
If you put manual then wander will only pathfind once. You need to keep ticking the tree in order for it to search again.
 
If you put manual then wander will only pathfind once. You need to keep ticking the tree in order for it to search again.
That makes sense! I first thought that the update with status running will keep going by itself. Now that I know this, ticking the tree when they arrive seems to be a pretty good option :)

I'll ask another question here so no need to open new thread since it might be a small thing. Is there a way to reset a tree after ticking it if it returns failure, except disabling and enabling the tree? Example. our animals sight tree is ticked when player is close enough for it to see it. It goes through the tree but if it returns failure as can't see the player, ticking it again won't run the tree anymore. Disabling and enabling the tree makes it run again with new tick. This becomes quite heavy, especially if there are many animals around. Thank you so much for your help!
 
Glad you figured it out!

Disabling and enabling is the correct way to restart a tree, and the objects are reused to reduce the impact of the restart. With that said, you may be able to place a repeater at the base of the tree that repeats forever even if the child returns failure. This will keep it active and you can then just tick it again when the animal is ready to move again.
 
Glad you figured it out!

Disabling and enabling is the correct way to restart a tree, and the objects are reused to reduce the impact of the restart. With that said, you may be able to place a repeater at the base of the tree that repeats forever even if the child returns failure. This will keep it active and you can then just tick it again when the animal is ready to move again.
Thanks for the reply! I worked on this for two days (almost no sleep since I was annoyed by it haha) and fixed it by placed an idle at the end of hearing and sight trees which keeps them active. Repeater didn't work for some reason, even if I set it to forever. But it seems to work now :)
 
Top