New possible type of save?

Hey guys, I just made a little nifty but small program that converts binary data into images.
I mainly just created it out of curiosity of what a program would look like as an Image.

And the results are quite interesting. (Images at the very bottom).

Now this made me come up with the idea that this might can actually be used to save your game data as well,
each color is obviously made up from 3 sets of binary data (Red, Green and Blue), change any of them values and you have a broken set of data completely.

Now obviously this may not be a perfect solution, but it makes me wonder how good it may actually be.
… The reason I think it may be kind of secure is because as mentioned above, each pixel would relate to 3 different binary values, change a pixel to any other color to try and adjust it and cheat, might break it.

The way I have it designed it would break it, no matter what way you try and put it because no matter what it takes 3 bytes to create the needed pixel value. So 1 or 2 of the bytes may be part of ā€œ=ā€ for example for a float or bool or int, so adjust the values wrong and you have health - 5; instead of health = 5;

Now this isn’t to say this is perfect, or any better than anything else, but I just thought this was interesting, and wonder if this would be good for saving data, I mean it’s certainly more secure than plain text, and certainly more secure than pure binary, but it’s still I know of course not unhackable.

Images below.
3265142--251967--DataToJPG.jpg 3265142--251968--DataToJPG_02.jpg 3265142--251969--DataToJPG_03.jpg

4 Likes

Props for thinking outside the box and trying to find weird uses for image formats. I always like that. But I don’t quite see the point. What does that solve that encryption doesn’t solve, and is it worth solving in the first place? Personally I see no reason to not just save stuff as plaintext. If someone wants to cheat because they have fun with it, let them. Achievements are meaningless anyway, and I know no game with a highscore list that doesn’t have cheated entries (except maybe Devildaggers because there highscores get submitted with replays and I think they just delete all that don’t look legit).

5 Likes

@Martin_H That is a very valid point, I wasn’t thinking of it replacing encryption, just a way to mask the data. just a small step to hide the data from wanna-be hackers…

Example if it’s saved in like (Project/Images/Preview.jpg) most people wouldn’t think anything of it, they’d just think it was weird looking image…

Not really an encryption, just a small, little extra annoyance to wanna-be hackers.

But honestly I didn’t create this for this intention, it was just an idea after I created it. Quite an interesting one as well lol.
Its in no way perfect, and doesn’t replace better solutions, (I don’t think). Maybe people know more about pixel data than I do, I just thought it was cool haha.

THe problem here is that UNity doesn’t have raw image manipulation classes that are not tied to textures. And the textures are hardware dependent.

Dumping data into images is nothing unusual - it is pretty much the same thing as a normal data container, as long as you’re using something like PNG.

IN addition to that there were multiple games that stored saves in *.png file metadata. An example of those were Spore games, which stored creature parameters somewhere within the file, I believe.

Also… beware of lossy compression data formats.

By the way, if you really feel like it, you could encode your save into a QR Code or similar marker. This will make it readable with a smartphone.

1 Like

@neginfinity Ah man I completely forgot Unity didn’t have such stuff, guess I kinda assumed that the new .net in Unity would have it, suppose not.

I hadn’t realized many people stored data in Images, pretty interesting. Hmm never even studied how QR Codes worked, I may study it up one day, thanks for the info mate.

If you save it as an actual jpg it’s already broken because reading it again you get ever so slightly different pixels back.

I would assume they love that kind of stuff.

That’s something I could see being useful for something.

I would suggest to store data in bmp images that makes sense for people to edit them with paint or something similar. Imho making it easier to edit is a better reason to store stuff as images, than trying to make it harder. E.g. I’ve experimented with storing colored pixels for spawn-points in tiny 256x256 pixel image files. Works fine if you don’t need too many diferent layers and states. Such a bare-bones ā€œlevel editorā€ could be cool for people to have. The savegame thing seems rather pointless to me.

1 Like

It reminds me of the time when I had to do a contract work at a place where they had unreasonable security measures. I was forbidden to take my own source code outside, even for a personal reference. They blocked the whole internet (if I had some programs I need, I had to ask them to dowload them for me) and even checked the whole file system for source codes or archieves that might contain them when people leave that place.

So I wrote a similar program to take bunch of source code and encode them as bitmap image files. I didn’t actually use that program though, because I wasn’t sure if it wouldn’t be a trouble later and concluded those source code were not worthy enough to justify all the hassle.

2 Likes

@Martin_H : Well as I mentioned I wasn’t even making it for this intention, I just thought it was cool with the results of getting data into an Image lol. Well now I know it’s not exactly useful for Unity case, that’s partially why I wanted all your opinions on it before even trying to make it for this.

It was just a fun little project I made in a couple hours.

1 Like

By the way, not sure if you’re familiar with it, but in ZX-spectrum era it was not uncommon to load executable code into screen area. Spectrum had 64 ram total, and the screen took quarter of it. So, during loading phase of the game, some games set the color attributes to ā€œblack foreground, black backgroundā€, loaded machine code into the screen area and ran it to perform some sort of setup in other part of the memory. If the game failed to ā€œpaint the screen blackā€ for some reason, you would see the ā€œsnow patternā€ filling the screen.

1 Like

That’s pretty cool! Never played them games and such before, I was roughly 4 when I got my hands on an Atari (1992) and that’s the oldest I’ve gone back… Always wanted to try the older platforms, but that’s pretty cool, do you know how expensive this old hardware is online? If it’s anything like an original NES costing 10,000 dollars brand new in a box then it’s out of the question for me haha.

I believe you can buy clones for cheap. Nes clone should be easy enough to find (china makes ton of them), spectrum clone… well, spectrum clones are usually DIY kits.

Also, I see ton of spectrums on ebay. The price is a bit steep, but not $10000 for sure. Same goes for nes. If you REALLY wnat the original hardware and don’t mind messing with analog connection, you could get a used/refurbished one.

1 Like

Pretty common way to pass non-image data to a shader. I have one shader that colors the areas on a map using various data values stored in the RGBA channels of a 128x1 bitmap. Another input texture acts as the ā€œreference mapā€ with each area in a different color that defines the lookup location in the data texture.

These days there are actual arrays available for shaders, though. And those can even be written into. StructuredBuffer/RWStructuredBuffer

It could be a cool way to make micro games in a retro pixel art framework and share them as game cartridge images.

Or your saves could be screen grabs with the save game data imprinted into the image.

1 Like

This is literally what Pico-8 does, iirc

I thought I saw it somewhere, sounds right.

Although there was that indie game that used loading screen images to store the level data, it was a co-op bank robbing game…