Make PAK, PK3 & PK4 (PK*) File
When making content for games it’s typical that at some point that material needs to be ‘packed’ in some way. Usually this means using some form of ‘zip’ archive file; id technology for example uses "*.pak", "*.pk3", "*.pk4" etc. They are basically standard ZIP or RAR archive that uses the particular file extension for the game being edited – "*.pk3" for Quake 3 editing’.
The following tutorial explains the simple process of making a ‘pack’ file into which custom content can be placed and used in games. N.B. the following is carried out on a Windows based PC environment so certain actions may differ on later or different OS versions.
PK3/PK4 File Association
Before being able to make a ‘PK’ file, the format needs to be associated with the operating system running on your computer. For Windows OS this usually means simply RMB clicking on any available PK3 file (usually available in the installation directory of a game) and selecting "Open with…". In the dialogue box that appears browse to the location of the "WinZip" or "WinRAR" executable and select the application of choice to open these files by default; this will mean double-clicking a file will automatically open in the file archive program.
How Do I Make A PK3/PK4 File?
There are a couple of ways to create PK3 or PAK files for games using id software technology, including the recently released Doom 3. The two main ways are to either pack up the contents of a folder or pack folders sitting on the root drive letter. Each works just as well as the other but are the result of different working methods when you create the assets. The most common of the two is to pack up the contents of a folder so that will be explained below.
Packing The Contents Of A Folder
Typically this means a folder structure within a directory similar to the following;
- ..\working directory
- \main
- \maps
- \models
- \subfolder
- \subfolder
- \scripts
- \textures
- \subfolder
- \subfolder
- \ui
- \etc..
- \main
When you open Windows Explorer it’ll be split into two parts; the main ‘contents’ window on the right with a thin ‘navigation’ panel on the left. Using the method above means selecting the parent folder in the panel on left hand side – this would be ‘baseq3‘ if you were packing up the files for a Quake 3 project. On selecting the parent folder on the left, the ‘content’ panel on the right will then show the directory structure of that folder, listing further sub-folder’s and files.
-
Select the folders; maps, models etc.
Selecting the files to pack
-
Right click one of the selected folders and the select ‘add to zip’.
Right click, "add to zip file"
- This will open a dialogue with a file path and some text already highlighted in the top text box; most likely showing the name of the folder you right clicked on, in the example below it shows the ‘scripts’ folder as the last entry.
- Left click at the end of that box and change that last entry (highlight below) to what ever you want to call the PK3 file and then add the ‘.PK3’ (a ‘full stop’ [punctuation] ‘P’, ‘K’, and ‘3’) extension.
- There’s also a check box near the bottom of this dialogue box; ‘Save full path info’, make sure that is unchecked (the box is empty).
Changing the name and location
-
Press the add button and you’ll see WinZip (or similar) add the files to the newly created zip file and drop that into the main folder. If you open the file it’ll show the contents with file paths relative to the parent directory, ‘main’ in this case.
Files added to zip
Final destination of PK’X’ file
- You may find after doing this you have ‘junk’ files included in the PK3, if that’s the case just select and delete them from the file.
- For distribution make sure you put the PK3 inside a ZIP file by going through the same process above but adding .ZIP at the end of the file path.
Conclusion
Although the above discusses the creation of ‘pak’ files relative to idtech game technology, the archiving system is not necessarily exclusive to that environment; because the files are essentially nothing more than a compressed ‘archive’, so long as the appropriate ‘libraries’ are in place, the format and material can be used in any game or environment that needs to contain files to reduce a projects footprint. The upshot of this means that the principle of creating the file will be exactly the same, the only difference being the locations used for ‘pathing’ – folder and/or directory structures.