Team Fortress Classic | Modding | PAK Files and Hierarchy

PAK Files and Hierarchy
|RES|Dragline

Programs you will need:
QPed

Half-Life uses an archiving system that began with the Quake games to store the extremely large number of sprite, sound, and model files that are used in the game. These files are contained in .pak files, which are stored in the Valve directory and mod directories. The file pak0.pak in the valve directory holds the orginal sprites, sounds, etc. for Half-Life. These files are essentially used as defaults for the game, and also for other mods built to work on the Half-Life engine. A mod such as TF also has a pak0.pak located in the mod's base folder (tfc in this case). If you open up a .pak file with a utility such as PakExplorer or QPed, you will notice that the archive is arranged with directories that mirror the directory of the mod. There are sprite, sound, and model folders within the .pak file, just as there are sprite, sound, and model folders in the mod folder.

So how does the game decide what file to use for a particular sprite or sound? The breakdown is as follows:

First Choice: Actual mod directory folder. We'll take the HUD as an example. The HUD sprite is 640hud7.spr, and it is originally found only in the pak0.pak in the valve folder. However, if you made a custom HUD (See here) and placed a new file named 640hud7.spr in Half-Life/tfc/sprites, the game will use that file to create the HUD when you're playing.

Second Choice: Highest numbered .pak file in the mod directory. It is possible to edit and create .pak files with a utility such as Qped. The files must be numbered sequentially in order to work correctly (you must have a pak1.pak if you expect to also use a pak2.pak, etc.). So let's say you made a new pak1.pak with a sprites folder in the tfc directory and placed your new HUD sprite in it. That sprite would be used as long as there was no HUD sprite in Half-Life/tfc/sprites. FYI, you could have a completely different 640hud7.spr in your .pak file and in you tfc/sprites folder and you won't get any errors. The game will simply use the sprite from tfc/sprites. If you don't have a HUD sprite in pak1.pak, then the game will look in pak0.pak and use a sprite from there if one exists.

Third choice: Highest numbered .pak file in the Half-Life/valve directory. Remember that the original 640hud7.spr was found in pak0.pak in the valve folder? The game will look in the Half-Life/valve folder and its .pak files as a final resort to find files that haven't been changed for a particular mod.

.pak files can be extremely helpful for customizing the game. Say you wanted to share your custom titles.txt, crosshairs, and HUD with some friends. You can use Qped to build a new .pak file and load all your new files into it. Start up Qped and you will have a new .pak archive. You need to create directories that mimic the game, as mentioned above. So here we will create a new directory and rename it "sprites":



Next we add the necessary files. I find it easiest to simply drag and drop in Windows Explorer, which works like a charm. For this example I added titles.txt and fonts.wad to the root folder. Then I added the HUD, crosshair, and other sprite file to the sprites directory:

Click for full image.


Finally I save the file as pak1.pak in Sierra\Half-Life\tfc. Anyone who receives it will only have to place this one file in their tfc folder to get a bunch of new junk, and to get rid of it if they decide to they can just delete the .pak.

Download the .pak from this tutorial here.

Back: Team Fortress Classic: Modding


IGN.com | GameSpy | Comrade | Arena | FilePlanet | GameSpy Technology
TeamXbox | Planets | Vaults | VE3D | CheatsCodesGuides | GameStats | GamerMetrics
AskMen.com | Rotten Tomatoes | Direct2Drive | Green Pixels
By continuing past this page, and by your continued use of this site, you agree to be bound by and abide by the User Agreement.
Copyright 1996-2009, IGN Entertainment, Inc.   About Us | Support | Advertise | Privacy Policy | User Agreement Subscribe to RSS Feeds RSS Feeds
IGN's enterprise databases running Oracle, SQL and MySQL are professionally monitored and managed by Pythian Remote DBA.