Saving and loading game data is an essential part of almost any game. These two processes should be fast, efficient and error-prone since nothing is more painful for a gamer than losing progress he has been working on so hard.
In this tutorial I will show you an easy way to save and load your data applying a technique that makes it unreadable by the naked eye — Base64 encoding. The good part is that you will need to implement it only once, afterwards you can simply copy\paste it to all new projects changing underlying models.
Prerequisites
For this tutorial I’ve partially reused the swipe game mechanics from my latest game. In order to destroy a ball, player should swipe in the correct direction — white side of the ball. Each wrong swipe will reduce remaining life. Occasionally collectible stars will be added to stars count.
Then we will save incorrect swipes total count into a results file and collected stars total count into stars file.