Reply To: Managing game states with NodeCanvas

NodeCanvas Forums General Discussion Managing game states with NodeCanvas Reply To: Managing game states with NodeCanvas

#13215
Gavalakis
Keymaster

Hello!

Just as you’ve described, the trick here to maintain some persistence across the different scenes, would indeed be to use a global blackboard, so that it’s variables can be accessed on all scenes (remember to set the global blackboard DontDestroyOnLoad to true though 🙂 ).

As far as which graph to use, a Behaviour Tree sounds like a better fit here, since you want to (based on the variables stored in the global blackboard) dynamically “bring” the the scene to a specific state.

An FSM would not be ideal in such a situation, since for a state to be reached, all intermediate states from the “START” state up to the end state you want to come up with, will need to be executed at least for one frame. That is unless of course, you create a really lot of transition conditions FROM your “START” state and INTO any possible state, but that really doesn’t sound very convenient 🙂
Thus I think, a Behaviour Tree is more suitable due to it’s “dynamic” and “immediate” nature.

Now as far as whether or not it’s practical to use a graph VS doing it in code, I think it depends on the rest of the game architecture, but using a graph is certainly something possible.

If you want want to elaborate further on this, just let me know 🙂
Thanks!

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