TF2’s achievement system is client-side and event-driven. Each achievement is a C++ class inheriting fromDocumentation 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.
CBaseAchievement (or the TF2-specific CBaseTFAchievement). Achievements listen to game events, track progress counters, and call AwardAchievement() when their unlock conditions are met. Completion is persisted via the Steam Stats and Achievements API.
Base achievement classes
Achievement file organization
Achievements are split by class into separate.cpp files under game/shared/tf/:
| File | Content |
|---|---|
achievements_tf_scout.cpp | Scout achievements (Bonk! etc.) |
achievements_tf_soldier.cpp | Soldier achievements |
achievements_tf_pyro.cpp | Pyro achievements |
achievements_tf_demoman.cpp | Demoman achievements |
achievements_tf_heavy.cpp | Heavy achievements |
achievements_tf_engineer.cpp | Engineer achievements |
achievements_tf_medic.cpp | Medic achievements |
achievements_tf_sniper.cpp | Sniper achievements |
achievements_tf_spy.cpp | Spy achievements |
achievements_tf_halloween.cpp | Halloween event achievements |
achievements_tf_mvm.cpp | Mann vs. Machine achievements |
achievements_tf_maps.cpp | Map-specific achievements |
achievements_tf_replay.cpp | Replay system achievements |
Event-driven tracking
Achievements subscribe to game events viaListenForEvents() and implement FireGameEvent(). Progress is tracked with IncrementCount() or SetCount().
Steam stat synchronization
CAchievementMgr (game/shared/achievementmgr.cpp) manages the full lifecycle. On map load it pulls stats from Steam; on achievement unlock it calls ISteamUserStats::SetAchievement() and schedules a StoreStats() call. Progress counters map to Steam stat names defined in the app’s Steamworks configuration.