VDFS / VDF / MOD
The Virtual Disk File System (VDFS) is the file system used by the ZenGin (the engine behind Gothic 1/2) to distribute and store game assets. Files using this system typically have the .vdf or .mod extension.
Overview
VDFS is a container format for a file/directory structure, conceptually similar to a .tar or .zip file, but without compression (in its standard form) and optimized for the engine's usage. It allows the engine to access thousands of individual assets (textures, models, scripts) from a single large file, which is more efficient for the operating system and the game.
VDF vs MOD
While both use the same internal format, they are treated differently by the engine:
-
VDF (
.vdf):- Stored in the
Data/directory. - Loaded automatically by the engine on startup.
- Load order is determined by the timestamp inside the file (files with newer timestamps override older ones).
- Used for the main game assets.
- Stored in the
-
MOD (
.mod):- Stored in the
Data/ModVDF/directory. - Loaded only if specified in the
.inifile configuration for the mod. - Used for modifications to separate their assets from the base game.
- Stored in the
Format Description
The VDF format consists of a Header, a Catalog, and the Data section.
For a detailed technical specification, check the ZenKit documentation.
Header
The header describes the VDF file's global properties. Key fields include:
- Signature: Identifies the game version (
PSVDSC_V2.00\r\n\r\nfor Gothic 1,PSVDSC_V2.00\n\r\n\rfor Gothic 2). - Timestamp: A DOS-format date identifying when the archive was created. This is crucial for load order.
- Entry/File Counts: Number of entries and files in the archive.
- Catalog Offset: Where the file catalog begins (almost always
296bytes). - Version: Format version (typically
0x50for VDFS).
Catalog
The catalog is a hierarchical list of all files and directories within the VDF. Each entry contains:
- Name: Filename (up to 64 chars).
- Offset: Position of the file data in the archive.
- Size: Size of the file in bytes.
- Type: Whether it is a file or a directory.
- Attributes: Metadata flags.
Data
The actual raw data of the files contained in the archive, stored contiguously as pointed to by the catalog offsets.
Tools
Visual viewing and editing of VDF/MOD files can be done with various community tools:
- GothicVDFS: The classic, most popular tool. Allows viewing, extracting, and building volumes.
- VDFS Tool: A newer tool supporting Union features and compression.