The main task I am working on this week is figuring out how we are going to let the user save their data while playing our game. There are two major portions of our game: creating a board game and playing the board game. This means we need to figure out how to save a created board so it can be played later and how to save player stats while they play the game.
I spent some time researching various ways to save player data. I soon got overwhelmed with a large variety of options! To simplify it, there are two broad categories: server-based or local-based saving. Saving the data in a server, such as MySQL, would be useful when creating a multiplayer game where people play at the same time on different computers. To make it easier on ourselves, my team decided to assume that anyone playing our game would do so on the same computer. This means we can save our data locally onto the players computer.
Even once we decided to go with a local saving option, there were still many, many options with various implementation difficulties and security options. I decided to go with PlayerPrefs, which is a class in Unity. Due to it being a class in Unity, I can look through the Unity documentation to figure out how to use PlayerPrefs. I am hopeful that this means it will be easy to implement. Player Prefs works on a variety of operating systems by saving to a file on the computer.
The main downside to PlayerPrefs is that sensitive information should not be stored on it due to data being stored locally with no encryption. To better protect data in a game, a technique such as serialization and conversion to a binary file should be used (2). The Unity Asset store has an asset called Easy Save, which uses serialization to encrypt player data. It costs $69 and has excellent reviews (3). For my project, data does not have to be secured because nothing sensitive will be put on to it. PlayerPrefs should be good enough for the type of project I’m working on. Still, I’m glad I know a little more about other options, in case in the future I decide to do a type of project that needs its data more secured.
Sources: