Forgot?

Register
1 ·
Anti-cheating save files, simple method I thought of earlier
Posts: 766
Status: Offline
Group: Admin
Member: #12
I've been thinking about this all day long despite thinking to myself "I'm not actually going to do this," but the thought saying "it'd be a waste to forget about this" is also slapping me in the face. So here I make this topic to get this out of my head.

Recently I've looked into using plain old .bin files to save game data with, because it is simple to do if you don't plan to save a lot of data, or otherwise if you take care to come up with a good saving/loading algorithm. One method of anti-cheating such save files would be to generate a number or two within the file based on the things saved. Open loading, call it corrupted if the generated numbers in the loaded save doesn't match up with those generated using the other info in the save.
Never change your avatar
Posts: 3154
Status: Offline
Group: Admin
Member: #1
Sounds interesting. I'm not familiar with how one would go about using .BIN files with GM, though.
Course clear! You got a card.
Posts: 766
Status: Offline
Group: Admin
Member: #12
Bibby
Sounds interesting. I'm not familiar with how one would go about using .BIN files with GM, though.

I can create an example if you want. It's simple if you have what you want to save in mind, and there isn't much you'll be saving, but it gets more complex with the more stuff you want to be able to store.

Basically you SaveFile=file_bin_open("yourfile.bin",2) and then set a sequence of variables each to file_bin_read_byte(SaveFile) (or, inversely, do a bunch of file_bin_write_byte(SaveFile,VarName) to save it.) For every byte read or written it automatically goes to the next byte in the file. The order you set variables is the format of the file. So, if you were to save a new bin file, and then you did this:
file_bin_write_byte(SaveFile,3);
file_bin_write_byte(SaveFile,5);
you would have a two-byte file. In a hex editor you would see 03 05. Now, let's say you already have a file just like that. If you were to then load that file, and then you did this:
Coins=file_bin_read_byte(SaveFile);
Lives=file_bin_read_byte(SaveFile);
you would have your coins at 3 and your lives at 5.

I can create an example that takes the work out figuring out whether it needs to load or make a new file if you want to attempt using BIN files in any future games.
-/+
Users Viewing This Topic
1 ·