Help with behaviour tree - Seeking and Exploring

leipea

New member
Hi all.

I'm relatively new with the behaviour tree designer but I am trying to implement a behaviour tree for an enemy that goes off and explores certain areas on the map but as soon as it sees the player it chases after them.

It's exploring behaviour works but as soon as it sees the player it will seek out the player and then immediately stop and carrying on exploring. But then it get's stuck in a loop of trying to seek the player and exploring. Would really appreciate any insights on this :)

Thanks in advance!

1704982889643.png
 
But then it get's stuck in a loop of trying to seek the player and exploring.
Which part is that? The seek random/explore branch?

Based on your behavior tree the agent will seek a random point and explore when the player is not in sight. When the player is in sight it will seek towards it. However, as soon as it arrives it doesn't have anything else to do and will return success / end. You likely want to place another node after the seek node.
 
So, I tested it with a Wait and log value node after the seek node.

but as you can see, the seek node returns a fail and the wait node doesn't get triggered. Then the agent gets stuck in the loop.
The loop is:
1. Agent tries to seek random.
2. Then see's the player with Can See Object
3. Seeks
4. Fails
5. Back to seeking random
6. Repeat

The left hand tree works the first time the agent sees the player but then returns a false and doesn't continue. Is it because the seek is returning a false when the agent is at the target players location?

1705059289463.png
 
then returns a false and doesn't continue. Is it because the seek is returning a false when the agent is at the target players location?
Yes, the seek returning false is going to prevent wait/log from running. You also have a both conditional abort which means that if the can see object task reevaluates to false while seek is running then that will also abort the branch. You may just want to use lower priority.
 
Yes. That worked! Thank you. I switched the abort type to just low priority and it fixed it.
Really appreciate all you help.
 
Top