Sign in to follow this  
sckoobs

zlib Compress multiple files into one

Recommended Posts

I'm looking into using zlib to compress all of my game data files. I've seen some of the examples of zlib and read pieces of the manual and it all looks pretty straight forward. I'm looking to use zlib for a slightly different purpose however, rather than compress multiple files into multiple files I want to compress multiple files into one file (similar to common zip utility compression archives I'd imagine) and be able to open that file in the initialisation of my program and be able to read each of the compressed files back into memory for normal use. The problem that I see arising is that I'll have my compressed file containing all of the other files, but how do I distinguish between the files in code when I'm loading them from the compressed file? I had thought of making my own headers that I'll write into the compressed file, but I get the feeling that zlib might already take care of this for me? As my knowledge of zlib is very limited (considering I've only just started looking at it) I was wondering how this might be achieved and if anyone knows of any tutorials/examples that specifically deal with this scenario, as all the examples I've seen so far seem to compress only one file into another. Cheers, Andy.

Share this post


Link to post
Share on other sites
Hey bud,

There is this article here on gamedev that shows you how to use the PAK file format. I believe this packing format was used in Quake and other games of that genre. Though i believe that now CAB is the preferred format.

Hope that helps,

Dave

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this