I’ve been using Nodecanvas for a while, mostly for the dialogue tree system and some FSMs. Its really cool!
I’ve been looking at the documentation for the BTs and I can see that there are many two ways of “using your custom functions”.
1. Create your own custom tasks.
2. Use the scripts in “* Script control” to invoke functions like coroutines.
What I was wondering, what you would consider the “best approach” among those two?
For one, using your customs tasks can give you more control on when a task succeeds or fail, and administer more external variables with your blackboard. However, it requires more code and adapt yourself to write lots of tasks the way NodeCanvas does. These task of course will be more generic and can be used everywhere, therefore you can use BTs as assets and technically reuse them.
As for script control, you will only need to create a custom MonoBehaviour with your functions and assign them to your BT, this will make your BT more dependent on the object is assigned to, which means binding the BT makes more sense. This can be quick and easy as far as I can see.
The issue with this approach is that, as far as I know, Script control functions that use IEnumerators will always succeed, and you cannot IEnumerators and at the same time have the ability to make them succeed or fail.
The other issue might be more philosophical. You shouldn’t use common function for a BT, and rather use task, as it was designed for.
What I’m asking, is that is there a “recommended approach” in creating custom behaviors? Are there any considerations I should take other than these I mentioned? Or maybe I am thinking this too hard and any apporach is fine?
In my opinion, both ways are equaly correct. Here is some personal advice.
If you are going to have code that you want to use outside of NodeCanvas and from within your game elsewhere, then you should definetely go with creating functions in your MonoBehaviours as you normaly would and then use Script Control tasks. This way you are basicaly building Behaviours Trees on top of your own systems in a non distracting way.
Custom Tasks are best to be created if you want some mini reusable action or condition that is not necessarily tied to some MonoBehaviour on the agent..something more generic, that could be applied and be used with any agent.
So, in my opinion if a custom task can NOT be applied to ANY agent, then it should not be a custom task and you better implement the behaviour within your relevant MonoBehaviour, and then use it with Script Control.
I hope this helps you 🙂
Let me know
Cheers!
Join us on Discord: https://discord.gg/97q2Rjh
Author
Posts
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.
Login
Register
By registering on this website you agree to our Privacy Policy.