I'm developing an iOS game and was considering putting level info and monster info in a Lua script for ease of use. However, since I'm using Game Center for multiplayer I'm concerned users will attempt to change these scripts to cheat. What measures can I take to protect my Lua scripts?
|
One approach you can do is use the program I believe luac is built when you build Lua from source. Also note that luac compiles scripts differently based on the platform it was built on, so don't, for example, use luac on windows to compile your scripts. Read more about luac here http://www.lua.org/manual/4.0/luac.html That provides one layer of security. You could add extra layers by say, archiving your lua scripts into another file format which would be opened and read by your program. I'm not very experienced with this however. |
|||||||||||
|
The same steps you would take to protect any data. Lua isn't special just because it's text. If you need the user to be unable to easily modify the data, employ some encryption. The more complex the encryption, the more difficult it will be for them to deprocess it. However, as I understand iOS (which is admittedly not much), you probably don't have much to worry about from casual cheating. Users can't easily inspect an application's private data. So I wouldn't be concerned. |
|||
|
Your lua scripts are not autonomous, they are likely loaded by a bootstrapping mechanism and hardcoded along with your binary. You can run a simple md5 hash on the scripts and verify the hash matches before loading. Having said that, to change the scripts an end user has to jailbreak the device to break the signing of your app, which means they are in theory also able to hijack the md5 checking code... as another answer said, it's a matter of how much effort you want to force your end users to go through to hack it and how much it forces your development to go through hoops. |
|||
|