Creating my own graphic file type/extension
When I install games on my computer professional and amateur I find that the resources such as pictures have strange extensions so I cannot open them.
As I cannot find these extensions on Google, I figured it was a method of protecting your artwork so it cannot be stolen so easily.
I have a bunch of JPEG, PNG and bitmap files I would like to do this to so people cannot copy them so easily when I distribute my game.
I use C++ and DirectX if that makes any difference.
Does anyone know how this is done? I know I can change a .txt extension to anything and my program will read it just the same but will this work with pictures?
Usually programs don't care about extensions when reading files, so changing extension to an unknown one shouldn't get you in trouble.
As I cannot find these extensions on google I figured it was a method of protecting your artwork so it cannot be stolen so easily.
Creating your own extension is easy, just decide how you want to interpret your image, and create a converter to build them from existing images...
... But ... formats are chosen for the sake of the programmer and art tools, not for protection. You can't ever really protect your art from being stolen, as at some point your code will have to convert the graphics to a raw DDB (Device Dependent Bitmap) or DIB (Device Independent Bitmap) before rendering them to the screen or sending them to DX/OpenGL. Honestly, commercial games on cartridges that don't follow standard formats are easily ripped. Hackers even make level editors for proprietary game engines that aren't known to the public.
I don't use png's and jpg's in my game code for the simple reason that I was unable to use libpng in my code, nor a jpeg decoder, and I needed my graphics supplied in 8x8 tiles with 4/8-bit with palette (colour 0 is transparent), or 16-bit RGBA_555_1, which can't be achieved with png's and jpeg's.
At most, you can obscure your graphics by storing them in your own format, encrypting them or even compressing them, that's about it. But beware, your code will have to decrypt/decode it and the picture will at some point be in the thief's memory.
So yes, you can easily change the file type, but that will not stop any user from (a) changing the filename, or (b) figuring out the file type by putting it into a program that can easily recognize the file type. And as someone who's also done video editing, I can tell you that many programs will happily interpret any file and figure out the real format. And it won't stop (c), a scrupulous hacker from ripping your artwork. In fact just have a look at what hackers did with Propellerhead's Refill format, since they couldn't figure out how to read it, they created a program that used Propellerhead's program to read it - think about that. It really doesn't take much to use Vanjar Fukar's Debugger to trace your code when loading images, identify your image loading code, and either copy it, or invoke it themselves (amongst a hundred other hacking tactics).