denniss
denniss

Reputation: 17589

iphone game loading/saving/configuring level

I would like to set up the configuration of each level of my iphone game through a plist or some kind of flat file. One drawback of doing this is that user can potentially open up the app and change the flat file. I am now thinking of hard coding it as an instance of say Config class. Is that a good idea? What is the conventional approach for saving/loading/configuring levels?

Upvotes: 2

Views: 113

Answers (1)

mvl
mvl

Reputation: 789

The approach I've often used is two-fold: First, write the data out as data, rather than text, simply to make it a bit less obvious what it is. If you're using a plist, you can serialize it as an NSData element. Secondly, create a hash (SHA-1, etc) of the data, salted and/or concatenated with some value internal to your program, and store the hash either along side the data or somewhere else. Then when the data is read back in, you can validate that it hasn't been tampered with.

You could obfuscate the data in various ways, or actually encrypt it before storing it. Encryption has export ramifications however.

Upvotes: 3

Related Questions