Making DOOM 3 Mods : Pack Files

Every asset in the game is stored in a pack file for release. The pack files are just normal zip files with the .pk4 extension, which is the same system used in Quake III Arena. This means you can open the pack files in the base folder using a zip program and browse all the assets in the game.

The pack file system offers 3 huge benefits:

  • Compression
    The assets for Doom 3 are 3.6GB uncompressed, and only 1.44GB after being packed up.

  • Checksum
    Multiplayer servers check the signature (checksum) of the pack file on the client machine to ensure all clients are playing with the same versions of all files. This is known as having a pure server.

  • Distribution
    It's a lot easier to distribute a single large file rather than dozens of little files.

During development you don't want to have to re-pack all the files every time you change something, so the game is set up to look for files in the directory to override files in the packs. However, it only does this in single player. If you want to use files from the directory in multiplayer, you need to disable pure (set si_pure 0) before starting the server. This is also true if you want clients to be able to use different files than the server.

A pack file has to have an internal directory structure that mirrors the file system. The easiest way to make sure this happens (using winzip) is to select the files and folders in your mod directory and choose 'Add to <modname>.zip' You can then rename it to <something>.pk4

The game dll (gamex86.dll) cannot be in the same pack file as the other assets. It has to be in its own pack file along with a config.conf file. This is to easily support multiple platforms (mac, linux, windows).

Copyright © 2004 id software