File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Game Development and the fly likes Graphics/Sprites Protection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Game Development
Bookmark "Graphics/Sprites Protection" Watch "Graphics/Sprites Protection" New topic

Graphics/Sprites Protection

S Chan
Ranch Hand

Joined: Jul 25, 2011
Posts: 51
I have some graphics which are to be used for my game's sprites. I have shredded months of blood and sweat to produce them.

I'd like to distribute my game freely so that anyone can download it, play it and even look at the source code , but, on the other hand, I do not wish people stealing the graphics and claim they created/own them.

At the moment, I have the graphics saved into GIFs, JPEGs or PNGs formats and stored into a folder. The game, packaged in executable jar, access the image files within the jar.

I was wondering if I can some how save the graphics into other formats or use some other methods to store the graphics, so that people cannot just rip all the graphics out easily simply by unjar-ing the jar file. However, I still want the game to be able to load up the graphics with a reasonable speed.

I know I can't completely make the graphics safe from ripping, e.g. they can take screen dumps of the in-game graphics, but I just hope the graphics are not "so exposed" to the users so they can just rip it out without much effort or easily with an automatic process.

I thought about using Java code to generate some of the graphics at run time but I think that will hurt the game performance in large degree.

Anyone has any thoughts?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10836

One way of doing it.

In pseudo code:
Convert the image to a byte array (using ImageIO and ByteArrayOutputStream and BufferedImage)
Convert the byte array to a String.
Print the string to your console.
Take this string and define it as a constant in your code
When the image needs to be retrieved, String->byte array->Image

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
I agree. Here's the link:
subject: Graphics/Sprites Protection
jQuery in Action, 3rd edition