Sharing behavior among agents

mbussi

New member
Hi everyone,
what is the best approach to sharing the same behavior tree between multiple agents? Let's say I have a relatively complex tree, handling movement along a list of waypoints, starting and stopping conversations with the player (and related animations syncing), fleeing when attacked, etc. I would like to apply this tree to 5-10 different NPCs in my scene. Do I need to create a behavior tree for each NPC or is there a simpler way to apply the same behavior to all of them while at the same time be able to customize the single tasks (i.e. give NPC 1 waypoint set 1, NPC 2 waypoint set 2, etc)?
 

Justin

Administrator
Staff member
You can use an external tree which will allow you to reuse the tree:

 

chaneynow

New member
External Behavior Trees only work if you are willing to go through the painstaking process of reestablishing all of your property mappings with each new use of that tree. My enemy CombatTree has 28 property mappings so it's a very cumbersome process. Would love for some way to be able to do property mappings through code.
 

Justin

Administrator
Staff member
On the base behavior tree component you could have a property mapped variable, and then have that same variable on the external tree so it gets consumed.
 

chaneynow

New member
Thanks Justin. Your suggestion is how I have things setup now when trying to use an External Behavior. If you don't mind, I'm going to start a new thread on this so I don't takeover mbussi's thread.
 
Top