How to manage (very) large scenes ?

Discussion and help for Easy Save 3, The Complete Save Game & Data Serializer System for the Unity Engine
Poupi
Posts: 1
Joined: Thu Oct 24, 2024 7:23 pm

How to manage (very) large scenes ?

Post by Poupi »

Hi, I'm currently trying to figure out how to create save files in our upcoming game. The player is evolving in a large scene (several kilometers wide), with ten of thousands of objects in the scene, and probably thousands of object that will need to be saved.

I'm a bit afraid of how ES3 will behave with this kind of setup, as in our current scene the ES3ReferenceManager is storing 600k+ references, and it'll probably be 10 times more with the finished scene. I don't really know how the workflow is supposed to be in this case.
Should i disable the auto-search from the Manager and create my own behavior to keep the references up to date ? (it needs to be automatic as I don't want designers to mess with this and adding references by hand is impossible with this number of objects).

Thanks !
User avatar
Joel
Moodkie Staff
Posts: 5037
Joined: Wed Nov 07, 2012 10:32 pm

Re: How to manage (very) large scenes ?

Post by Joel »

Hi there,

Generally in this case you should follow the Improving Performance guide:
https://docs.moodkie.com/easy-save-3/es ... rformance/

If it needs to be automatic and you don't want everything to be added to the manager, you would indeed need to create your own behaviour to keep the references up to date.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
yimingt
Posts: 33
Joined: Fri Apr 30, 2021 3:07 am

Re: How to manage (very) large scenes ?

Post by yimingt »

you would indeed need to create your own behaviour to keep the references up to date.
Interested in knowing more about this. We also have a SaveManager that has a lot of references but I think a lot of the references are actually unnecessary (Shader references, references to objects that aren't involved in saving/loading). Is there a rule in knowing what needs to be referenced? My guess would be anything that contains an ES3 component (AutoSave or Prefab) but I think it can also extend to objects that are saved but do not contain ES3 components, in my case ScriptableObjects.

So would a custom behaviour be like so:
1. Add reference to objects in scene with ES3 components
2. Add reference to project assets with ES3 components
3. Add reference to asset reference types but how do we reference all that are needed?
User avatar
Joel
Moodkie Staff
Posts: 5037
Joined: Wed Nov 07, 2012 10:32 pm

Re: How to manage (very) large scenes ?

Post by Joel »

Hi there,

The only references which are necessary are ones which are being saved and loaded (i.e. if you're saving a GameObject it'll be the GameObject itself, any Components you're saving, and UnityEngine.Objects in fields which are being saved. It's not possible to automatically determine this as the only person who would know this is the developer.
My guess would be anything that contains an ES3 component
A GameObject doesn't need an ES3Component to be saved, so this isn't a suitable way of determining if something is being saved. You could add your own Component to everything which you know is being saved and use this, but it would be your responsibility to ensure that everything you're saving has this Component.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
yimingt
Posts: 33
Joined: Fri Apr 30, 2021 3:07 am

Re: How to manage (very) large scenes ?

Post by yimingt »

The only references which are necessary are ones which are being saved and loaded
Think I need a better understanding of what it means to be saved and loaded.

1. If I wanted to load an instantiated ES3Prefab as a child of a parent, would the ES3RefManager need a reference to the parent?

2. For loading an instantiated ES3Prefab, does the ES3RefManager need a reference to all the components and objects of the ES3Prefab or just the ES3Prefab GameObject. Also should the localrefs array of the ES3Prefab be filled?

3. If we have a reference to a ScriptableObject but we do not include its dependencies, would all those fields be null on load? Similarly, if we had a reference to a prefab GameObject only, would the prefab load in properly?

4. If I were only interesting in saving a component, I would only need a reference to the component and not its GameObject?

5. I tried using "Exclude reference from Manager" after refreshing the Manager but I still see the reference inside its array. Am I using "exclude correctly"?

6. What does the "Exclude Objects" array in the ES3RefManager do?
User avatar
Joel
Moodkie Staff
Posts: 5037
Joined: Wed Nov 07, 2012 10:32 pm

Re: How to manage (very) large scenes ?

Post by Joel »

1. If I wanted to load an instantiated ES3Prefab as a child of a parent, would the ES3RefManager need a reference to the parent?
Correct, because the parent/child relationship is determined by the 'parent' field of the Transform Component. If Easy Save can't get a reference to the parent, it can't save the parent/child relationship.
2. For loading an instantiated ES3Prefab, does the ES3RefManager need a reference to all the components and objects of the ES3Prefab or just the ES3Prefab GameObject. Also should the localrefs array of the ES3Prefab be filled?
It needs references to everything which is being saved and loaded. The bare minimum would be the GameObject and it's Transform if you're not saving any Components on the GameObject. The localRefs array needs to be filled, but this shouldn't bloat your project because this will only contain things which are already referenced by your project.
3. If we have a reference to a ScriptableObject but we do not include its dependencies, would all those fields be null on load?
Any UnityEngine.Object fields which are in the save data will be loaded as null.
Similarly, if we had a reference to a prefab GameObject only, would the prefab load in properly?
If you're not saving any Components on that ES3Prefab, and no parent/child relationship is being saved, then it will be loaded in with all of it's default values.
4. If I were only interesting in saving a component, I would only need a reference to the component and not its GameObject?
Components can't exist without a GameObject to attach them to, so unless you're using ES3.LoadInto to load it into a specific Component which already exists, you need a reference to the GameObject.
5. I tried using "Exclude reference from Manager" after refreshing the Manager but I still see the reference inside its array. Am I using "exclude correctly"?
The objects will be excluded the next time the manager is refreshed.
6. What does the "Exclude Objects" array in the ES3RefManager do?
This just tells Easy Save what references to exclude. Whenever Easy Save refreshes the manager, it will check this list before adding a reference to the manager.
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
yimingt
Posts: 33
Joined: Fri Apr 30, 2021 3:07 am

Re: How to manage (very) large scenes ?

Post by yimingt »

How do I add a reference component to the Reference Manager? I tried right clicking on the component but I do not see an option to add a reference.
The objects will be excluded the next time the manager is refreshed.
I tried doing this but I still see the reference in the References array. Would the object I selected for exclusion be included into the Exclude Objects array because that array is empty after selecting "exclude reference".
User avatar
Joel
Moodkie Staff
Posts: 5037
Joined: Wed Nov 07, 2012 10:32 pm

Re: How to manage (very) large scenes ?

Post by Joel »

yimingt wrote: Tue Nov 05, 2024 5:12 am How do I add a reference component to the Reference Manager? I tried right clicking on the component but I do not see an option to add a reference.
The objects will be excluded the next time the manager is refreshed.
I tried doing this but I still see the reference in the References array. Would the object I selected for exclusion be included into the Exclude Objects array because that array is empty after selecting "exclude reference".
I've not had any reports of this not working. If you're not using the latest version of Easy Save, please try updating. If that doesn't resolve the issue please could you replicate this in a new project with a simple scene and send it to me using the form at moodkie.com/repro so I can see what is happening.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
yimingt
Posts: 33
Joined: Fri Apr 30, 2021 3:07 am

Re: How to manage (very) large scenes ?

Post by yimingt »

Just to be clear on the steps.

1. Refresh ES3ReferenceManager
2. Select objects to exclude. Right click them, "Exclude References(s) from Manager".
3. Refresh ES3ReferenceManager

After the refresh, the objects previously selected should be removed from the References array. Is the process correct?
User avatar
Joel
Moodkie Staff
Posts: 5037
Joined: Wed Nov 07, 2012 10:32 pm

Re: How to manage (very) large scenes ?

Post by Joel »

yimingt wrote: Wed Nov 06, 2024 7:54 am Just to be clear on the steps.

1. Refresh ES3ReferenceManager
2. Select objects to exclude. Right click them, "Exclude References(s) from Manager".
3. Refresh ES3ReferenceManager

After the refresh, the objects previously selected should be removed from the References array. Is the process correct?
You don't need step 1, though that wouldn't stop it from working.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply