HIT Forums

Developers Discussion => General Chat => Topic started by: waqwarrior on April 12, 2010, 02:04:08 AM

Title: PAK files
Post by: waqwarrior on April 12, 2010, 02:04:08 AM
In Half-Life, the pak0.pak file contains all the models, etc...everything for half-life. The HD pack added pak1 and pak2 files (iirc), so does that mean...if I made a pak3 and put models in it, that's where Half-Life & co will draw their models from?
Do paks work with Steam or no?
Title: Re: PAK files
Post by: Ambient.Impact on April 12, 2010, 04:09:28 AM
You've just about figured it out. Files are loaded from the sequentially highest PAK file the engine can find in the particular mod directory. This means that if you have a "models\hgrunt.mdl" in pak0.pak and one in pak1.pak, it'll load the one from pak1.pak. However, if you're missing a numbered PAK, anything after that won't be found by the engine. That means that if you have a pak0.pak, a pak1.pak, and a pak3.pak, it'll only load from pak0 and pak1, even if there's a matching file in pak3. It's as if the latter doesn't exist. And yes, PAK files work on Steam. Unfortunately, there's one caveat: they used to work in "half-life\valve", but some security update removed that for some reason, a couple of years ago. Now they only work in mod directories, like "half-life\bshift_unlocked". Another note: you can only have 10 PAK files in one mod directory, as far as I can tell. This is because they only use a single digit for numbering (0-9). And lastly, any file present out in the filesystem is loaded instead of the same file in a PAK file. Here are the order of the paths that the engine tries to load a file from, using "models\hgrunt.mdl" as an example, on Steam:


On the WON version, it looked like this:

Title: Re: PAK files
Post by: waqwarrior on April 12, 2010, 04:24:22 AM
Aye, thanks, Imma make a custom PAK so testing new things is more effiecient.. everyday I learn something new about Goldsource :D
Title: Re: PAK files
Post by: Ambient.Impact on April 12, 2010, 05:28:03 AM
The old girl has a little bit of life left in her.

I forgot to mention one thing: there are a number of files that will, maybe surprisingly, be loaded properly from a PAK file, such as custom menu themes and backgrounds (http://hl-improvement.com/news/2010/03/19/ive-experiments-to-run-there-is-research-to-be-done/). However, anything that has to be specifically loaded by Steam, such as the game icon, cannot be placed in a PAK file.