I'm writing a sandbox-type game and i'm looking for a good way to store game data. I tryed Lua and plain text files, but the have a big minus - player can edit them his self!
So how do I protect data from player? Thank you!
You can store the game data in a file, and obfuscate the data if you do not want the player to modify the stored values.
This would be done by encrypting your data, and then decrypting it when you load it up in your game. The encrypting / decrypting would be hard coded into your binary.
That being said, if someone wants to get at the game data, there will be attempts at cracking your encryption technique, and publish a hack. You can try to prevent the data from being hacked, but you cannot stop it entirely.
If your game is a single player game or not connected to the internet, and you don't have them use any kind of DRM that big companies can have (Ubisoft, EA, Blizzard and the like), users will find a way to hack in your data and modify them.
There are ways to obfuscate it, and make their life harder, but ultimately, someone motivated enough will find a way to reverse engineer your data (savegame or assets), make an editor, and change the content of your game.