Serializing current execution state

NodeCanvas Forums General Discussion Serializing current execution state

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #12231
    rsklnkv
    Participant

    Hi

    I know that it’s possible to serialize blackboard and graph at runtime, but is it possible to serialize current execution state?
    I really want to have fsm/tree and flow canvases to be saved at position where they were at the time of save 🙂

    #12239
    rsklnkv
    Participant

    I assume that there is no way to save current execution state, right? 🙂

    #12246
    rsklnkv
    Participant

    If someone is looking for solution for a similar question

    FSMOwner rather easy to serialize – just serialize index of currentState and on load apply it through EnterState
    Behaviour Tree – we don’t need it
    FlowGraph – for now I have no solution how to serialize current execution state of it, would be happy to be pointed into a right direction

    #12252
    Gavalakis
    Keymaster

    Hello,

    There is no way to save the exact point and state of execution at any given time in either of the systems, but you can of course save the blackboard variables that they use.
    For FSM, like you said, you can also save the currentState.
    Behaviour Trees, should be designed in a way to be able to recreate the execution state based on the conditions and variables the tree is using.
    Flowscripts on the other hand, since they are event-based, their execution state is mostly temporary and lasts for as long as the event flow signal lasts. In other words, flowscripts don’t practically have any execution state which we can store since all non temporary data are stored in the variables that it is using instead (which we can serialize independently).

    Let me know what you think.
    Thanks!

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

    #12254
    rsklnkv
    Participant

    That’s, pretty much, what I came to

    But, when it goes to flowcanvas, it should be possible to save current execution stack along side with blackboard

    Currently I’m saving all blackboards and FSM’s (tree’s, as you said, don’t need to be serialized – they reconstruct their behavior right after load), but having ability to save flowcanvas is critical for me

    Is there a point where I can start my investigation/hack to add flow canvas stack serialization?

    Thanks!

    #12261
    Gavalakis
    Keymaster

    Hello again,

    The problem as I stated before, is that an FC flowscript -as a system-, does not really has any notion of a “state”.
    More or less execution of a flow is instant (1 frame), where the only case where it is not, is in the case of some latent node usage like Wait, Coroutine or Tween, where depending on the graph design, more than one can be active and still be totally irrelevant to each other.
    I honestly can’t see how saving a flowscript ‘snapshot’ can be achieved if at all, but probably the things to look out for, would be re-starting the nodes that are not instant (wait, courtine etc), along with loading it’s internal private and temporary variables that are used for them (like time remaining etc).
    I would really instead just avoid allowing the player to save the game right in the middle of an execution process though and like most games do, allow saving only at certain “checkpoints” 🙂

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

    #12268
    rsklnkv
    Participant

    Thanks for detailed reply

    Currently I’ve decided to skip flowcanvas serialization, I’ll save blackboard and current variables from flowcanvas and right after game is loaded I’ll send an event to notify that flowcanvas was loaded, script writer must support serialization of his flowcanvas on his own (if he really needs to)

    Thanks again!

    #12279
    Gavalakis
    Keymaster

    You are very welcome!
    I think your decision to skip flowcanvas state saving is a good one and will probably save you a lot of trouble as well 🙂

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

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