Skip to main content

Documentation 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.

The TF2 source code archive (leaked April 22, 2020) contains the full server and client source for Team Fortress 2 as it existed at that point in time. This documentation helps you navigate the codebase — understanding how gameplay systems, the Source Engine, AI bots, weapons, networking, and the material pipeline all fit together.
This source code was leaked without authorization. It is published here for educational and historical reference only. Review your local laws before using or distributing this code. Valve owns all intellectual property in this codebase.

What’s in the codebase

The repository is organized under tf2_src/ and covers every layer of the game — from the engine tier libraries up through TF2-specific gameplay code.

Codebase structure

Directory layout: engine, game, public headers, tier libraries, and tools

Building the code

VPC project scripts, platform targets, and compiler requirements

Source Engine overview

How the engine tiers, module boundaries, and DLL interfaces work

Client/server model

Tick loop, entity replication, and the DT send/recv table system

Gameplay systems

Player classes

All 9 TF2 classes: stats, class info parsing, and CTFPlayer

Weapons

Weapon inheritance hierarchy, firing logic, and all weapon types

Game modes

CTF, CP, Payload, MvM, PassTime, and round-based game rules

Buildable objects

Sentry Gun, Dispenser, and Teleporter — construction and upgrades

Engine systems

AI & bots

Source Engine AI base classes and the TF-specific NextBot system

Rendering

Render pipeline: BSP, models, lighting, shadows, and post-process

Physics

VPhysics: collision, constraints, ragdolls, and vehicle simulation

Items & economy

Item schema, inventory, wearables, and the GC item system

Build docs developers (and LLMs) love