I'm building an HTML game. For this game I want to implement a save-feature that should work like in some already existing games:
The user can chose export
, this will create a string, representing the game state (I guess).
This string can be pasted into an import
input and will load the save game.
I thought about storing the state in a JSON, minifying it, stringifying and encoding it in Base64. But I don't think this is a good idea, users could easily cheat in this game by decoding the string, changing whatever they want, encoding it again and loading this string.
I already tried generating save files in games with this feature and decoding them in Base64 which didn't work, so I assume they use a different encoding.
How can I encode the JSON like this?