Difference between revisions of "VPK"

From Valve Developer Community
Jump to: navigation, search
(Multi-chunk files: Added relative path example)
Line 29: Line 29:
 
A multi-chunk VPK requires a list of the files to be packed:
 
A multi-chunk VPK requires a list of the files to be packed:
 
* Create the list using Windows console, <code>dir /s /b *.<file format> >> <text file name></code>. ''For example, dir /s /b *.vmt >> responsefile''. Repeat this (manually or with a script) until every file format to be packed is added to the list.
 
* Create the list using Windows console, <code>dir /s /b *.<file format> >> <text file name></code>. ''For example, dir /s /b *.vmt >> responsefile''. Repeat this (manually or with a script) until every file format to be packed is added to the list.
* In a text editor, remove any absolute paths making them relative to the game. {{todo|For example...}}
+
* In a text editor, remove any absolute paths making them relative to the game. For example, "C:\Program Files\Steam\steamapps\common\portal 2\portal2\models\props\tripwire_turret.mdl" would become "models\props\tripwire_turret.mdl".
 
* Finally pack the file, <code>vpk -M a pak01 @<text file name></code>. ''For example, vpk -M a pak01 @responsefile''.
 
* Finally pack the file, <code>vpk -M a pak01 @<text file name></code>. ''For example, vpk -M a pak01 @responsefile''.
  

Revision as of 14:56, 23 October 2011

VPK ("Valve Pak") files are uncompressed archives used to package content (never code). They are the successors to GCFs, and when passed to the addoninstaller tool are also used to distribute add-ons like custom campaigns.

VPK tool

VPKs can be created with the command line tool vpk.exe, found at <game>\bin\. It is available in all newer Source engine games since Left 4 Dead.

When you create a VPK, some executable and archive files will be discarded. Files with following extensions are affected: .zip, .reg, .rar, .msi, .exe, .dll, .com, .cmd and .bat.

Commands

<dirname>
Creates a new VPK in the directory given, containing the contents of that directory. Must be an existing location. Alternatively, drag a folder onto the tool in Explorer to trigger this command.
Bug.png Bug: If the location is outside the game's folder, the file will just be called ".vpk".
x <vpkfile> <filename1> <filename2> ...
Extract file(s).
a <vpkfile> <filename1> <filename2> ...
Add file(s).
a <vpkfile> @<filename>
k vpkfile <filename>
Add files listed in a response file ('a' - note the @) or a keyvalues file ('k').
Bug.png Bug: They will appear inside the VPK with their full path (C:\etc\) intact - is there a way to avoid this?
l <vpkfile>
L <vpkfile>
List contents of VPK. Uppercase 'L' means more detail.
-v
Verbose output.
-M
Produce a multi-chunk VPK that is split across several files and has an index. To inspect a multi-chunk VPK look at the '_dir' file.

Multi-chunk files

A multi-chunk VPK requires a list of the files to be packed:

  • Create the list using Windows console, dir /s /b *.<file format> >> <text file name>. For example, dir /s /b *.vmt >> responsefile. Repeat this (manually or with a script) until every file format to be packed is added to the list.
  • In a text editor, remove any absolute paths making them relative to the game. For example, "C:\Program Files\Steam\steamapps\common\portal 2\portal2\models\props\tripwire_turret.mdl" would become "models\props\tripwire_turret.mdl".
  • Finally pack the file, vpk -M a pak01 @<text file name>. For example, vpk -M a pak01 @responsefile.

See also