Reply To: Help with Submarine AI Design

NodeCanvas Forums General Discussion Help with Submarine AI Design Reply To: Help with Submarine AI Design

#12155
Gavalakis
Keymaster

Hey,

I think that you probably need to use a Parallel node so that your Sensors are always updated (thus up-to-date), instead of using a Dynamic Sequencer, and in return the rest of the nodes can work with the up to date sensor data.

Another thing I personally always recommend, is to instead of getting sensor information and setting them to blackboard variables (2 steps), would be to make it all into one step by Property Binding the variables directly to a property that returns this information you need.

I see that you’ve already used bound properties for what I see to be an AIMono type, but I suggest you try using bound properties for all variables / information that need to be up-to-date on demand.
You could for example create a custom MonoBehaviour class only with properties you need and attach it on the gameobject in question, then create a bound variable for each of those properties you make in the class.

The general design approach I suggest, is to avoid doing complicated things within a behaviour tree. Meaning, don’t try to use is as a visual scripting system to replace code by doing algorithmic things within it. Instead use BTs to directly “TELL” the agent what to do, with property bound variables as a backend of information.
This is quite in theory of course 🙂

Using a Switch Enum composite is also a good idea indeed, to make the BT select the branch to continue with. You can of course create a custom enum type variable to use for the Switch Enum composite.

To return to your initial issue, I once again think that you need to use a Parallel node if you want things to happen simultaneously with other things, or move those sensors to be property bound variables and as such always up-to-date on demand, by having the property doing the math and return the information needed instead of fighting against setting a variable all the time.

Please let me know if that helps at all, or if you want to elaborate on anything.
Thanks!

Join us on Discord: https://discord.gg/97q2Rjh