# How can I package and read multiple asset files into/from one file?

I want to somehow "pack" (not compress) multiple game files into one bigger file. Something like Valve's .gcf, where reading from the application should be easy; like accessing an ordinary stored file.

I'm aiming for some kind of simple use, something like:

my_asset_file->setAssetFile(ASSET_FOLDER + '/file.ext');
Model *m = new Model();

• Why couldn't you use something like zlib? And why the requirement to not compress? – Tetrad Feb 22 '12 at 1:09
• In many cases running a second compression on already compressed data will actually expand the storage used. But even so, zlib (and variants) as been used quite successfully for this purpose so now I'm curious as to nekome's reason =) – Patrick Hughes Feb 22 '12 at 1:46
• I have done exactly that for my little game engine, I guess I could just share it with you if you wanted, even the whole engine.. – Grimshaw Feb 22 '12 at 2:01
• Well, i wouldn't want to spend processing cycles for decompression while player plays, while engine loads some props. And I did thought about zlib or lzma but wasn't sure how easy would be to use it for this purpose. PhysicsFS seems to be made for this purpose but I'll check it out as well as these other two. Thanks; @DevilWithin thanks, but this PhysicsFS should do the trick. – edin-m Feb 22 '12 at 11:13
• @DevilWithin Would you mind sharing it with the community then? I think it would be more than helpful to all of us. – Sin Jun 16 '13 at 16:57