Managing game states with NodeCanvas

NodeCanvas Forums General Discussion Managing game states with NodeCanvas

Tagged: ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #13200
    11tomi12
    Participant

    Hello! We’re searching for a way to store game states in between scenes and since we’re already using NodeCanvas, I’m looking for a way to use it for that purpose.
    Let’s say we want to build a rocket in a set scene. For that, we need to collect items in various other scenes. So we need to save all those actions regarding rocket building so we can later recall it in that scene to check, if we can build the rocket.
    For that I would have one graph in each scene that executes when scene is loaded. The graph would check for dynamic stuff in that scene(for example: some people would appear only after I talked to someone in a different scene). The graph would also set and change some variables(maybe in a global blackboard) and call some functions or disable whole gameObjects.

    My question is: Would it be practical to use NodeCanvas for that matter and which tree would be the best for this task?

    Thank you for any help!

    #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

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.