NostromoKhan
Member
Similar to this thread:
I have a handful of gameobjects the player controls very similar to a RTS/squad type game. It appears ExternalBehavior trees are the recommended way to go if you plan on issuing orders from runtime, correct? I plan on having an orders/job system similar to the above post where there will be small BT's (external) to do various operations. The key requirement is that i load all these during runtime (via eventing handled through buttons/hotkey in the UI to issue orders to the units).
I have 2 questions:
1) Are ExternalBehavior trees the way to go if you want to load/run/enable/disable through runtime? It seems this is the approach the system would like us to use.
2) I have some prototyping code that I have been playing around with and so far its been working good. However, in the below code it runs "Orders_Test" twice. Orders_Test BT only has one Task - Log which has a message 'xyz' and it is playing twice. I have triple checked that this is the only BT in the scene and i have it nested in a right click event and the right click event is only logging once so it seems like somewhere within the BT logic. Thanks!
Dynamic instantiation and assignment of External Behavior Trees
Hi all, I'm implementing BD and what I would like to have is the following: I have classic "AI agents" who should be able to pickup different tasks/jobs (base building style). The execution of those jobs is different depending on the type of job. So what I would like to do is to separate...
www.opsive.com
I have a handful of gameobjects the player controls very similar to a RTS/squad type game. It appears ExternalBehavior trees are the recommended way to go if you plan on issuing orders from runtime, correct? I plan on having an orders/job system similar to the above post where there will be small BT's (external) to do various operations. The key requirement is that i load all these during runtime (via eventing handled through buttons/hotkey in the UI to issue orders to the units).
I have 2 questions:
1) Are ExternalBehavior trees the way to go if you want to load/run/enable/disable through runtime? It seems this is the approach the system would like us to use.
2) I have some prototyping code that I have been playing around with and so far its been working good. However, in the below code it runs "Orders_Test" twice. Orders_Test BT only has one Task - Log which has a message 'xyz' and it is playing twice. I have triple checked that this is the only BT in the scene and i have it nested in a right click event and the right click event is only logging once so it seems like somewhere within the BT logic. Thanks!
Code:
string behaviorTreePath = "BTs/Orders_Test"; // Path to the Behavior Tree asset in the Resources folder
ExternalBehaviorTree behaviorTree = Resources.Load<ExternalBehaviorTree>(behaviorTreePath);
BehaviorTree behaviorTreeComponent;
behaviorTreeComponent = gameObject.AddComponent<BehaviorTree>();
behaviorTreeComponent.ExternalBehavior = behaviorTree;