Doom 3 Pak Files

Doom 3 stores its game data in Pak files, which are simply ZIP files with an extension of PK4 instead of ZIP.

Pak files can either store game assets (maps, textures, decl files, models) or gamecode (Windows DLL, Linux SO, Mac DYLIB).

For reference a contents list of all Doom 3 Pak files can be found here. A breakdown of which Decls are in which file is here.

Search Order

The engine will look in up to three folders for Pak files, depending on the values of the fs_game and fs_game_base CVars.

Each of the folders in scanned and a list of the Paks in them is created.

Once the list is created a "Current search path" is set. This is the order in which the engine will look inside Paks for files when they are required.

So, if you start Doom 3 like this "doom3 +set fs_game emz +set fs_game_base d3xp" you get a search path something like this:

\Doom 3\emz\the-emz-d3-131a-windows.pk4 (EMZ Code 1.31a Windows)
\Doom 3\emz\the-emz-d3-131a-mac.pk4 (EMZ Code 1.31a Mac)
\Doom 3\emz\the-emz-d3-131a-linux.pk4 (EMZ Code 1.31a Linux)
\Doom 3\emz\the-emz-d3-131-data.pk4 (EMZ Assets 1.31)
\Doom 3\emz\emz003.pk4 (EMZ Assets 1.21)
\Doom 3\emz\emz002.pk4 (EMZ Assets 1.2)
\Doom 3\emz\emz001.pk4 (EMZ Assets 1.1)
\Doom 3\emz\emz000.pk4 (EMZ Assets 1.0)

\Doom 3\d3xp\pak001.pk4 (RoE Assets 1.3)
\Doom 3\d3xp\pak000.pk4 (RoE Assets 1.2)
\Doom 3\d3xp\game03.pk4 (RoE Code 1.3.1 Windows)
\Doom 3\d3xp\game02.pk4 (RoE Code 1.3.1 Mac)
\Doom 3\d3xp\game01.pk4 (RoE Code 1.3.1 Linux)
\Doom 3\d3xp\game00.pk4 (RoE Code 1.2 Windows)

\Doom 3\base\pak008.pk4 (D3 Assets 1.3.1)
\Doom 3\base\pak007.pk4 (D3 Assets 1.3)
\Doom 3\base\pak006.pk4 (D3 Assets 1.2)
\Doom 3\base\pak005.pk4 (D3 Assets 1.1)
\Doom 3\base\pak004.pk4 (D3 Assets 1.0)
\Doom 3\base\pak003.pk4 (D3 Assets 1.0)
\Doom 3\base\pak002.pk4 (D3 Assets 1.0)
\Doom 3\base\pak001.pk4 (D3 Assets 1.0)
\Doom 3\base\pak000.pk4 (D3 Assets 1.0)
\Doom 3\base\game03.pk4 (D3 Code 1.3.1 Windows)
\Doom 3\base\game02.pk4 (D3 Code 1.3.1 Mac)
\Doom 3\base\game01.pk4 (D3 Code 1.3.1 Linux)
\Doom 3\base\game00.pk4 (D3 Code 1.0 Windows)

When a file is required the Paks are searched in the order above.

Notice that the Paks are ordered in reverse alphabetical order within each folder. This allows files with the same name in a later Pak to replace an existing file from an earlier one.

Loading The Gamecode

Doom 3 is implemented in two parts - the core (rendering engine, network code, etc) and the gamecode (physics, game logic, AI, etc).

The core is DOOM3.EXE (or DOOM3DED.EXE if running a dedicated server) and this is the same whether you're running D3, RoE, EMZ, OpenCoop, LMS, etc.

The gamecode lives in a DLL file called gamex86.dll. Each gameXX.pk4 file contains one DLL (or Linux SO / Mac DYLIB files).

When you run DOOM3.EXE and tell it to load EMZ by using "fs_game emz" it will look down the PK4s in the order above. Because its the Windows version it will  only look at Paks that have gamex86.dll in. The first windows one it finds will be emz\the-emz-d3-131a-windows.pk4 so it extracts the DLL from the Pak into the EMZ folder then loads it from there.

When you run RoE by using "fs_game d3xp" the Paks searched will only be the ones in the d3xp and base folders so it will find and extract the code from d3xp/game03.pk4 into the d3xp folder and load it from there.

When you run vanilla Doom 3 without setting fs_game the Paks searched will only be the ones in the base folder only so it will find and extract the code from base/game03.pk4 into the base folder and load it from there.

In the console you will see something like this when running EMZ 1.31a under Windows:

found DLL in pak file: \Doom 3\emz\the-emz-d3-131a-windows.pk4/gamex86.dll
copy gamex86.dll to \Doom 3\emz\gamex86.dll

This is the reason it is important to keep mod Paks in their own folders. If you put your mod Paks in either the base or d3xp folders they can either overwrite the originals (very bad) or may interfere with the search order (possible side effects).

Custom Maps

These are simply additional Paks that contain the map definitions and any new scripts and textures to support the map.

Almost all custom map Pak files should be placed in the base folder. They will then be available when playing D3, RoE or EMZ.

There are some custom maps that are specifically designed for RoE and need the textures, models etc from it (viavga_dm1xp and CTF maps, as examples). These should go in the d3xp folder.

If you have a custom map Pak loaded on a server all clients connecting to your server will need the same Paks. The 1.3 patch introduced two new features to make this easier to manage - auto download from a server holding the Paks and an extension to the map system that means that players only need to have the currently running maps rather than all of those installed on the server, although this second feature isn't widely used at the moment.

Website design based on Melankolia template by Ercan K.