Sign in to follow this  
suliman

How to protect your gamefiles? (sound/images)

Recommended Posts

suliman    1652
Hi Doing an freeware game, but I dont want the user to be able to browse all files such as maps, spritesheets (so they can see all units that is in the game in advance...) and sounds. It totally destroys the suprise and feeling of immersion if you can see all the files... Any easy way to put them into packages or something? I simply want them to be tucked away so the user cannot see them. Just renaming fileextension seems a bit to easy to crack:) I must be able to edit them myself (i guess you make another build that you release...) Any good suggestions? Thanks Erik

Share this post


Link to post
Share on other sites
nullsquared    126
Just ZIP them up and rename the ZIP extension. In the end, all resources can be ripped at runtime when your app opens them, so there's no use in trying to prevent the user from manually accessing them.

Share this post


Link to post
Share on other sites
mattd    1078
It's a popular question. A quick search gives some relevant threads, and a better one would probably find more:

1 2 3

The popular opinion is basically summed up as "do something simple", or even "don't bother".

Share this post


Link to post
Share on other sites
beun    160
Yes, you can put all your files in 1 file. You could use tar or zip, but here is a good library designed for what you want to do. It can read zip files, 7Z files, Quake and Doom packs, etc. So you can simply put all your artwork in a zip-file or 7zip-file and then you can read the files with PhysicsFS. For example, if you have two zip-files: pack1.zip which contains 'data/song.mp3', and pack2.zip which contains 'data/texture.jpg', you can just register the two zip-files so PhysicsFS can read them, and if you need to load data/texture.jpg at some point, PhysicsFS automatically opens pack2.zip and loads that file.

Share this post


Link to post
Share on other sites
MadMax1992    166
Most people don't go searching through your gamefiles to look for anything that has something to do with the plot. Just put them in folders, put the game executable in the 'root' folder, so they will start that up first.

If you really want to:
- pack a couple of files in a single file (home-made, zip file, whatever)
- rename the file extensions so they're not easy to interpret
- create some sort of 'codename' for your files, so, instead of: mission1-killguy.mission, mission1-createbase.mission, mission1-defeatsatan.mission, you could do: mis1-submis1.mission, mis1-submis2.mission, mis1-submis3.mission

Share this post


Link to post
Share on other sites
suliman    1652
Couldnt one just put everything in a zip and use a password for it? Then (i dont know really how but) you could load from your game. That would be sufficant protection for me. Can it be done? And i dont mind if someone CAN code a program to extract data, i just want to make it a little less easy.

Erik

Share this post


Link to post
Share on other sites
Code_Strike    122
No one is going to steal your art.
A lot of older commercial games used to have big folders with all the graphics sitting right there.
After playing literally hundreds of shareware and freeware games in-depth, I've NEVER seen copied graphics at all.

If you're that worried about it though, make them resources inside a dll file.

Share this post


Link to post
Share on other sites
lightbringer    1070
Quote:
Original post by suliman
i just want to make it a little less easy.


Just renaming the file will probably stop 95% of your users from looking at your files. The other 5% won't be stopped even if you stream the content live from your server encrypted with five methods over a secured connection, so you might as well not try. Like 99% of all statistics, these ones were made up on the spot :)

Share this post


Link to post
Share on other sites
suliman    1652
A lot of pople bother to come here and tell me the same thing, just trust me when i say i want to hide it.

1. Would the password-protected zip/rar method work?

2. What do you mean to make the resources into a dll file? How would this work?

Thanks for the help
Erik

Share this post


Link to post
Share on other sites
Telastyn    3777
Quote:
Original post by suliman
A lot of pople bother to come here and tell me the same thing, just trust me when i say i want to hide it.


Why? When you seem not to trust the people here when they say that your time would be better spent making your game better?

Quote:

1. Would the password-protected zip/rar method work?


Define work. Renaming a zip file to .pak or something is enough to deter a good number of the people casually looking for files (which is already a skimpy portion of an average userbase). I imagine the common zip apis will allow passwording, though that in and of itself will deter next to nobody more than just renaming the file.

Nothing you can do can prevent a determined person from writing an app to trivially extract the content you wish to hide. Hell, nothing you're going to be able to do is going to make it beyond trivially difficult for a skilled person from writing an app to trivially extract the content. So in that context of 'work'... no.

Share this post


Link to post
Share on other sites
jackolantern1    158
Just out of curiousity, how does something like DarkBASIC work? When you make a 2D or 3D game in DarkBASIC and compile it, it just creates a self-contained .EXE file. No folders, no assets, no nothing. It is all just somehow a part of the executable.

Share this post


Link to post
Share on other sites
lmelior    325
I've never used such a tool, but I used to see this question and similar ones a great deal back in my PSP programming days. By far the prevailing opinion there was the same as here: it's not going to do much good. But, for educational purposes...

I know there are tools where you can convert an image to a source file, then you load the image from memory instead of a file. A lot of libraries that have image loaders have this capability, as far as I know. Google png2c, bmp2c, tga2c, and so on. I think they basically just read the image and spit out the raw pixel values in a giant C-style array. Then compile and link like any other source code. I imagine it's something like that, anyway.

Share this post


Link to post
Share on other sites
empirical2    567
Quote:
Original post by suliman
A lot of pople bother to come here and tell me the same thing, just trust me when i say i want to hide it.

1. Would the password-protected zip/rar method work?

2. What do you mean to make the resources into a dll file? How would this work?

Thanks for the help
Erik


It depends on the language and method you use to read the data.

If you read the data yourself directly using stream or ReadFile then write yourself a little tool that takes a file and encrypts it in a simple way. All you need is to XOR each byte against a small array of numbers you pick yourself.

Then add a decoder to your game. Since you are using XOR it will be exactly the same code :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this