This article's documentation is for the "GoldSrc" engine. Click here for more information.
Quake1-16px.png
Quake2-16px.png

PAK

From Valve Developer Community
Jump to: navigation, search
English (en)Translate (Translate)

Stub

This article or section is a stub. You can help by adding to it.

Icon-broom.png
This article or section needs to be cleaned up to conform to a higher standard of quality.
For help, see the VDC Editing Help and Wikipedia cleanup process. Also, remember to check for any notes left by the tagger at this article's talk page.

PAK file formats are package formats previously used by GoldSrc GoldSrc engine games to store content. It was first introduced in Quake Quake engine which GoldSrc subsequently adopted it. Unlike Quake, GoldSrc prioritizes loose files over those found in a PAK.

This was changed during the WON/Retail to Steam transition in 2003, when the game files were stored inside GCF files located in 🖿...\Steam\steamapps\username\ folder. Since the 2013 SteamPipe update, the game file have been stored directly to the filesystem (example: 🖿...\SteamApps\common\Half-Life\valve), as opposed to Source and Source 2 engines (which continued to packing game files inside multiple VPK files after SteamPipe transition) as most modern systems are fast enough to load GoldSrc game files quickly.

As of today, the Steam version of Half-Life, along with other GoldSrc games are still able to load the 🖿.pak file despite longer being used to store vanilla game files.

Icon-Important.pngImportant:PAK is often used as a generic file extension in the industry. PAK files used by other software, such as Chromium, Unreal Engine 4+, or CryEngine are completely unrelated to the file format used by GoldSrc GoldSrc and id Tech 2 id Tech 2.
Note.pngNote:MP3 files cannot be packaged in a PAK file.
Confirm:This might also be the case for WebM, and formerly AVI.

Structs

Wikipedia icon C code from 🖿common/qfiles.h in the original Quake II development tools:

#define IDPAKHEADER		(('K'<<24)+('C'<<16)+('A'<<8)+'P')

typedef struct
{
	char	name[56];
	int		filepos, filelen;
} dpackfile_t;

typedef struct
{
	int		ident;		// == IDPAKHEADER
	int		dirofs;
	int		dirlen;
} dpackheader_t;

#define	MAX_FILES_IN_PACK	4096
Todo: Explain what the variable names mean, and how the structs are laid out in a PAK
Icon-Important.pngImportant:MAX_FILES_IN_PACK is an engine limit, not a format one. The 2023 Kex remaster of Quake II Quake II exceeds MAX_FILES_IN_PACK, and as such will not load in some tools such as PakScape PakScape.

See also