Archived

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

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

This topic is 5971 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
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
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
Guest Anonymous Poster
Would it not be easier to just calculate a checksum of all the data in your graphics (add all bytes, and mod by 2^32).

Then in your code, do a checksum of the graphics, and compare it to your precalc''d checksum. If they do not match, the graphics have been mucked with.

I think this is a more effective solution, as it would be difficult to modify the graphics such that the checksum is the same.

And in your game, you can do something like - make the game insanely difficult if it detects the graphics have been messed with (like give your player 2 hit points, and double all the enemys'' power or something like that, heheheh).


Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Um idea, the resource file thing sounds nice because the textures will be compiled into the exe file, that way the only way they can get to you images is to crack the exe open, I would change my dibs into ico file that way they would have to own a software program inorder to edit the ico, but then if you compile the ico into the exe that would be even more secured, you could also add a feature to calculate the values of the red, green, and blue colors of your image through somesort of mathematical equation that way when the program is ran and the images have a value that false the program will not run.

Just some ideas that I''ve thought of but I wouldn''t care if someone uses my textures just aslong as they give me credit, because some aren''t fortuned enought to beable to own a Photoshop, 3D Studio Max, Maya, Lightwave, and all those other VERY exspensive are programs.

Share this post


Link to post
Share on other sites
I''ve never understood the reasoning behind all this concern about people tampering with your game''s files. As other people have said here, who CARES if Joe Blow changes the main character to look like George Bush? Who does it harm if he changes the sound of the gun firing to the sound of a car horn? For me, once I get sick of a game like Warcraft or Doom or something I''ve had kicking around for years, I can get a whole new experience out of it by just changing the art around or recording some funny replacement sound effects.

Most commercial games nowadays encourage people to modify them now, to give more entertainment and replay value. I see no reason to kill yourself writing complex error checking code when there isn''t any harm done by the data being changed.

Anthracks

Share this post


Link to post
Share on other sites
I''d care if anyone come down and hack my program/game.
I would be honored. That means that ppl really USE your program and CARE about it
I do agree, though, that games like Quake and so on really MUST be alterable (?) ''cause it keeps the games alive. (CS for half-life is a perfect example.)
But if i, say, make a program, and only release a shareware version of it, and i some day find crack for it, i would be REALLY honored, ''cause then i know that ppl thinks it''s a good program.




Electron

"Who need more than 640kb of RAM?" -Bill gates -89


Share this post


Link to post
Share on other sites
I would protect my graphics, in the defense that someone could steal your textures and use them in _their_ game... Don''t you just hate when ppl steal your work and get more credit then you did?

Share this post


Link to post
Share on other sites