I always try to design my behavior trees with the standard features like parallel, sequence and selector. If I have to abort something I have sequence with a detection of a variable I can set and unset. In parallel I have the logic for the abort which sets or unsets that variable which kind of mimics an abort. Not sure if that’s what you where looking for.
There are as well some guards in it which might go in the direction you want maybe. I never used it.
And yes I use ig a lot not just for AI or NPCs. My latest usage was for a window-camer and projected-focus
@ia97lies are you dynamically switching tasks in the behavior tree?
For example, say a player can do these simple actions from the action bar:
sword attack, fist attack, and gun attack.
(suppose the above actions are not instant actions means that when triggered, the agent will automatically move into a proper distance from the enemy then start the action and the action might repeat itself a few times until the enemy dies, similar to the auto-combat in mobile RPGs)
Would you create a new task whenever an action is triggered and replace it with the currently running task in the behavior tree?
Hi, not sure if I understood correctly but every NPC or in my case as well weapon do have their own behavior tree instance. For example to model my weapon behavior I have to wait at some point until the player or NPC realeases the trigger and for that I have a WaitUntilSuccess wrapper task which stays in the state RUNNING until the trigger gets released task does succeed and then it returns SUCCEEDED. I guess in your case this is the attack until the opponent is down or can escape. Not sure if it makes sense to you what I’m saying and if I answered your question. Here I wrote a blog post about behaviour trees and there is this wait until success in action (code sample in the end) Behavior Trees for Weapons – artificials.ch
Btw behavior trees had a similar impact of the way I’m looking at problems like ECS it’s a great way to reduce complexity and improve flexibility.
Oh yes I do this as well. Ever specialized NPC has his behavior and I do not have one big one. And yes you can have behaviors even in tasks. I actually have that as weapons have a behavior and NPC which uses have behaviors. So I do exactly that what you describ and have a good experience with that.