0
\$\begingroup\$

Unity has it's own way of saving in which you can add values and any type of information to the registry and it will be saved for future use. However what happens when you try to create a more complex save system such as the one featured in Skyrim. In this case it even get's a screenshot of the moment you pause the game to save and uses it to identify the save file. Also all the current actions the user and the npcs where doing at the moment gets save. How can I implement this complex save system into unity using it's current way of handling save data?

\$\endgroup\$
  • \$\begingroup\$ To clarify: with "unity own way of saving", do you mean PlayerPrefs (which isn't intended for savegames but can be abused for this)? \$\endgroup\$ – Philipp Oct 31 '16 at 2:05
3
\$\begingroup\$

Skyrim actually does not look like it uses an individual record for every enetity on the screen. It actually seems like it does something a little less creative and more robust.

If you take a look at the source code for OpenMorrowind, they did quite a large amount of reverse engineering, and a good look at some of it's entity and script code showed me that Skyrim and Oblivion actually uses a very massive Database.

So instead of iterating over everything at once, assuming you can keep some amount of locality, Or be able to quickly blast through several lists, you can just write your data to a file and patch the pointers later.

The trickier part is recording the data in the scripts. But interestingly enough, Skyrim actually stores all variable data and animation data in the database as well. So you can load back into a game in the middle of a fight, or with a lot of actors near you animating instead of starting off in a standing pose.

In my current game engine, I'm actually heavily basing it's data system off of this fact, but using Lua. The benefit is that I can actually easily implement mods now and not worry about data conflicts.

\$\endgroup\$
1
\$\begingroup\$

Well what I would do is have each actor have a SaveMe method. On Save all the active actors (ie. The ones in the vincinity) will call that method.

That pre supposes that you have a manager that tracks either all objects or all relevant objects.

Also that SaveMe method should take a ref of the save file (xml is great) and append it's own relevant info in it. (maybe you could also do that with a binary of the game objects that you store to bytes instead)

And finally your save manager should store another file, that keeps track of all the existing save files, their path, and takes care of taking and storing the screenshots. (with a binary save file you could store the screenshots inside the save file)

\$\endgroup\$
  • \$\begingroup\$ As a side note for the player quests and inventory it could be pretty straight forward, have a dictionary<string,int> for each of these things. (string for the quests allows you to handle subtasks) \$\endgroup\$ – Géry Arduino Oct 31 '16 at 6:43
  • \$\begingroup\$ To use the player prefs just replace the xml file by a single entry in playerprefs. Even though playerprefs has a limited size. \$\endgroup\$ – Géry Arduino Oct 31 '16 at 7:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.