Sprite Formats

Started by
1 comment, last by GameDev.net 18 years, 4 months ago
I'm developing a fighting game, and up to this point, I've been using *.BMP format. It's working so far, but this format makes it easy for people to just go in and edit the sprites, and it's probably hiking the file size up. Is there another more protective format that I could convert BMPs to? I'm using SDL, just for the record.
Advertisement
Well, the simplest way to protect your data from people casually modifying it would probably be to use something like XOR encryption. I think there was a Sweet Snippet on GDnet about how to do that. It's not secure of course, but it will stop people just opening up your files in paint or whatever.
If you're going to implement that, then I would suggest you look into using some kind of archive system as well (that is, keep a bundle of resource files packed up into a small set - maybe just one - of archive files; you can make your own archive format, or just use a fairly standard system like .zip files, for which libraries are freely available). That way, you can put your XOR encryption code in with your archive handling code so that it will be done for all your resource files (or rather, all the resource files that you put into archives).
In fact, if you do use an archive format (other than standard .zip), then you might not want to bother with any kind of encryption at all, since it probably won't be obvious how to extract files from your archive.

As for the size issue, there are other image formats you can use. I would recommend .png format, which can handle different bit-depths, and alpha transparency, and gets quite good compression ratios, depending on the type of image. The SDL_image library can load several of the common formats (including PNG).

John B
The best thing about the internet is the way people with no experience or qualifications can pretend to be completely superior to other people who have no experience or qualifications.
well, i had the same problem few days ago.
I done written a simple encrypted zip file for my needs.
It's simple to use and it compresses bmps quite enough
without any quality damages.

This topic is closed to new replies.

Advertisement