Before you can compile anything, you need to understand VPC — Valve’s Project Creator. VPC readsDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/sr2echa/TF2-Source-Code/llms.txt
Use this file to discover all available pages before exploring further.
.vpc script files scattered across the source tree and generates native project files for your platform: Visual Studio .sln / .vcxproj on Windows, and Makefile files on Linux. You never edit the generated files directly; you edit the .vpc scripts and regenerate.
What VPC is
VPC (Valve Project Creator) is a purpose-built meta-build tool. It reads.vpc project scripts and .vgc group/configuration files, then emits platform-native build files. A single .vpc file can produce output for Visual Studio on Windows and GNU Make on Linux from the same source description.
You run VPC from the tf2_src/ directory using the binary at devtools/bin/vpc.exe:
| Flag | Meaning |
|---|---|
/2013 | Target Visual Studio 2013 (v120 toolset) |
+everything | Include every project defined in groups.vgc |
+game | Include only the runtime game group (client, server, engine, etc.) |
+dedicated | Include the dedicated server group |
/mksln <name> | Emit a .sln wrapping all generated .vcxproj files |
@all_64 | Also generate 64-bit targets where applicable |
The createallprojects.bat entry point
The root of tf2_src/ contains a one-liner batch file that generates a solution containing every project in the tree:
everything.sln alongside individual .vcxproj files for each project. Open everything.sln in Visual Studio 2013 or later to browse and build the full tree.
Build walkthrough
Install prerequisites
Windows: Install Visual Studio 2013 (or a later version with the v120 toolset). The VPC
/2013 flag targets the v120 platform toolset.Linux: Install the Steam Runtime Scout toolchain. The tarballs are at tools/runtime/linux/steamrt_scout_amd64.tar.xz and steamrt_scout_i386.tar.xz. Extract them and set up your build environment per Valve’s Linux SDK instructions in linux_sdk/.Generate project files
Open a command prompt in VPC reads
tf2_src/ and run:vpc_scripts/groups.vgc to resolve the game group, then reads each project’s .vpc file, applies the base scripts from vpc_scripts/, and emits .vcxproj files next to each source directory.On Linux, omit /mksln and VPC emits Makefile files instead:Open the solution (Windows)
Open
game.sln in Visual Studio. You will see projects grouped by directory. The two most important ones for game-logic work are:- Client (TF) —
game/client/client_tf.vpc - Server (TF) —
game/server/server_tf.vpc
Select a build configuration
Visual Studio exposes two standard configurations:
The per-configuration compiler settings live in the And
| Configuration | Optimisation | Debug info |
|---|---|---|
Debug | None (/Od) | Full PDB, assertions enabled |
Release | Full (/O2) | Minimal PDB |
vpc_scripts/ base scripts. For example, source_dll_win32_debug.vpc sets:source_dll_win32_release.vpc enables optimisation and sets NDEBUG.How individual .vpc files work
Each .vpc file describes one buildable project. The TF game DLLs follow a common pattern: a thin game-specific .vpc that $Includes one or more base scripts, then adds its own source files.
server_tf.vpc
$BASE token in $PreprocessorDefinitions appends to whatever the included base script already defines, rather than replacing it.
client_tf.vpc
[$WORKSHOP_IMPORT_ENABLE] conditional: Steam Workshop item import and the itemtest_lib dependency only build on Windows, gated by the $WINDOWS macro.
Platform differences
- Windows (MSVC)
- Linux (GCC)
- Compiler: MSVC v120 (Visual Studio 2013 toolset)
- Output:
client.dll,server.dll - Base scripts:
source_dll_win32_base.vpc,source_dll_win32_debug.vpc,source_dll_win32_release.vpc - The
[$WINDOWS]conditional in.vpcfiles enables Windows-only code paths (DirectX, WinSock, Steam Workshop import) - Pre-built import libraries live under
lib/public/andlib/common/
The vpc_scripts/ directory
The vpc_scripts/ directory contains base scripts that are $Included by almost every project in the tree. You rarely need to edit these unless you are changing global compiler flags or adding a new dependency across all projects.
Base DLL scripts
Base DLL scripts
| File | Purpose |
|---|---|
source_dll_base.vpc | Common settings for all DLL projects |
source_dll_win32_base.vpc | Windows DLL: entry point, subsystem |
source_dll_win32_debug.vpc | Windows Debug config overrides |
source_dll_win32_release.vpc | Windows Release config overrides |
source_dll_posix_base.vpc | Linux/macOS DLL settings |
source_dll_x360_base.vpc | Xbox 360 DLL settings (legacy) |
Base library and executable scripts
Base library and executable scripts
| File | Purpose |
|---|---|
source_lib_base.vpc | Common static library settings |
source_lib_win32_base.vpc | Windows static library settings |
source_lib_posix_base.vpc | Linux/macOS static library settings |
source_exe_base.vpc | Common executable settings |
source_exe_win_win32_base.vpc | Windows GUI executable settings |
source_exe_con_base.vpc | Console (non-GUI) executable settings |
source_exe_posix_base.vpc | Linux executable settings |
Shared include scripts
Shared include scripts
Group and project registries
Group and project registries
| File | Purpose |
|---|---|
groups.vgc | Defines named groups (game, dedicated, everything, etc.) as lists of project names |
projects.vgc | Maps every project name to the path of its .vpc file |
default.vgc | Default VPC invocation configuration |
Key preprocessor defines
The TF game DLLs use preprocessor defines to gate code that belongs to only one side of the client/server split, or to a specific platform:| Define | Set in | Meaning |
|---|---|---|
TF_DLL | server_tf.vpc | Code is compiling into the server DLL |
TF_CLIENT_DLL | client_tf.vpc | Code is compiling into the client DLL |
GAME_DLL | server_base.vpc | Generic server-side guard (any game) |
CLIENT_DLL | client_base.vpc | Generic client-side guard (any game) |
USES_ECON_ITEMS | client_tf.vpc | Enables the economy / item system |
ENABLE_GC_MATCHMAKING | Both TF VPCs | Enables Game Coordinator matchmaking |
NEXT_BOT | Both TF VPCs | Compiles in the NextBot AI framework |
GLOWS_ENABLE | Both TF VPCs | Enables outline-glow rendering |
WORKSHOP_IMPORT_ENABLED | client_tf.vpc (Windows only) | Enables Steam Workshop item import |
NDEBUG | Release configs | Disables assertions |
#ifdef CLIENT_DLL / #ifndef CLIENT_DLL.