🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Packed Files

Started by
3 comments, last by GameDev.net 24 years, 7 months ago
Listen, the determined person will be able to change the textures whether you like it or not... your best choice is simply to use/make a packing file format that is easy and does its job. Why do you really care whether the textures are changed or not? Look at games like Quake, Q3A, Half-Life, etc. They all have simple packing formats that people change all the time.

You will never really be able to outsmart the determined person, and if one person can do it, then he/she can write a program to let everyone do it. Same on the issue of encryption, multiplayer cheat protection, serial numbers, etc. Face the facts that protection is trivial on software. The more protection you put on, the more obtrusive it will be on your game players, the more you will encounter problems on every front (programming, debugging, support) and it will only provide you with a day or two more until someone makes their way through it all.

- Splat

Advertisement
ok, that's all good and well, i still don't know how to write it all
Still waiting on some help...
Hello again.

I am still in the process of making a large pack file of all my data (3d objects, sounds, textures) The problem is the textures right now. I want to be able to load a bitmap and write it to the pack file, compressed and all that. However, now that i think about it, i don't just want to write a bitmap, because then people could change the textures of my game rather easily. So I need to know how to do the following: read the information of a bitmap and write it in a way so that it can be read again but not directly as a bmp.

Hi, I just got done with a small packer that I use for my sprites.. it's very simple, and it doesnt have any compression at the moment, the way it works is that I put every sprite in a file called say "sprite001.bmp", then I tell it how many sprites Im gonna have, so it'll iterate from file "sprite001.bmp" to "spriteNNN.bmp", this is what I did:

first I had a Header for the Sprite File something that looks like this:

typedef struct
{
int TotalSprites; // number of sprites in this file
int Width;
int Height;
} SpriteHeader;

Then I opened "sprite001.bmp", I took the Width and Height from the Bitmap Info Header and put them into that structure (the TotalSprites was passed as a parameter on the function) then I wrote the Header into the custom file.

and then I loaded the actual bitmap into a temporary buffer (sprite001.bmp), then I just wrote that into the custom file.

Then I made a loop that would iterate from file sprite001.bmp to spriteNNN.bmp

Notes:

- The file header is only written once, all the images are written to the file continously.
- With this method all the sprites (or textures) have to be the same width and height)

Another nice thing that came thru this method is that even tho it has no compression, the packed file ended up being 33% smaller than all the single .bmp files.

If you need more info or something eMail me at visual@guate.net and I'll gladly help you out.

Good Luck!

------------------
Luis Sempe
visuallr@netscape.net
http://www.geocities.com/SiliconValley/6276

This topic is closed to new replies.

Advertisement