Playmaker Forum

PlayMaker News => User Showcase => Topic started by: terrymorgan on June 22, 2012, 11:38:23 AM

Title: Playmaker FSM saver
Post by: terrymorgan on June 22, 2012, 11:38:23 AM
Not exactly a 'showcase' but Mike Talbot has a Serializer for Unity (saves games) and also for
Playmaker FSM's

http://whydoidoit.com/unity-serializer-v0-2/

Playmaker support is in the Add-ons. I've only looked at his video so far.
Title: Re: Playmaker FSM saver
Post by: kiriri on June 22, 2012, 11:47:12 AM
wow it's even free! not to say that there's anything wrong with playMaker's internal save actions :D But this somehow looks like less work all in all.
Title: Re: Playmaker FSM saver
Post by: whydoidoit on June 22, 2012, 05:10:44 PM
Thanks for posting this here :)

At the moment I haven't written any playMaker custom actions to actually perform the save (just the code to actually do the saving and loading of the variables and the state) - I'd be happy to add actions too if people thought it would be useful.
Title: Re: Playmaker FSM saver
Post by: shinodan on July 27, 2012, 02:36:55 AM
Would be really interested in an action for this
Title: Re: Playmaker FSM saver
Post by: whydoidoit on July 30, 2012, 10:15:47 AM
I have added custom actions and an example scene to the PlayMaker Add On package on my website.  This allows the storage and resumption of checkpoints and also the ability to build a complete save game/load menu system.  A simple example is available in a demo scene inside the add on package on my website. http://whydoidoit.com/unity-serializer-v0-2/
Title: Re: Playmaker FSM saver
Post by: shinodan on July 31, 2012, 03:23:30 AM
If anyone could help me in any way getting these to work? Ive stored all my FSM's and i have a load and save actions. but the screen just goes white when i try a load. and the project starts spawning empty game objects.

The save game action requires a name and the load game requires a number, that confused me a bit.

Anyway, any help would be super awesome and already a big thanks for the actions!
Title: Re: Playmaker FSM saver
Post by: shinodan on July 31, 2012, 04:09:28 AM
okay i got a little further but its not properly storing my fsm's and when i load, object that i had hidden appear, should i only be storing certain things? urggh sorry :(
Title: Re: Playmaker FSM saver
Post by: whydoidoit on July 31, 2012, 07:11:57 AM
What do you need it not to store?  Did you have a chance to follow the Getting Started guide?

As mentioned on my blog this has far less testing than other parts of Unity Serializer - I have successfully stored and loaded NoExit and a couple of other scenes that I have,
Title: Re: Playmaker FSM saver
Post by: whydoidoit on July 31, 2012, 07:17:26 AM
If you are just wanting a single load and save you should use Checkpoint and Resume.

The example scene shows how to use the number to get at the slots that are filled every time you call SaveGame.  Slot 0 is always the most recent saved game.  Will be adding more documentation.

Things that are hidden should have a Store Information script on them (if they aren't already a Prefab (with Prefab Identifier added).
Title: Re: Playmaker FSM saver
Post by: shinodan on July 31, 2012, 09:44:52 AM
yeah its for a tamagotchi type game and my fsm's are pritty complicated, first i stored everything, and when i load the slot the game loads with my tamagotchi already dead in a bath tub with lots of other things that aren't supposed to show no matter where i save it. what do i have to do to prefabs? i only have 1 or two but do i have to assign anything to them? i tried the checkpoint approach initally but does that save even when the game closes and opens again?

i have read all your documentation btw but because im not a coder some of it isnt relative to what is required when saving playmaker projects. sorry for being such a noob.
Title: Re: Playmaker FSM saver
Post by: whydoidoit on July 31, 2012, 09:49:14 AM
You have to have Prefab Identifiers on Prefabs (and store information scripts on their children that need saving).

I'd be happy to take a look at your project if you like - there could well be problems and it would help everyone if we can sort them out.  PM me and I can give you an FTP site to upload the project to if you like.
Title: Re: Playmaker FSM saver
Post by: shinodan on July 31, 2012, 10:00:41 AM
I have some screen shots of the load save and the objects stored.
if that doesnt tell you whats wrong then your plan sounds good haha :)
thankyou :)

(http://i47.tinypic.com/2eunyqe.jpg)

(http://i46.tinypic.com/kbybq.jpg)
Title: Re: Playmaker FSM saver
Post by: whydoidoit on July 31, 2012, 10:08:17 AM
Any game with a prefab called poop is alright with me.  It will probably be easier just to look at the project.  I can do that later today.

Will PM you FTP details.
Title: Re: Playmaker FSM saver
Post by: terrymorgan on August 16, 2012, 10:44:20 AM

I tried to run this using the pdf and the video, on my hack of the unity FPS tutorial. the save game manager was missing 'test serialization.cs' and
pause menu.cs

testserialization.cs  and pause menu.cs was in /scripts once I did that, dragged them
onto the save game manager in the inspector, I could get some info showing in the
hierarchy. Not sure whether the barrel was a prefab or a 'store information' figured it
was a prefab but it had a smoketrail child and 'props and children' had 'store information' decided barrels should be prefab, the smoke trails had 'store information' after I did that.

Robot I put as a prefab. Try it here:

http://terrymorgan.net/dungeon_fps_exe.zip
18mb
Title: Re: Playmaker FSM saver
Post by: amaranth on August 17, 2012, 01:59:26 PM
Hi Mike, I just installed the package from the Asset Store, then installed the Playmaker package from your website. I then loaded the Example scene and play tested. When I click the save button, I get this message:

Code: [Select]
Failed to serialize status of Capsule with error System.NullReferenceException: Object reference not set to an instance of an object
  at LevelSerializer.<SerializeLevel>m__8A (UnityEngine.Component c) [0x00000] in C:\Users\Amanda\My Files\My Game Projects\Pixel Pygmies\Development\Eden\Assets\Plugins\whydoidoit.com\Serialization\LevelSerializer.cs:779
  at System.Linq.Enumerable+<CreateSelectIterator>c__Iterator10`2[UnityEngine.Component,System.String].MoveNext () [0x00000] in <filename unknown>:0
  at System.Linq.Enumerable+<CreateDistinctIterator>c__Iterator3`1[System.String].MoveNext () [0x00000] in <filename unknown>:0
  at System.Linq.Enumerable.ToDictionary[String,String,Boolean] (IEnumerable`1 source, System.Func`2 keySelector, System.Func`2 elementSelector, IEqualityComparer`1 comparer) [0x00000] in <filename unknown>:0
  at System.Linq.Enumerable.ToDictionary[String,String,Boolean] (IEnumerable`1 source, System.Func`2 keySelector, System.Func`2 elementSelector) [0x00000] in <filename unknown>:0
  at LevelSerializer.<SerializeLevel>m__79 (UnityEngine.GameObject n) [0x00000] in C:\Users\Amanda\My Files\My Game Projects\Pixel Pygmies\Development\Eden\Assets\Plugins\whydoidoit.com\Serialization\LevelSerializer.cs:776
UnityEngine.Debug:LogWarning(Object)
LevelSerializer:<SerializeLevel>m__79(GameObject) (at Assets/Plugins/whydoidoit.com/Serialization/LevelSerializer.cs:797)
System.Linq.Enumerable:ToList(IEnumerable`1)
LevelSerializer:SerializeLevel(Boolean, String) (at Assets/Plugins/whydoidoit.com/Serialization/LevelSerializer.cs:756)
LevelSerializer:SerializeLevel(Boolean) (at Assets/Plugins/whydoidoit.com/Serialization/LevelSerializer.cs:671)
LevelSerializer:CreateSaveEntry(String, Boolean) (at Assets/Plugins/whydoidoit.com/Serialization/LevelSerializer.cs:294)
LevelSerializer:PerformSave(String, Boolean) (at Assets/Plugins/whydoidoit.com/Serialization/LevelSerializer.cs:468)
LevelSerializer:SaveGame(String, Boolean, Action`2) (at Assets/Plugins/whydoidoit.com/Serialization/LevelSerializer.cs:460)
LevelSerializer:SaveGame(String) (at Assets/Plugins/whydoidoit.com/Serialization/LevelSerializer.cs:436)
TestSerialization:OnGUI() (at Assets/UnitySerializer/Scripts/TestSerialization.cs:22)

Any idea about what went wrong? After this happened, I re-imported PlayMaker and UnitySerializer. Retested. Same problem. Restarted machine for kicks. Retested. Same problem.
Title: Re: Playmaker FSM saver
Post by: terrymorgan on August 25, 2012, 09:38:18 AM
Mike answered my question on the forum here

http://whydoidoit.com
Title: Re: Playmaker FSM saver
Post by: terrymorgan on August 25, 2012, 11:20:04 AM
@amaranth: I made a copy of my playmaker working directory, imported the FSM serializer, the main serializer (generic) updated it to 1.43 of playmaker, I could save the example scene where the colored cubes are falling.