Advertisement

PAK file problems

Started by August 03, 2000 09:59 AM
1 comment, last by a38750 24 years, 4 months ago
I''ve got a problem implementing a PAK file type system. Most files in games are loaded with some API function. These all need a filename. Because the file is in an archive, this isn''t possible. I can only think of 2 solutions: 1: Make my own loaders which use the standard I/O routines supported by the archive system. Sounds long and painful. 2: Extract the file to a temporary location, and pass the temporary filename to the loading function. But this''d take quite a while for large files, assuming the disk space exists! And how does the program know when to delete the file without ruining the transparency of the process? ie. instead of just calling, say FIO->GetFilename("\pics\1.bmp") in the place of a filname parameter in a loading function, the program would have to follow with something like FIO->CloseFile("\pics\1.bmp"). It''s all a bit messy. How do programs like quake get round this? Thanks, Frank
Hi!
I assume that you´re talking about a pak file like the one in Q3(which is a zip-file) ´cause the pak files in q1+q2(?) aren´t really packed(zipped),they´re only a collection of files....

Your first idea is the right one....But you won´t have to code a zip-file reader yourself there are ready to use free libraries to access zip files and read single files out of them....Look for a lib called the "zlib"....Sorry I´ve lost the link but you should find it very easily....And another zip-library can be found on flipcode.com in the code of the day archive....

HTH,XBTC!
Advertisement
I hadn't thought of compressing the data, I was thinking more of the quake2 system (don't think it's compressed anyway).

My concern's really with the loading of things like AVIs and pictures. So far, I've used functions such as LoadImage to easily load bitmaps. If I went for this approach, I'd have to make my own loaders for pictures, avis, sounds etc.

But I suppose if I adopted compressed picture formats as well I wouldn't be able to use LoadImage anyway.

How much slower are compressed archives? And if I used image/video compression would there be much need for an overall compression system? It'd be a bit like zipping a jpeg.

Thanks,
Frank





Edited by - frankd on August 3, 2000 11:48:15 AM

This topic is closed to new replies.

Advertisement