Original Post
I have been trying to understand behavior trees (BTs) and how they relate to HFSMs (or FSMs) for use in an up coming project. Specifically ive been trying to figure out how I would encode the capabilities of my current simple FSM into a BT. I know the following example might not be the best case for a BT, but im just trying to get a feel of how it could be implement via a BT. I have read a bit about BTs (and watched that AIGameDev video), and have yet to fully grasp them.
So i have 4 states in my FSM:
Idle
Suspicious
Attack
Flee
Idle can transition into Suspicious if there has been a perception of the players presence without actually seeing the player (e.g. player knocked over a lamp).
Idle can directly transition into attack if the player is visually spotted
Suspicious (enemy is actively searching for player) can transition into attack if the player is visually spotted
Suspicious can transition back to Idle after a certain amount of time searching.
Attack can transition to idle if the player has been killed
Attack can transition to Flee if the agent becomes too damaged
Fleeing is trying to get away from the player, while at the same time seeking out some health if the player is believe to have been evaded.
Flee can transition to suspicious if the agent has picked up some health
How could something like this be encoded into a BT, with selectors, sequences, parallels, decorators, etc. ?
After the entire tree is evaluated, is it reevaluated from the start?
Any guidance would be appreciated.
Thanks
So i have 4 states in my FSM:
Idle
Suspicious
Attack
Flee
Idle can transition into Suspicious if there has been a perception of the players presence without actually seeing the player (e.g. player knocked over a lamp).
Idle can directly transition into attack if the player is visually spotted
Suspicious (enemy is actively searching for player) can transition into attack if the player is visually spotted
Suspicious can transition back to Idle after a certain amount of time searching.
Attack can transition to idle if the player has been killed
Attack can transition to Flee if the agent becomes too damaged
Fleeing is trying to get away from the player, while at the same time seeking out some health if the player is believe to have been evaded.
Flee can transition to suspicious if the agent has picked up some health
How could something like this be encoded into a BT, with selectors, sequences, parallels, decorators, etc. ?
After the entire tree is evaluated, is it reevaluated from the start?
Any guidance would be appreciated.
Thanks