Any Property can be used as PersistantIndex(int or string type) for FSMState?

NodeCanvas Forums General Discussion Any Property can be used as PersistantIndex(int or string type) for FSMState?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #15804
    123455151
    Participant

    I use FSM in NPC/Quest system,and I want to serialize current state data as SaveData.

    At first,I serialize FSMState UID and can find certain node by UID,but find that the UID for the same node has changed when starting game in next time.

    So,the UID for FSMState isn’t persistant but only unique in one play.

    Does anyone know what property can be used as  PersistantIndex?

    #15815
    Gavalakis
    Keymaster

    Hello,

    The way UID works now, is that one is generated only when it is requested and if that UID is requested in runtime, then it is not serialized. Thus the next runtime session one is requested a new one is generated. I could change this behaviour so that a UID is always generated when the node is created and this way it will be serialized and persistent. The only reason I haven’t done this already is to avoid generating UIDs for nodes that we don’t need a UID for and thus speed up deserialization.

    Let me know what you think.

    Thanks!

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

    #15823
    123455151
    Participant

    Now I know well about your design for  UID.It seems to be my fault to use UID as a serializable property. What I want  is to remember what is the current node/fsmstate of one graph,then save game data and serialize certain property of the node .The next runtime session,I deserialize the property, and enter state of the very node/fsmstate .

    Now I use the  name of the node/fsmstate  and serialize it into my own class.  When loading save data,I just load graph behaviour ,foreach all nodes and find the very one whose name is the same. I just think this way is not so such smart,and hope to use internal methods .

    Again,Thanks for  your reply.

    #16229
    todilo
    Participant

    I know this is an old post but curious if you have any code/example on how you restore state-tree from a saved file.

    #16245
    webiators
    Participant

    UIDs are now generated only when they are requested, and if they are requested during runtime, they are not serialised. When one is requested in the next runtime session, a new one is produced.

    magento 2 development services

    magento 2 development services

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