Tutorial: Storing game data

Tutorial: Storing game data
0

Learn a few options for storing game data that can persist between playing and app updates.

Storing game data

1 Like

Just a heads up to anyone looking to store local data on device. UserDefaults are very easily hackable by anyone with a jailbroken/rooted phone as they are simple files that can be modified. With SQLite, it is a bit harder to do, but also possible since the file is on device. Encrypting local databases can be one step to help these issues (SQLCipher and WXSQLite are some examples), but generally I would recommend to store data remotely. Defaults are best used for non-sensitive data (ie user volume settings, user localization choice etc). I wouldn’t recommend storing say a user’s high score on device, or a non-consumable IAP check, etc.

You can protect userdefaults:

http://discuss.cocos2d-x.org/t/how-to-use-flatbuffers-in-cocos2d-x/35367

If you obfuscate/encrypt these values, the user can still modify. Then if your application cannot parse/cast the new value it will likely crash your code if it is not built to handle these cases. Plus your codebase can still be decompiled and any plain text keys can be easily found by an experienced person looking to exploit. You can never 100% secure software from anyone, only make it so hard it is not worth the time of the attacker :grinning:

the link is broken.

You can read it on GitHub here

1 Like

It’s fixed now. We changed directory structure to accommodate v3 and v4 docs now.