I’ve got a structure now for saving scenes on paper, but I don’t want to go forward with implementing it without a little feedback…
I originally was using SortedDictionaries which I turned into SortedLists so I’m first wondering if those will serialize and be savable. The nested structure I have down on paper looks something like this for my game save data:
GameData > S_SceneData > S_O_ObjectsData > S_O_ObjectData
GameData - A class/object - > The entire save file of all scene data and global data like character stats, inventory, current music, current ambient sfx, etc…
S_SceneData - A SortedList - > Holds all of the O_Objects data (O_Objects are my non-static, controllable, and animated objects)
S_O_ObjectsData - A SortedList - > Holds all the individual O_Objects data
S_O_ObjectData - A class/object - > The individual O_Object data, position, rotation, among other specific individual object data.
[SerializableField]
class GameData
{
int currentScene,
S_SceneData s_SceneData
character stats, inventory sortedlists to go here in the future as well as current playing music and ambient sfx...
}
//Then S_SceneData:
SortedList<int,S_O_ObjectsData> S_SceneData = new SortedList<int,S_O_ObjectsData>();
//Then S_ObjectsData:
SortedList<int,S_O_ObjectData> S_O_ObjectsData = new SortedList<int,S_O_ObjectData>();
class S_O_ObjectData
{
O_Object_gameObject
O_List
storedPosition
storedRotation
other values go here etc etc...
}
I label the objects in my game’s scenes that are interactable, animated or non-static as “O_Objects” for clarification.
I was then wanting to save and load data using file streaming and serializing the GameData class/object.
I’m wondering if this is a valid method for saving and loading data, and if SortedLists are okay to use here. Should I be using Lists? Is there a better way to do this?