Playmaker Forum
PlayMaker News => General Discussion => Topic started by: Mark_T on June 06, 2012, 03:16:13 PM
-
What do you think about this (http://forum.unity3d.com/threads/138678-Unity-Save-Game-Level-Serialization) ?
I`m not a programmer but some things I read there looked interesting to me.
I would love to hear the feedback of the more experienced playmakers, and of course, especially from the ones with programming feedback. :)
Thanks.
-
Hi,
Due to the wrapped up nature of Fsm, states , actions and fsm variables, I don't think this kind of framework are suitable as is. because they actually go through the script itself to find what to serialize, and it won't be able to access a playmaker Fsm. It would require a specific implementation to understand and work with playmaker.
I would instead take level saving and loading in consideration right from the beginning of the thinking process to implement routines and patterns in each Fsm to account for this. that's a lot of work. IF Fsm could be saved as a xml, this would be trivial, I have been mentionning this several time actually, and this is actually going further, meaning saving a Fsm not just by its state during editing, but also taking a snapshot of it at runtime, and be able to load it back whenever and start from there. That would be quite good indeed, but would need to be something built in playmaker, not sure that it's possible to do that with the current playmaker api ( It might very well be tho)
bye,
Jean
-
Aha, I understand. Or I think I understand.
Would it be possible to unwrap, or to expose, some of the "values" in Playmakers actions? Something like an option or a checkbox that needs to be clicked to expose a specific value, or a bool, etc.
Or maybe a Playmaker built-in addon?
Sorry if I`m talking rubbish. :)
It`s always a pleasure when I get some enlightenment in some of the darkest corners of my mind.
Many thanks Jean.
-
Hi,
Not really, unless you are ready to rewrite ALL the actions you are going to use in that project...
instead I would write actions to explictly serialize Fsm variables or for example the current state name of a fsm. and an action to get that when Fsm start or upeon a specific event and simply move to that state and set the variables. I think that path is possible, I even dare saying that one action could simply scan all variables of the fsm in one go to read of write against this framework, but not tested, just a guess.
Bye,
Jean
-
I'm a big fan of PlayMaker and have used it myself in a couple of projects. I'd be happy to see if I could get PlayMaker scripts to store using my serializer - though I would imagine that there would be quite a lot of initialization to go through after deserializing.
-
Hi,
Well, For a given Fsm,it really only need to store the current state and the variables values, so I think the big effort will be in finding your way in the playmaker api to access them,
I created a guiML system ( not yet release, just getting dusty in a corner of my hardrive, waiting for something...) that parse an xml file to create gui component on screen, tightly coupled with Fsm variables and events, even implementing multi bindings of variables. So I do have examples of api calls to get to variables of a fsm, etc etc. If you need help, I'll be very happy to work on that with you. I see a great potential in your solution.
Bye,
Jean
-
So I think I've got the variables sorted out - but I'm having a hard time forcing the FSM back into the state it was in when it saved. ChangeState doesn't appear to do it (probably because the state isn't valid from the initialized state). I could go and set the "active" on the FsmState (the private one) but that doesn't appear to change the Active state (the public one).
-
Hi,
I don't know how to change state via the api, not even sure it's possible, but would be great. WIlling to know too :)
I's suggest you open a new thread about this on the suggestion forum.
bye,
Jean
-
Hi,
one way to overcome this "switching" to state from api would be to declare a event for each state that can be serialized, and then the api will allow you to fire the event so that you can go to that state.
I just did a small package showing how to use "send event" to move to a state without transition, from the api you woul dsimply call that event and it that would work.
http://hutonggames.com/playmakerforum/index.php?topic=1735.msg7626#msg7626 (http://hutonggames.com/playmakerforum/index.php?topic=1735.msg7626#msg7626)
Bye,
Jean
-
Ok so I think it's working well now - at least the NoExit sample seems ok. There may yet be bugs to find :)
I've published it as an add-in package to UnitySerializer - now FSMs attached to stored objects have their variables store - additionally the first one also stores the global variables and the states are activated on load.
Available from http://whydoidoit.com/unity-serializer-v0-2/ (http://whydoidoit.com/unity-serializer-v0-2/)
-
UnitySerializer is now available on the Asset Store (http://u3d.as/content/whydoidoit/unity-serializer/33x) and the PlayMaker extension is available from my website (http://whydoidoit.com/unity-serializer-v0-2/).
-
This came at just the right time. Thank you!
-
Hey, I'm new to using PlayMaker, and was looking at how to serialize an FSM with it's variables when I stumbled across your Unity Serializer. It works great!
I'm just messing around, trying to learn stuff, and was looking at how the Unity Serializer deserialized the active state, but when I try setting it using reflection in my own code, all of the actions in the active state fire every frame ( they aren't set to in in the action on the state).
Is there some initialisation step I'm missing when setting the active state via reflection?
this works fine in the Unity Serializer, I'm just trying to learn stuff :)
Thanks!
-
Sorry for the late reply - I have a bunch of threads on forums and I've neglected this one - you can report faults or ask for support on the forums on http://whydoidoit.com
I think I'd need to see some of your reflection code - I can't think of a particular step off hand...
-
I was just wondering where on your site is the download for the Playmaker plugin, I had a search and could only find it mentioned but no link.
-
Never mind. Found it inside it's own unitypackage, inside a new "Plugins" folder it created, separate from the UnitySerializer folder.