playMaker

Author Topic: working on a saving and loading system using invector assets  (Read 3610 times)

colpolstudios

  • Sr. Member
  • ****
  • Posts: 365
working on a saving and loading system using invector assets
« on: April 26, 2022, 05:32:40 PM »
I have made some initial progress on creating an FSM that will save the character's position and its health using the invector cover addon.


Each save location is within the current scene, but if you had more than one scene, how would you manage those additional aspects?

I am struggling to understand how this should be done and appreciate your help in resolving this query.



djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: working on a saving and loading system using invector assets
« Reply #1 on: April 26, 2022, 06:08:30 PM »
Hi.
Save the Scene name and on loading load the name and use to load scene.

if you want to store and be able to go to different scenes then probably store the positions into an array or save for each scene (for key you could use the scene name)

colpolstudios

  • Sr. Member
  • ****
  • Posts: 365
Re: working on a saving and loading system using invector assets
« Reply #2 on: April 27, 2022, 06:09:45 PM »
Hi, djaydino many thanks for your reply.

I am creating a greatly simplified version and noticed I needed to rethink some aspects.

Give me a few days.

I am currently working on the improvements.


colpolstudios

  • Sr. Member
  • ****
  • Posts: 365
Re: working on a saving and loading system using invector assets
« Reply #3 on: April 28, 2022, 06:20:40 PM »
I am continuing to work on the solution.

In order to be able into different slots, I have had to improvise on your suggestion.

For me, it's a case of trial and error, but I am making some progress.

But the good side is that I have improved other aspects along this new path.

I am learning as I  go :)

I now have two paths one for saving for the initial scene and then a new path for the new scene.

The player has "do not destroy on load" so we take all of the elements with us to the new scene.

This is working so far until I restart from the first scene.

A bit more debugging and I think I will get it.

The new project represents only a plane for the ground, a capsule for the player and a simple cube for the save point.

The binary saving and loading is a prefab that can be added to the player, with the save point being a completely different entity but communicating with the binary saving and loading prefab.

You can add new save points at the present there are only two but do work.

Just select the save point prefab and place it within the scene.

Your suggestion helped me and I thank you for your time and help :)

















djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: working on a saving and loading system using invector assets
« Reply #4 on: April 29, 2022, 09:39:07 AM »
Hi

Quote
This is working so far until I restart from the first scene.
Add a singleton action at the start of your object.
This will make sure that there is only 1 of this object.

in our game i have the player as a separate scene which only gets unloaded if going to the main menu.

For saving we use easy save and each slot saves in its own file.
Maybe you can make a prefab for the 'binary save' and make one for each slot?

colpolstudios

  • Sr. Member
  • ****
  • Posts: 365
Re: working on a saving and loading system using invector assets
« Reply #5 on: April 29, 2022, 02:40:36 PM »
Hi, I have it working now.

I use player prefs to store a new int scene number

I now have an int compare that checks the scene number, so at scene zero you only save and load the save point information for that scene!

When you change to a new scene the first thing I do.

Get the int, add 1 to it and set the player pref to the new value.

Now in scene two, we are using the same save points, but this time when I save the new path is used to store the player's position.



https://ibb.co/31QyFdz

The orange state highlights this.

Currently, there are only two possible scenes and only two save slots and it's getting quite hard already to keep track of what's going on.


I am currently still trying to improve on the current system and need to rethink the way I currently handle the overwritten state for each slot.

The current setup is flawed. You can see this when I load scene two and save the slot in this scene. The overwrite is active! This is incorrect.

It should be your first time saving this slot in this scene.


In order to simplify things, I have made the decision to remove the overwrite options completely.

Now when you click on the slot a separate UI element is activated with an "OK" or "Cancel" button.
















« Last Edit: April 30, 2022, 11:00:28 AM by colpolstudios »

colpolstudios

  • Sr. Member
  • ****
  • Posts: 365
Re: working on a saving and loading system using invector assets
« Reply #6 on: April 30, 2022, 11:21:16 AM »
Here is the latest updated character saving and loading system:


The issue is that you could have a lot of possible scenes.

you mentioned, "in our game, I have the player as a separate scene which only gets unloaded if going to the main menu."

Could you explain more about this as it may help me, please?







 
« Last Edit: April 30, 2022, 05:29:57 PM by colpolstudios »

colpolstudios

  • Sr. Member
  • ****
  • Posts: 365
Re: working on a saving and loading system using invector assets
« Reply #7 on: May 01, 2022, 06:04:44 PM »
The binary saving and loading system is currently being reviewed and possibly remade!

I will post updates when I have them.


colpolstudios

  • Sr. Member
  • ****
  • Posts: 365
Re: working on a saving and loading system using invector assets
« Reply #8 on: May 02, 2022, 03:21:19 PM »
I have updated the files but was reading through some old posts on the subject of the use of send event and the broadcast all option.

I use this option quite heavily as I thought that was the correct method when dealing with prefabs that need to get the information.

After taking a closer look at my setup I have one parent who currently sends the broadcast event to the children of this parent to carry out specific tasks.

That could be changed to the specific send event by name. However, that would impact the savepoint (prefab).

The savepoint (prefab), currently can send two possible "broadcast all" events that must be received by the parent.

It may be possible to limit the current use of the "broadcast all" events to only the ones that are required by the savepoint.

So either way, It would cost with performance?

Looking for your advice on this matter, djaydino.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: working on a saving and loading system using invector assets
« Reply #9 on: May 02, 2022, 09:03:57 PM »
Hi.
I have our save system on a single object (together with other data fsms) which i have set as a global.
This way you can send events / Set data from any fsm on any gameobject (scene/prefab)

For prefabs to 'receive' a event i use Array Lists and add the prefabs when spawned, to that list.
Then when i send a event to this global object fsms, i will loop thru the prefab array and send events to those (or set some data, depending on my needs)

I use global variables only for this.

Also i use Easy Save for all my projects which exists more that 10 years already and is simply the best saving system so far :)

Also i save only on certain times (loading levels / quit game / player looking into inventory / etc) not during gameplay.


colpolstudios

  • Sr. Member
  • ****
  • Posts: 365
Re: working on a saving and loading system using invector assets
« Reply #10 on: May 03, 2022, 04:03:26 PM »
It is possible to remove the global events and use a global int instead, so I will begin that process. Thank you for the suggestion.

My saving process can be activated during gameplay, but only when you are at the savepoint. You can also open the loading window only when you have saved information.

It is also possible to use only one save point, but save into the different slots.

When the loading window opens, you can only select the previously saved slots to load from.

The others do show within the UI but are not interactable.

The current setup allows the player to save and load within the current scene, if you restart your initial saving was also saved reloading that information upon restart.

The slots are reset, and you have the option to save again.

But you can choose not to save and progress to scene two and save here if you wish.

I am aware of Easy Save, my little saving and loading system is quite plain and simple, but gets the job done.

Also 100% playmaker :)







djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: working on a saving and loading system using invector assets
« Reply #11 on: May 03, 2022, 05:27:15 PM »
Instead of a global int, use a global game object and on that object create a 'Data' and/or a 'Save Data' Fsm.
Then in that fms create the int variable and  to access use Get/Set Fsm int actions.

Easy Save is complete with Playmaker Actions and save me 100's of working hours :)

colpolstudios

  • Sr. Member
  • ****
  • Posts: 365
Re: working on a saving and loading system using invector assets
« Reply #12 on: May 08, 2022, 04:48:18 PM »
I only begin now to see that I am using different types of systems.

One is a location type of system that will use only one scene.

With the second (on hold) a system that someday maybe will be able to cope with more than one scene.

I have gotten drawn away from my real goal and project for far too long.

So here is the latest update:


Notes:

The pickup state picked or not picked is saved and can be loaded later.

The enemy state dead or alive is saved and can be loaded later.









colpolstudios

  • Sr. Member
  • ****
  • Posts: 365
Re: working on a saving and loading system using invector assets
« Reply #13 on: May 10, 2022, 06:49:40 PM »
Hi, fundamentally the entire project needs to be re-thought much better.

I have learned a lot during this process.

Thank you all for your help along this process.

I need to start from the beginning, but taking note of what I did right or wrong and hopefully getting better each time.

A combination of lack of experience and lack of better planning and jumping head first eventually brought the project to its knees.

I will be back, but who knows when.   








 

colpolstudios

  • Sr. Member
  • ****
  • Posts: 365
Re: working on a saving and loading system using invector assets
« Reply #14 on: June 03, 2022, 06:33:33 PM »
I have refined my system, but have not been able to get much further with my development due to a lack of experience.

The player and enemies along with pickups are now saved and loaded, but I have run into the same problem again when it comes to adding new scenes.

I am using global arrays to save or load the pickups and the enemies with the player being saved as a single object.

In the demo video, you start by playing a new game, once you save I save the active scene name along with a bool for that specific slot.

The active scene name is only currently used in the title scene to effectively reload the level.

I hope I am getting closer to a working solution but require your help, please.