Advertisement Jump to content
Sign in to follow this  

Encoding game data

This topic is 4937 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, Can anyone advise how i go about protecting client side game data? How do I stop people fiddling with stored variables, meshes, heightmaps etc? Do I Have to write my own loaders that encode this stuff? I know I can store variables in binary form, but what about images etc Thanks Simon

Share this post

Link to post
Share on other sites
As for game data and preventing cheaters, storing it in binary is not very protective. Any decently intelligent player can still hack the heck out of it. I would suggest the best strategy would simply be to mix it up enough so that it's extremely difficult to find specific data. Here's an example of how easy it can be to modify your character's attributes in an RPG:

Let's say your character has these stats in your current game:

Str 90
Int 40
Wis 50
Luc 35

In hex, these convert to
Str 5A
Int 28
Wis 32
Luc 23

That translates into 5A283223

Since most games store data in 32 bit chunks, that means I'm looking for a string of data matching..
5A 00 00 00 28 00 00 00 32 00 00 00 23
It might be backwards, or in 16 bit chunks, or other little differences, but the data is usually grouped together.

So we just load the binary saved game file into our hex editor. If the saved game file is huge, it will be very difficult to locate this data by eye. But simply searching for this pattern will most likely only turn up one result. Now we can play with these numbers and custimize our character.

I know it's a hassle to modify data before saving to file, but you're really going to be forced into doing so unless you don't mind the hacking. Compress/encrypt it with your own algorithm, or just make it confusing enough to throw everyone off.

Share this post

Link to post
Share on other sites
You can always encript your data in some way. YOu can abstract file I/O in a wrapper where all your file loading / writing goes through a process of decrypting / encrypting / CRC checks beforehand.

Also, packing data into a virtual file system helps (like in zip files) putting a little bit more space between your code and work and the user. Hell, just use an encrypted zip to secure your files.

However, there is no perfect system. Any hacker worth is salt could rip through your data or decryption code, given some time. Just basic reverse engineering.

Another way is to scan memory, since graphics and alikes are stored in contiguous arrays, you can just rip it out straight away into a viewer, for example.

A classic example, from my old days, were memory rippers for the Amiga and Atari. All you had to do was load up the game, reboot the computer (which didn't clear the RAM), load a small ripper and scan memory for data, like sounds, audio tracks, graphics and anims...). Nowadays, there is no need for that kind of stuff, ripping memory is dead easy, but it still requires some effort.

Binary won't save you. You need encryption, if you can be bothered. But your precious data wil never be 100% safe. Since you are talking client->networking, I assume you want to detect cheats. Protecting your data is just not enough, you have to do some work on authenticating the client data onto the server.

Share this post

Link to post
Share on other sites
Original post by sipickles

Can anyone advise how i go about protecting client side game data?

Long story short: if it's on the client, it is vunerable no matter what you do. If you're worried about single player stuff then you've basically got to just relax and let the user mess with their own game as much as they want. If you've got some kind of multiplayer scenario that means not trusting the client and double checking every important thing on the server.

Unfortunatly due to the internet being as slow as it is, you'll probably have to make compromises somewhere along the line. The trick is making as few as possible and minimising their effects on the game.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!