Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Megatron

Protecting your files (or don't touch my .bmp)

This topic is 6182 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

Does anyone know a way of hiding files, or changing their extensions during or after compile time? Basically, I would like my game to use files that aren''t easily tampered with. After all, I''m thinking of the little children who might scribble with microsoft paint all over my pictures which would then be loaded into the now ruined game.

Share this post


Link to post
Share on other sites
Advertisement
don''t use a standard file format. you can use a bitmap like format, by just screwing with the header information enough so that MS paint or photoshop doesn''t know what it is, and then when you read it in, you just strip out that extra info and use it like a normal bitmap.

--michael

Share this post


Link to post
Share on other sites
Well, the way chiuyan mentioned would work, or if you wanted to you could write your own image format, that way only your program would be able to read the file.

Share this post


Link to post
Share on other sites
Create a resource file which contain all your files.

I did. There is a tuturial on this site called "Resource files explained" (or something like that).

Share this post


Link to post
Share on other sites
This question comes up quite often.

There''s no fool proof way to protect your images.
If someone really wants to reverse engineer your formats, they will. And it will likely be some 14 year old with a lot of free time.

The more important factor here is that you shouldn''t even bother trying to obscure your graphics. Who cares if someone messes with their local copy of the graphics? It only hurts them, if anyone.

The vast majority of games you buy today have graphics stored in known formats. The images in Quake3 are all JPEGs and TGAs. The images in Tribes 2 are PNG. Anyone can easily alter the images. So what? If they want to, let them.

Actually these games have shown there''s actually added value in having your game be as easily modifed as possible. In most FPS games you can even change most of the game logic if you want, through scripting...If people want to do it, let them! The only good reason to try to stop pieces of a game from being modified is if the modifications can somehow be used to cheat in a multiplayer version of the game, which shouldn''t be an issue with the vast majority of games/renderers (one exception: hacking alpha maps to let you see through walls and such could be possible if not specifically avoided by the game programmer. Not too hard to code a fix for that one specific problem).

Share this post


Link to post
Share on other sites
Generally, your loading routines will work on a file regardless of its extension, so you can happily change a .BMP into a .GFX or whatever you like, and it''ll probably still work. You could also add some sort of checksum or date-checking routine, to ensure they haven''t been altered. But as others have pointed out though, if someone wants to work it out, they will do, so I wouldn''t lose any sleep over it.

Share this post


Link to post
Share on other sites
chiuyan solution is fine unless you are using the Win32 api to load the bitmap (LoadBitmap, etc), AFAIK they work looking at the extension of the file to see what''s its format.

Most of the libraries of BMP loading work with the format itself, so it won''t be a problem if you are using them.


--DK
--H. Hernán Moraldo
http://www.hhm.com.ar/

Share this post


Link to post
Share on other sites
I might try one or two of those methods for my own curiosity, but I guess you are right...if those meddling wee-uns want to foul things up for themselves...let em. Thanks all.

Share this post


Link to post
Share on other sites
There is a method used in criptography to hide messages in images.

I don''t really know much about this, but aparently the method works like this:

If you have a certain message, you break the message down to bits. Then you go to the image and change the least significative bits of some of the bytes by those you wan´t (that is the bits of the message). Attending to the fact that you''re messing arround with the least significative bit of some bytes, the human eye cannot tell the difference. Of course, it is you who decides wich bytes to change (some people go for sequences like prime numbers or fibonacci).

This could be applied to games. When you load the image, you go check that particular bit in those particular bytes and see if they match wath you want. If they don''t someone has been messing with the image.

Look, i''ve never tried this. It''s just an idea. Of course, it is always possible for someone to reverse-engineer your program and find out wicth bits you''re looking for, but that''s a leatle out of reach for "normal" people who want to mess with graphics.

Like i said, it''s just an idea.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!