We do have some issues with saving and reloading games and would like your advice on how to best handle that.
To prevent losing progress of our many characters, we load them and keep them in memory until you save or exit the game. But, to do so, we only create the combatants without a prefab. This let us manage many characters that the CPU/GPU budget wouldn't let us load and render on screen all at once.
And we have a two-level loading / unloading where we can then create the prefab and unload only the prefab without getting rid of the combatant in memory. That has been working well for a long time now.
We did make a wrapper in C# around the ORK Combatant and we do have lists of all our combatants, NPCs, those who are active in the current adventure, and many more list as you can imagine.
When we save the game, we simply use the ORK.Save and ORK.LoadGame to reload all of ORK.
The issue we are facing is that, when we do a LoadGame, we don't know how to find all instances of combatants and figure the different groups and factions. Looking at the source code, it looks like it is saving all the ISaveData but the CombatantHandler class seems not to be saved and seems to be the only way to get all registered combatants (through GetAll()).
The only group that seems to get saved and that we could retrieve is the active group but that doesn't let us find all other combatants.
We would like your advice on the best way to save and reload the game so we can easily retrieve our combatants, groups, factions, save the progress of player. Is it something handled by ORK.Save/LoadGame?
Currently, I was thinking that we might need to serialize groups and factions ourselves and Save individual combatants and reload them individually but I'm not sure if that's the right way to do it.
Thanks!
Let me know if this is still an issue.
For others working on something similar:
Combatants that are not spawned or part of the player group need to be registered with the system in order for the system to recognize them and e.g. find them with the usual functions. This happens automatically when a combatant is spawned, but can be done manually like this:
ORK.Game.Combatants.Add(combatant, false);
For saving/loading such combatants, they can also be made part of a different player group via group ID.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Yes! You really helped us with your answer! So far, it seems to work fine! I will tell you if we have other issues with saving/reloading.
Thanks!!!!