playMaker

Author Topic: Quick Save - Best Practices?  (Read 5051 times)

Gua

  • Beta Group
  • Sr. Member
  • *
  • Posts: 309
    • Andrii Vintsevych
Quick Save - Best Practices?
« on: February 10, 2015, 11:57:09 AM »
What are the best practices for creation of quick save / load system for a complex game?

I mean game, where I need to save positions and states for a spawned objects and scene objects...

 Is it even possible to achieve with Playmaker?

mweyna

  • Full Member
  • ***
  • Posts: 242
Re: Quick Save - Best Practices?
« Reply #1 on: February 10, 2015, 01:46:33 PM »
I've done it using the EasySave asset and writing a rather long FSM that gets each objects position and then saves it to an appropriate file. All my objects upon creation go into an Array (Using ArrayMaker) so I can just iterate through the list to get all my scene objects. Either way take a look at the EasySave asset.

Gua

  • Beta Group
  • Sr. Member
  • *
  • Posts: 309
    • Andrii Vintsevych
Re: Quick Save - Best Practices?
« Reply #2 on: February 10, 2015, 08:53:56 PM »
I've done it using the EasySave asset and writing a rather long FSM that gets each objects position and then saves it to an appropriate file. All my objects upon creation go into an Array (Using ArrayMaker) so I can just iterate through the list to get all my scene objects. Either way take a look at the EasySave asset.
You're the person I need! I have EasySave asset and I was thinking about similar approach, but when I was thinking about it. A lot of question still remain unanswered in my had.

I would really appreciate if you share some "Playmaker code" examples with this approach. I mean like a Unity scene file.

mweyna

  • Full Member
  • ***
  • Posts: 242
Re: Quick Save - Best Practices?
« Reply #3 on: February 11, 2015, 01:14:58 AM »
So it's tough to show the entire branch tree (the thing is a monster), but basically I have to global functions - SAVE/SAVE and SAVE/LOAD. On scene start I have an FSM detect (using the EasySave Playmaker actions) if a save file exists. If it does, then it loads it. If it doesn't then it creates the world as if it's brand new.



As for Saving, in my FSM I have a series of branching behaviors that basically get all the objects from my defined Arrays and then one by one get the traits I need to save, generally just position/rotation/any specific bools I care about/etc. The next action then writes all of these to a specific folder. I've found that you normally can't do a GET action and then write action in the same playmaker action, there always need to be a seperation of the GET and SAVE actions. To help this, I have an FSM that just contains all important variables in my scene. So I can have "BoxDeployed.Int" and save that out, then load it and Set FSM Int on load.




The tree expands as I keep adding variables to save. On my actual game objects, my start state is usually a Bool Check for "Data.Load.Done.Bool" that get sets once my entire tree is saved/loaded. That way game logic doesn't start until all my data is loaded.

Gua

  • Beta Group
  • Sr. Member
  • *
  • Posts: 309
    • Andrii Vintsevych
Re: Quick Save - Best Practices?
« Reply #4 on: February 11, 2015, 02:33:07 AM »
my defined Arrays
Are making those Arrays of gameobjects by hand manually, or there is some logic that creates this array at the start of a scene?

mweyna

  • Full Member
  • ***
  • Posts: 242
Re: Quick Save - Best Practices?
« Reply #5 on: February 11, 2015, 03:34:56 AM »
So Arrays are included with Playmaker ArrayMaker (https://hutonggames.fogbugz.com/?W715), and for my project, I'm basically adding objects to a GameObject array upon creation (Although I have a large number of arrays in my scene to track different types of objects/info). Then when I need to save those objects, I'm sorting through that array and saving all relevant info, then moving to the next object in the list, etc. There are plenty of other threads which can explain in much better detail then I how to properly use Array functionality.

Ultimately, this might be overkill, depending on your individual project needs. In my project everything is created at run-time and all objects can be placed by the user, so I need to save a large amount of data where everything is.

Gua

  • Beta Group
  • Sr. Member
  • *
  • Posts: 309
    • Andrii Vintsevych
Re: Quick Save - Best Practices?
« Reply #6 on: February 13, 2015, 03:27:52 AM »
So Arrays are included with Playmaker ArrayMaker (https://hutonggames.fogbugz.com/?W715), and for my project, I'm basically adding objects to a GameObject array upon creation (Although I have a large number of arrays in my scene to track different types of objects/info). Then when I need to save those objects, I'm sorting through that array and saving all relevant info, then moving to the next object in the list, etc. There are plenty of other threads which can explain in much better detail then I how to properly use Array functionality.

p.s. Please check private messages.

Ultimately, this might be overkill, depending on your individual project needs. In my project everything is created at run-time and all objects can be placed by the user, so I need to save a large amount of data where everything is.

For my project it is not overkill, that the exact solution I wanted to hear about. Unfortunately I'm having technical problems with the current ArrayMaker solution. If I understand correctly Playmaker 1.8 should have a native solution for ArrayMaker, so I'll wait for it, before diving deep in Arrays and save/load system.

mweyna

  • Full Member
  • ***
  • Posts: 242
Re: Quick Save - Best Practices?
« Reply #7 on: February 13, 2015, 05:38:33 AM »
I'm using Arraymaker and the latest version of Playmaker without incident. What errors are you getting trying to use it?

Gua

  • Beta Group
  • Sr. Member
  • *
  • Posts: 309
    • Andrii Vintsevych
Re: Quick Save - Best Practices?
« Reply #8 on: February 13, 2015, 12:52:45 PM »
I'm using Arraymaker and the latest version of Playmaker without incident. What errors are you getting trying to use it?
There are conflicts with Playmaker temporary iGUI solution.
http://hutonggames.com/playmakerforum/index.php?topic=9530.0