Jump to content
  • Advertisement

Archived

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

oto76mm

How to hide game graphic file

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

My game load BMP from file, so I have to distribute these BMP file together with the game. Does anyone got way to hide those graphic file such that user will not be able to see such file ???

Share this post


Link to post
Share on other sites
Advertisement
The response to your question could be pages and pages of different stragities. Firstly, check out nehe.gamedev.net their latest tutorial talks about how to hide resources (bmp''s etc) inside the .exe file.
OR
you could look at file conversion code, IE, convert your files from .bmp to .whatever via you swapping your data around (Like a custom image format)
OR
you could look up ZLib and figure out how to incorporate .zip file reading into wahtever you''re doing
OR
you could take a look at the quake source code, and figure out how they did their .pak file code.

The options are limitless
~Main

==
Colt "MainRoach" McAnlis
Programmer
www.badheat.com/sinewave

Share this post


Link to post
Share on other sites
quake1 pak files are not encrypted though (so people can get your files out of it), although they are very easy to use. A zip file accessing library would be a good idea, since zip files can be encrypted.
I personally wrote my own pack file system that encrypts and compresses the datafiles within, this method requires the most work but can be rewarding.
Creating your own file format for all your different data types can be a bit too much work, so I suggest some of the above alternatives. Also if you are using a gamemaking library such as allegro, it already has built in datafile support for its resources. (many other gamedevelopment libraries have similar)

Share this post


Link to post
Share on other sites
True, pak files aren''t encrypted, but if you juggle your data correctly, people won''t be able to pull it out anyway. IE Just encrypt your FAT table for your file, and people can''t access your data.
And zip files can be encrypted and compressed, but can''t they be accessed via winzip?
What I Opted to do, was use the zipfile base code, but i encrypted the header file for it (IE a combination of the two above techniques)So it couldn''t be opened in winzip/rar/etc. And i still get the compression code.

~Main

==
Colt "MainRoach" McAnlis
Programmer
www.badheat.com/sinewave

Share this post


Link to post
Share on other sites
Lets say I wanted to store an image file in a .zip file.

What is the process used to go about accessing that file?? If it was just in a normal folder I''d do something like



LoadTGA("imageFolder/image.tga");



I have no idea how I would access it from a zip.

If you know how to do it or know anywhere that shows it that would be very helpful.

BTW, you can just put a password on you zip file and its pretty secure, I haven''t been able to crack a zip pass yet.



"With my feet upon the ground I lose myself between the sounds and open wide to suck it in, I feel it move across my skin. I''m reaching up and reaching out. I''m reaching for the random or what ever will bewilder me, what ever will bewilder me. And following our will and wind we may just go where no one''s been. We''ll ride the spiral to the end and may just go where no one''s been." - Maynard James Keenan
[TheBlackJester ]
[Wildfire Studios ]

Share this post


Link to post
Share on other sites
hiya blackjester, look up Zlib, it''ll help you uncompress and load the files within a zip file. it''s freeware.


Share this post


Link to post
Share on other sites
If the actual file data is not encrypted, then smart people will always be able to get the files out.

When you password a zip file, it actually encrypts the file, so yes you can open it with winzip, but until you give the right password you wont have access to it.

It depends what depths you want to go to. If you simply dont want your datafiles lying around, then a simple quake1 stype pak method is fine. If you want your data completly secure, then use a more advanced method with encryption/compression.

Also remember that there is no real way to keep 2d images secure, since they can easily be stolen by taking screenshots etc. Same goes for sound, using the right software, it can be stolen. However, 3d models and maps can be hidden in this way to prevent people from ''extracting'' them from your game.

When using some kind of pack file method, your aim is to extract the files to memory, not to another physical file, then read that bit of memory into your data structure in the same way as if you were reading from the file, but rather than using fread(), fseek() etc, use pointer arithmetic to navigate through that section of memory.

Share this post


Link to post
Share on other sites
If you''d like to leave each file alone, and just encrypt them, add magic numbers :-P

change the extention, and then add some magic number to the beginning of the file to fool paint programs that try to detect graphic files...

its cheap and easy...


Share this post


Link to post
Share on other sites
Rethink why you need to encrypt your data. Having a Quake style wad/pak file is good for file distribution (compression, keeps directories clean), but its not meant to actually hide the data. id uses standard file formats -- zip, jpeg, wav, tga, for this type of data. Most other big games do too (Tribes 2 uses PNG, etc).

The likelyhood of anyone stealing your data is slim to none, so why make your life a hassle by using some obscure encryption method? Especially when people who want to steal the data out will be able to anyway, no matter what you do. If your program can read the data, then so can they, with a little bit of reverse engineering.

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!