How to prevent the player from editing a stat file in Java -
i creating game use file record player stats (speed, level, etc) can keep using character after exiting game. problem in test version using basic java filewriter save/read stat file open notepad , change stats (which don't want).
is there safer , more secure way , if there link tutorial it?
i had heard using xml might clueless start on this.
first, general advice: if of stuff on client side, can nothing protect it. can increase time takes decrypt it. if worried player manipulating save games, have turn game always-online cloud-storage solution (which comes own problems, not technical).
second, why want prevent players editing savegames if game not online? lot of gamers (me included) storytelling not games, , more once reached point didn't play game anymore wanted know how story , characters go, or wanted experiment. without savegame editor, would've disengaged game, cheating had great time seeing how rest unfolded (and guilty pleasure one-shotting tough enemies). if player wants cheat in single-player game, why not? it's experience, , can keep them engaged.
the 2 reasons prevent cheating support , competetive scenarios. if one-shotting boss character prevents event that's supposed run @ 50% health run , if complain game in unwinnable state, have work figuring out savegame manipulated , it's not bug on side. on competitive side, if have achievements or leaderboards, cheaters problem.
but again, can't have competitive elements in game that's 100% on client since can't prevent tampering.
here few tips how make tampering harder:
- using checksum on savegame
- encrypting key stored in code, or (brittle!) using sha1 of file in game encryption key
- keeping list of "valid" states , detecting impossible situations, e.g. level 3 character 9000 hp or level 20 character hasn't progressed past chapter 2 in story, or character wielding tainted blade of armageddon outside of cloud castle dungeon
- detect savegame manipulated letting player go ahead, letting them know technical support wouldn't granted issues savegame.
Comments
Post a Comment