Posts Tagged ‘save’

Save Games in Unity: Building a robust, extendable save format in XML without tangling up your code

Posted to Game Design by admin on June 3rd, 2009

Unity is a wonderful game engine that we take great advantage of when creating our games. It offers great support for many things out of the box. This post deals with a common problem for game developers: creating save files. Along the way we’ll figure out how to make them readable, maintainable and easy to debug.

One complaint I often hear in the Unity Community Forums is that unity comes with little out of the box save capability, and there doesn’t seem to be a recommended solution.  Depending on the game you are creating, something as simple as the PlayerPrefs class could suit your needs. However, for games with more than a minimal amount of data, and more than one type of thing to save, PlayerPrefs won’t be ideal, and you’ll need to create your own save file (and therefore your own save format). Some people use C#’s built in serialization support, or create a binary save format. Since disk space is plentiful these days, and dependability and stability are very good things indeed, we’ve chosen to create our save files in XML. XML gives us access to many existing well tested tools for reading and processing large files written in a human-readable markup format, reducing bugs from the start.
(more…)

Divider
Facebook YouTube Twitter