How to protect binaries (object, trextures..)

For the most cases it should be enough to use 'native' formats like .jme for models, compressed texture formats and raw audio formats. Additionally you can change the file extensions. Few people will bother to find out the format and convert it to something usable for them - just to use your assets illegally…

Do a research on Vista's Protected Media Path, they have done phenomenal job trying to achieve this.

There's no use in doing this. Even if you use the most advanced protection schemes, people can record a sound if it's played on their speakers, and they can capture the models by grabbing the data from opengl. Like irrisor said, if the assets are copyrighted, nobody sane will try to take them…

If you would like to add at least a little protection to the jars themselves, Java supports gZip natively :).  I believe you could password protect a gzip archive inside a jar (hint, hint) however, as was stated earlier where there’s a will there’s a way.

(MS proprietary security?!?! this isn’t DotNet  :stuck_out_tongue: )


The loading functions take a stream. You can create a stream adapter that decrypts the data based on a hard-coded key in your application. Make the data-builder use the same kind of stream adapter to encrypt the data when being written. This gives you all the protection you can hope for.

As irrisor said, a determined attacker will know how to steal the data anyway, because the data MUST be visible to the end user. However, most AAA games companies (games like Crysis, World of Warcraft, etc) don't actually encrypt their assets, and they seem to be doing just fine anyway.

you should answer these questions first:

who could steal your models, sounds, music and textures?

why would they do it?

anyway, the best protection might be to use your own format and never write any documentation for it :slight_smile:

the best protection might be to use your own format and never write any documentation for it

That's actualy the worst protection.. it is much better to use tested encryption algorithms than wasting time developing own format for each asset type.

Think HamsterofDeath means a model (etc.) format.

But your response still hold Momoko_Fan,  there is no point in re-inventing the wheel simply for the sake of re-invention.

I just wrote a few classes that encrypt the files for loading.  Behind the scenes they are just normal .png .jpg .ogg etc, however it would be a pita to decrypt them.

Thank You all, i'll take a look into it, especially into stream adapter with hard-coded key.

Yes, You right jwatte, but my datas are not copyright protected and i can image this situation when some of objects may be sold in the net by some people…

my datas are not copyright protected and i can image this situation when some of objects may be sold in the net by some people

If you created your data, then it is, by default, copyright protected. Only if the creator of the data has put the data in the public domain, or if the data was created a very long time ago, will the copyright not hold.

If you got the data from somewhere else, then why would you worry about protection? Anyone could presumably get the data from the same place.

If you created the data, then it is copyright protected, and you don't necessarily need to do anything in code. If you look at the number of sites that sell data on the 'net, there really aren't that many, and they all sell source art (Max files, etc) which you can't get from a .jme file. All of those sites sell originally created art.

Finally, even if you encrypt the streams, the key lives in the program itself, and thus anyone who knows how to disassemble a jar will be able to extract the key and decrypt the data anyway. You can't protect a client against a determined attacker, because the client is under full control of that attacker.

So, I wouldn't worry about encryption. However, if it makes you sleep better, then add a layer of encryption on the input/output stream. That's pretty easy, and gives you as much protection as anything else.

Those are the words I was searching for also :slight_smile:

<compulsion>Information should be free!</compulsion>

Sorry, had to say it! 

IMO the binaries should be protected for professionalism.  If they are in .obj and .jpg format anyone can swap them out for their own models unless you start checking hashes on all assets.  I think that even if you provide alternate links to download the files, a game just feels unfinished if people can walk around through all the art assets.

on the other hand, not even valve protects its resources.


If I may say something without offending anyone, (that is not my intention) professionalism does not equal profit, security nor punishment… People would benefit enormously if they could obtain resources for a game they have purchased, and then use them to create another game with them (for PERSONAL use only, in the spirit of learning game programming, without requiring an army of modelers/animators/musicians/etc). Very didactic if you ask me.

Not to mention the potential for high customization of games, being able to add your own resources to it (favorite models/characters, songs, etc). Or rewriting story, dialogs, etc.

Yes, "modding" is very popular nowadays, many people buy a game just so that the can mod it.