Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm in the pre-planning phase of coming up with a game design and I was wondering if there was a sensible way to stop people from editing saves in a game with offline and online components.

The offline component would allow the player to play through the game and the online component would allow them to play against other players, so I would need to make sure that people hadn't edited the source code/save files while offline to gain an advantage while online.

Game likely to be developed in either .Net or Java, both of which are unfortunately easy to decompile.

share|improve this question
add comment

4 Answers

Being able to decompile/reverse engineer the client code easily is really only a slight hindrance. Enterprising hackers have been bending executables to their will (maliciously and non-) for years before high-level, trivial-to-decompile languages like C# came on to the scene. Security through obscurity alone is no security at all.

Any data on the user's machine (code or regular asset data) is essentially compromised already. You can't really protect yourself against that -- if you don't want people editing data, don't put it on their machine, save it on your servers. Similarly if you don't want them modifying the code in the client, make sure the client doesn't have control over anything useful.

If that's not an option (for example your multiplayer is entirely peer-to-peer) you can do things like compute hashes of the relevant assets and only allow people to play with eachother if the hashes match. Yes, somebody could carefully craft an edit to the executable such that it returned a different hash, but all that should mean is that the offending player will desynchronize and disconnect from the game relatively quickly because his or her assets don't match the rest of the players'.

You could also employ a "majority rules" type of test that allows for you to disconnect players whose simulation has drifted out of sync with other players, giving the "host" player (whoever started the game) the tie-breaking vote.

share|improve this answer
add comment

If the data is all generated client-side, there's nothing you can do about this. You can't tell the difference between an edit done by your software and an edit done by someone or something else pretending to be your software.

One deterrent you can try is encrypting the save file, using a key in the software. Unfortunately, if the user is good enough to edit a save file, they're good enough to find the key in your software too.

You can stop people editing the saves by not storing them on the client's machine, eg. by uploading them to the server - but that doesn't stop them uploading a hacked save in the first place! Online games solve this problem by keeping the authoritative game state on their server all the time, but that won't work for your offline mode.

So really, the answer is no - anything your game can do to edit, obscure, or encrypt the data can also be done by a hacker.

share|improve this answer
    
I realise this is pretty much what Josh already said, but I had an internet outage and couldn't post this 30m ago when I first typed it! –  Kylotan May 6 '11 at 16:27
add comment

When we were just starting development of our current game, we, too, wanted to have offline play mode. The idea was to let players play through game levels while offline, and then somehow sync their progress when they come online. So, we thought long and hard about how we can prevent cheating. The conclusion was: we can't. There's really NO way to let players play offline and be 100% sure they didn't cheat.

share|improve this answer
add comment

One simple solution used with file downloading is hashing. Hash the save file and store this "fingerprint" somewhere. When you load it, hash the file, and check it against the fingerprint. If they don't match, the file has been modified.

Of course, if someone decompiles your code, there's nothing you can do. For this answer, this means they can store the hash of the modified save file, too.

Another option would be to send the fingerprint to a server somewhere, where the end-user can't manually modify it if they've modified the save file. This is similar to what iTunes does when restoring iPhone images.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.