HIT Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: PAK files  (Read 4099 times)

0 Members and 1 Guest are viewing this topic.

waqwarrior

  • prettier than the average
  • Gargantua
  • *******
  • Offline Offline
  • Posts: 872
    • View Profile
PAK files
« 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?
Logged

Ambient.Impact

  • Administrator
  • Vortigaunt
  • *******
  • Offline Offline
  • Posts: 198
    • View Profile
    • Ambient.Impact.Design
Re: PAK files
« Reply #1 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:

  • half-life\<mod>\models\hgrunt.mdl
  • half-life\<mod>\pak9.pak -> models\hgrunt.mdl
  • ...
  • half-life\<mod>\pak0.pak -> models\hgrunt.mdl
  • half-life\valve\models\hgrunt.mdl
  • half-life.gcf -> valve\models\hgrunt.mdl

On the WON version, it looked like this:

  • half-life\<mod>\models\hgrunt.mdl
  • half-life\<mod>\pak9.pak -> models\hgrunt.mdl
  • ...
  • half-life\<mod>\pak0.pak -> models\hgrunt.mdl
  • half-life\valve\models\hgrunt.mdl
  • half-life\valve\pak9.pak -> models\hgrunt.mdl
  • ...
  • half-life\valve\pak0.pak -> models\hgrunt.mdl
Logged

waqwarrior

  • prettier than the average
  • Gargantua
  • *******
  • Offline Offline
  • Posts: 872
    • View Profile
Re: PAK files
« Reply #2 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
Logged

Ambient.Impact

  • Administrator
  • Vortigaunt
  • *******
  • Offline Offline
  • Posts: 198
    • View Profile
    • Ambient.Impact.Design
Re: PAK files
« Reply #3 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. However, anything that has to be specifically loaded by Steam, such as the game icon, cannot be placed in a PAK file.
Logged