Ultimate Amiga

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: How to save/load binary encryption in disk?  (Read 2984 times)

0 Members and 3 Guests are viewing this topic.

xboxisfinished

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 205
  • Generic Amiga User
    • gamemakermagazine.com
How to save/load binary encryption in disk?
« on: October 24, 2015, 12:33:55 AM »

  Hey,

I have one simple question. In my game when you pass five levels it automatically saves your progress in a disk. My question, how do I write a code to save level number in a file that is encrypted and not modifiable from a notepad or anything like that. So for example when I pass the fifth level it saves on a file:

savedgame.bin

and inside that file is a square or some gibberish character that if a person attempts to modify that file and put any number they wish it will become corrupted in the game side and will prompt "file savedgame.bin is corrupted" and I have to start again from the beginning to replace that corrupted file.

Any help on this will be greatly appreciate it. Second of all, in consoles when you save a game an animated icon appears as the game save is in progress indicating do not turn off the console while saving. Can I do something like that? How hard to do something like that?

Thanks in advance.
Logged

KevG

  • A600
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 87
Re: How to save/load binary encryption in disk?
« Reply #1 on: October 24, 2015, 08:59:15 AM »

Hello.

There are a number of methods that you could use. One of the easiest would be to use checksum data within your saved game. One way to do this is to add up the values of all the bytes/words within a 16k chunk for example and then place the total value at the end of that 16k chunk. So for a saved game that is 64k in length you would have four checksums. If any attempt was made to edit the file then the checksums would be wrong and you could display a message etc. If you wanted to use encryption as well then you could certainly do that for a bit more security. This is just one way to do it. There are many other ways but you get the idea.

When saving your game, simply display an animated message/icon (using AMAL) until the saving is done.

Hope that helps.
« Last Edit: October 24, 2015, 09:02:43 AM by KevG »
Logged

xboxisfinished

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 205
  • Generic Amiga User
    • gamemakermagazine.com
Re: How to save/load binary encryption in disk?
« Reply #2 on: October 24, 2015, 10:14:24 PM »

Hello.

There are a number of methods that you could use. One of the easiest would be to use checksum data within your saved game. One way to do this is to add up the values of all the bytes/words within a 16k chunk for example and then place the total value at the end of that 16k chunk. So for a saved game that is 64k in length you would have four checksums. If any attempt was made to edit the file then the checksums would be wrong and you could display a message etc. If you wanted to use encryption as well then you could certainly do that for a bit more security. This is just one way to do it. There are many other ways but you get the idea.

When saving your game, simply display an animated message/icon (using AMAL) until the saving is done.

Hope that helps.

Thank you. I will look into checksum and google about how to add complex encryption into my saved game as well as study out AMAL. I am intending to implement these features in my game. I must implement them or else I will not be able to release the game. :)
Logged
Pages: [1]   Go Up
 

TinyPortal 2.2.2 © 2005-2022