Jump to content
  • Advertisement


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


Graphics Libraries

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

Hi, I have read a lot of the wnderful tutorials here at game dev and although i have searched i cant find the relivant info im after. the situation is this. I read the map tiling resources and they all tlak about putting the tiles in a bmp, how ever when the game is finished alll nthe graphics are easily alterable and available to others. so i want to be able to make graphic libraires so they are stored tograther in a costom format eg: tiles.bmp would become tiles.drg objects.bmp would become objects.drg npc.bmp would be npc.drg my maps would have a drm extension Basically i want to store my graphics in some sort of library like the comercial games Legend of Mir springs to mind so that i can easily update them and prevent unautorised access to them. I would appreciate any pointers towards turorials or relivant items ect. Regards Darkrealm

Share this post

Link to post
Share on other sites
I''m not sure I can point you toward any tutorials on creating your own file types like that... Probably because most of the people who bother to create their own type don''t want to explain how to open them to other people.

I can, however, suggest what you should be thinking of when you try to create your own. First, just decide how you want to store all the image data. Say you know you''re going to be working only with 8 bit color images, you could make the first 256 sets of numbers store the palette, and then maybe have two integers that store the dimensions of the image, and from then on every byte is simply the color of each pixel.

In code, you could save them something like this:

int loop;
FILE *newfile = fopen("newimage.whatever","wb");

for (loop = 0; loop < 256; loop++){
_putw(palette_color[loop], newfile);

_putw(image_height, newfile);
_putw(image_width, newfile);

for (loop = 0; loop < image_height*image_width){
putc(image_data[loop], newfile);

You can easily read that in backwards, and use the data accordingly. Basically, all I can say is take a look around Wotsit and see how images are normally stored. Then decide how you can twist that around yourself, and go with whatever conclusion you reach.

-Arek the Absolute

Share this post

Link to post
Share on other sites
There isn''t a way to really protect your data, but there are ways to prevent easy tampering...

1. If you just want to avoid easy alteration, you could use zlib.

Just zlib everything into a single large file, then load your images through zlib. It''ll make everything smaller too.

2. You can also add extra characters to the beginning of files, to fool paint programs.

3. Or you can seperate the header from the body of your image files. Make them two files, and then store the header information as a resource. Then use UPX to ''encrypt'' the headers.

4. CNC your files, store the CNC results in a file in your resources. Then on load, do a CNC on each image. If an image does not have the correct CNC, do not load it.

5. A combo of two or more of the above.

I''m doing #1 & #4 on my personal game. Whenever verson 2.1 comes out, that will be its one major feature.

SNOBOL-If you succeed, shoot yourself in the left foot. If you fail, shoot yourself in the right foot.
Download and play Slime King I.

Share this post

Link to post
Share on other sites
You could also strip out the header data and make your program load only one type of bitmap that uses the same header that your program is made to use. The just save the raw data in your file. You could additionally alter the order of the pixels. ie, go up and down the screen instead of accross, etc...

It is really just up to your imagination.

First make it work,
then make it fast.

--Brian Kernighan

"I’m happy to share what I can, because I’m in it for the love of programming. The Ferraris are just gravy, honest!" --John Carmack: Forward to Graphics Programming Black Book

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
most end users wont even realize its a pic if u rename the extension cause it wont open by double clicking on it

Share this post

Link to post
Share on other sites
Thank you all very much. I am so surprised i have got this many replies this fast, my faith in humanity is restored.

the information you have given has been a godsend, now i just need to do some morre research. thanks again.


I''''ll get there......... Eventually

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!