playMaker

Author Topic: Advice on save/load  (Read 8483 times)

richardh

  • Junior Playmaker
  • **
  • Posts: 97
Advice on save/load
« on: May 02, 2018, 09:18:38 AM »
Hi, again!
I have a working prototype of a VR game (actually it's a simulation rather than a 'a game'). It's for single player and allows the player to construct a model on a big table using small parts to construct an entire model. At the start the table is empty and by picking a large variety of parts and placing them on the table the player ends up with a purpose designed model they can then interact with. The model is therefore constructed using many bits (gameObjects). These objects are copies of the chosen parts selected by the player.

So... The empty table is the start. The table can have from a single item (picked by the player) right up to many hundreds of items (maybe even a few thousand). Each item will be a copy (clone) and also a clone of a clone of a clone...

This is how far I've got and the next thing i need to approach is a way to save these objects positions & rotations so that the player can save and return and load the scene to continue/edit the model.

I have just bought Smooth Save for Playmaker. But I have also noted Easy Save too.

What would be the best method to save each object's position and rotation? Would Smooth Save work for me? Is it possible to save and load the pos/rot of a clone?

Is it possible to save the locations and rotations of so many Objects? (in theory, the game allows for unlimited amounts of model parts to be added to the table (unless I code a limit of say 10,000 objects). Is this amount okay or unfeasible?

I will post a short YouTube vid of the prototype a bit later to give an idea of what the game (simulation) is about.

thanks in anticipation for any help/replies/advice.
ta
R

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Advice on save/load
« Reply #1 on: May 02, 2018, 01:51:41 PM »
Hi.
i think best is to use arrays and save the arrays.

I Do not know if they can be saved in smooth save,

But i do know that array list can be saved and you can find actions for it on the Ecosystem
Array list is a more advanced array that can also be found on the Ecosystem
Search for 'array maker' and 'easy save'

GonerGames

  • Junior Playmaker
  • **
  • Posts: 53
Re: Advice on save/load
« Reply #2 on: May 02, 2018, 02:32:46 PM »
Easy Save is amazing.
The new Easy Save 3 auto save might be what you are looking for.
In short:
Install Easy Save
Go to Assets -> Easy Save 3 -> Enable Easy Save for Scene
Create Parent Object -> Add ES3 Autosave script and enable Save Children

This will auto save at scene end (quit) and auto load on scene start.

From there you can tweak your needs.
Not sure the performance hit on loading 10,000 objects would be  :)

Thanks


richardh

  • Junior Playmaker
  • **
  • Posts: 97
Re: Advice on save/load
« Reply #3 on: May 03, 2018, 09:25:24 AM »
Thanks for the great replies, guys.
If Easy Save can be integrated that easily then I will certainly look at buying that. Smooth Save looks very similar so I will see how far I can get with that. Arrays... Not sure I'm knowledgeable enough to use arrays - I know I should investigate arrays if I want to expand my game making skills!

So, in regard to saving prefabs (GameObject copies), it is possible? Oh and also, This game is VR but I assume the same rules apply with regard to saving and loading?

richardh

  • Junior Playmaker
  • **
  • Posts: 97
Re: Advice on save/load
« Reply #4 on: May 03, 2018, 12:50:38 PM »
UPDATE:
Well, I bought Smooth Save and after a couple of hours trying I gave up! Totally stumped.
So, I bought Easy Save and tried to follow the instructions, tuts, forum threads etc. After a couple of hours trying I gave up! totally stumped here too!

I think it's because i'm trying this on a VR game and perhaps it's not compatible?

I haven't even got to grip with ANY of the examples in either package as the examples are not working examples but simple text descriptions which mean nothing to me.
@GonerGames I followed your advice but alas nothing worked, nothing happened, nothing saved.
Do I need to build the scene to see if it works?

Usually, I can work things out by delving into the example scenes of a new asset (if they have them) but in the case of Smooth Save and Easy Save, this is not the case as the examples are not actually working examples that can be dissected.

Totally and utterly lost and haven't a clue how to proceed!

@GonerGames
Quote
"Go to Assets -> Easy Save 3 -> Enable Easy Save for Scene
Create Parent Object -> Add ES3 Autosave script and enable Save Children

This will auto save at scene end (quit) and auto load on scene start."
Could you elaborate on this because nothing saved for me after following your instructions? there must be a bit more to the setup than this? :)




 
« Last Edit: May 03, 2018, 01:11:31 PM by richardh »

GonerGames

  • Junior Playmaker
  • **
  • Posts: 53
Re: Advice on save/load
« Reply #5 on: May 03, 2018, 03:14:12 PM »
Sorry Richardh,
I loaded up a fresh scene and the latest version doesn't work like that. Sorry for the bad advice. So now let's fix it :)
Here is a video. Sorry for the background noise.

Hope this helps.
https://youtu.be/Kk5pYeRvqiw

richardh

  • Junior Playmaker
  • **
  • Posts: 97
Re: Advice on save/load
« Reply #6 on: May 03, 2018, 04:08:08 PM »
@GonerGames
Many thanks for taking the time and trouble to create that tutorial. I will work my way through it and try to replicate what you have done which should give me a bit more to go on as I try to work out how to save and load my game scene.

Your example is using prefab cubes which are added to the scene at random positions and random rotations. My prefabs are also cubes but once they are in the scene the player can reposition them and also rotate them (basically edit their position and rotations). If they change these things would your method (in your tut) update the positions & rotations upon exiting?


GonerGames

  • Junior Playmaker
  • **
  • Posts: 53
Re: Advice on save/load
« Reply #7 on: May 03, 2018, 09:51:13 PM »
The tut was just to show that Easy Save will save the position and rotation of the prefab objects. Just make sure you have a button or timer that will fire off a Save like the one on the Load Scene Button. This will then save all the prefabs that you've registered. In the settings under Windows -> Easy Save 2 Window -> Settings, you can choose to have it auto save on Application Quit, Application Pause or None.
I usually have this set to none so that I can control the saving and loading manually.


stvbabb

  • Junior Playmaker
  • **
  • Posts: 66
Re: Advice on save/load
« Reply #8 on: May 04, 2018, 02:25:01 AM »
Hello,

Thanks for that video! It really helps! I've been trying to figure out Easy Save with Playmaker and I know it's really straight forward, but I'm struggling as well.

Any advice for creating save slots for the player? I see in the demo for Playmaker that loading from save slots is there, but saving to a specific save slot?

Like the player at continue their game from save slot a,b,c, or d? And then, in game save their progress to that save slot.

I know array making is going to come in to play here, but I just can't seem to get this.

Thanks,
Steve

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Advice on save/load
« Reply #9 on: May 04, 2018, 02:18:01 PM »
Hi,

I am working on a tutorial video (not using auto save) , i will try to upload before Wednesday.
If i did not reply by then, please bump this thread :)

@stvbabb
Arrays are very useful here and it will be very hard without them.
Array are not that hard to understand, i will try to explain a little when i make the video (or make a separate video for it)

To save in different slots is easy to do with easy save, as it uses references.

Save each array or other variables in a reference.
Name a reference for example : SlotAvariableOne / SlotAvariableTwo / ....
Then for slot 2 do the same but then use SlotB

To save or load you can set the string variable on the reference to select which slot.

if you don't understand, let me know and i will make a tutorial next week :)

stvbabb

  • Junior Playmaker
  • **
  • Posts: 66
Re: Advice on save/load
« Reply #10 on: May 04, 2018, 02:26:57 PM »
That would be really helpful! I'm just running into more and more problems with this asset.

I just don't understand it. If you had a video that would be really cool.

Thanks,
Steve

richardh

  • Junior Playmaker
  • **
  • Posts: 97
Re: Advice on save/load
« Reply #11 on: May 04, 2018, 02:43:22 PM »
Yeah, I'm still none-the-wiser with my save/load query. If anything I even more confused now. I communicated with Christopher (smooth save) who kindly offered some advice but alas it was way over my head.

An issue I have is that the objects I want to save/load are actually modified prefabs - they are clones of prefabs but I've used Playmaker actions to add children and to change tags so they are no longer original prefabs.

I truly have no idea how to proceed with this. Desperately need an 'idiots guild'!
« Last Edit: May 04, 2018, 03:01:30 PM by richardh »

stvbabb

  • Junior Playmaker
  • **
  • Posts: 66
Re: Advice on save/load
« Reply #12 on: May 04, 2018, 03:27:27 PM »
Yeah, me too. I'd like to consider myself competent with lots of Unity stuff - but this has me totally confused.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Advice on save/load
« Reply #13 on: May 04, 2018, 05:08:23 PM »
Hi,
That makes it a lot harder as you can not save objects.
What are the exact changes?
is it only adding different child objects or is there other 'data' changed (variables, colors, other things)

Maybe for this situation you might need to look into xml/json and use Datamaker.

richardh

  • Junior Playmaker
  • **
  • Posts: 97
Re: Advice on save/load
« Reply #14 on: May 04, 2018, 05:59:18 PM »
No, the only changes from the original 'prefab' to copied clone is the tag and the addition of children along with the new position and rotation. There are no data changes. I can (and probably will) make the original objects proper prefabs. At the moment the original objects are the cubes in the scene that the player is able to interact with (VR using right controller to touch and copy the object)
Basically, you (the player) are ina  VR room that contains a large square table and an assortment of cubes that you can touch with a VR controller to copy the touched object which you hold (with the controller) and then you're able to position the NEW (copy) object on the table and also rotate it. Do the same with another copy of an original cube until you have created a large model on the table (made up of lots of these copied cubes). At that point I want to let the player obviously save what they've created so they don't lose it after the end the game and can fire up the game again to continue with the model (they can edit/move the cubes/rotate the cubes/delete the cubes etc and save them all again. etc)

I've built all this apart from the save/load part which is the next task to do - hence why I'm asking for help as this bit is beyond my skill level.
I can post a vid of the scene if it helps.

Another thing I wanted to try to do is to give each of these copied objects an original name rather than [cubeA](clone)(clone) etc. Would giving each object an original and new name make it easier to save/load? I suspect it would.
thanks