I am making a simple text game in Java and I wanted a safe way to save statistics (money, etc).
I could do a text file but then it could just be modified. I was wondering if there was a simple way to make it a little more difficult for someone to mess around with the saved statistics.
Serializing might be a simple solution. Store the data that needs to be saved into a Serializable class (Look up the java Serializable interface) and write it to a file. It won’t be uber-encrypted, but it’ll stop people from just opening it up in notepad and changing it.
Here’s a simple example of how to serialize an object to a file; googling around should produce more if needed.
http://www.rgagnon.com/javadetails/java-0075.html