A Finite State Machine (FSM) Behavior, Used to control the flow of logic for objects.
Hi piranha305 !
Thanks for this great addon.
The FSM does not seem to be global, so when we change from one layout to another, we lost the FSM state of objects. It this the expected behavior ? Do we have to implement temporary save in the local storage to keep this information between layouts ? (or use an instance variable + Persist to store the current state of an object ?)
this addon is a behavior, attach to a specific object instance.
if you mark that object instance as global it should carry on to the next layout... but depending on your game, you might want to handle saving the state yourself. but that depends on your project
from the docs :
construct.net/en/make-games/manuals/construct-3/project-primitives/objects/instances
Global
By default, all instances are destroyed when the layout ends (e.g. when going to the next layout). If enabled, none of the instances of this object type will be destroyed when switching layouts.
thanks for the quick reply and advice mostly about C3 than you addon :D (finally)
indeed, global instance make sense (the FSM is on NPCs, so it depends of the number of NPCs).
we choose to handle the state ourselves on the object with the Persist behavior, and syncing the state to the FSM, keeping the advantages of the FSM. we should reconsider global instance too, but it will probably come with more memory overhead.
thanks again for pointing this out.
Yeah for something like Npc I would manage the state on layout load.