I started on my first game; and now im confused how to handle the player SaveGames. I use google-play-services to persist the user's save games across devices, and I am keeping a local save too.

So the problem is how do I manage conflicts (server vs local). I have attached Save DateTime on he file and there is general data included.

So this is what im doing right now :

  • I check the number of coins and gems, the level the player has and if all those are greater than or equal to the other save, i take the first save;

  • In all other cases i ask the player what copy to keep; displaying the infos in each save file;

I would like to minimize asking the player which file to keep; (These problem arises only if the player uses multiple devices; Or sometimes he plays locally for a while; and signs in to his acc which already has a save file)

I think you get the idea. I would like to automate everything and dont want the user to go sad just because he misclicked on the local-copy when he had awesome stuff in the server-copy.

I need the idea please :)

  • \$\begingroup\$ "coins and gems", are these purchased with real money? \$\endgroup\$
    – Vaillancourt
    Commented Jun 22, 2016 at 1:39
  • \$\begingroup\$ yes; they are consumables so i thought mentioning it wont help.. am i wrong ? \$\endgroup\$ Commented Jun 22, 2016 at 1:41
  • 1
    \$\begingroup\$ It's very important, for you :) A nosy user will inspect the savegame, inspect the way you manager local vs server, and find a way to edit the local savegame and gives himself LOTS of these. You'll lose money. \$\endgroup\$
    – Vaillancourt
    Commented Jun 22, 2016 at 1:44
  • \$\begingroup\$ Uhoh.. currently the save game is just a SaveGame object and serialized to byte array, wont he be able to modify it anyway ? :( **tips on saving the savegame file too please :D or, what do you suggest that i should do ? :) \$\endgroup\$ Commented Jun 22, 2016 at 1:47
  • \$\begingroup\$ Only one savegame: on the server. When the user buys a token, you update it on the sever, when they spend a token, you update it on the server. They have to be connected to spend them. There might be other ways to do it. \$\endgroup\$
    – Vaillancourt
    Commented Jun 22, 2016 at 1:50

1 Answer 1


If you completely trust your client, or don't care if they mess around with the save file, simply keep some sort of incrementing counter in the save file. Then you can easily tell which save file is newer. Datetime seems like the right answer except it may break if your clients clocks are out of sync, if they set their clocks forward etc. Game variables that don't always increment, like gems or levels, is also bad - what if they don't increase, what if they decrease? The counter can be the turn number if your game is turn based, or a "game clock" that is incremented by the game, based on frames.

If you are worried about the client manipulating the save file, remember that the save file time/counter is not the only thing they could manipulate - anything from scores, levels, achievements - so check out this question: How can I protect my save data from casual hacking?

If you go the route of server-only saving, you need to guard against other kinds of cheating. Check out this question: How can I prevent false score reports to global highscore tables?

But keep in mind that, unless there is a multiplayer component like global high scores, or the game is monetised, requiring players have an online connection to save in a single player game is a very anti-player design.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .