Skip to content

Windows Build Instructions

Margen67 edited this page Oct 28, 2020 · 34 revisions

DISCLAIMER: If you are not a developer, building the game from source is not what you want. Use the pre-built Releases. Also, building this on Mac/Linux, while possible, is not covered here. Please let us know if you get it to work!

Building

  1. Get Visual Studio 2019 Community Edition for building TF2. The required installation components are:
    • Desktop development with C++
    • C++ MFC for latest v142 build tools (x86 & x64)
  2. Clone this repository.
  3. Run .\download_libs.bat.
  4. Open .\thirdparty\protobuf-2.5.0\vsprojects\libprotobuf.vcxproj.
  5. Build both the Debug and Release configuration.
  6. Run reg add "HKLM\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\10.0\Projects\{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}" /v DefaultProjectExtension /t REG_SZ /d vcproj /f
  7. Set the following environment variables:
    Name Value
    VALVE_NO_AUTO_P4 1
    PreferredToolArchitecture x64
  8. Run .\creategameprojects_dev.bat.
    • For Debug, use .\creategameprojects_debug.bat.
  9. Open .\games.sln.
  10. Select all projects. Go to Properties > C/C++ > Language > C++ Language Standard and set language standard to C++17.
  11. Build the VS project.
  12. The executables are placed at ..\game\hl2.exe for the client, and ..\game\srcds.exe for the server.
    • Note: These paths are outside the repository.

Running and Debugging

  1. For the compiled binaries to run, you will need to copy your current TF2 installation to ..\game (relative to your repository, outside of it).
  2. To setup debugging in Visual Studio:
    1. Select Client (TF) as the startup project, then go to its Properties > Configuration Properties > Debugging. Set the following:
      • Command to $(SolutionDir)..\game\hl2.exe.
      • Command Arguments to -steam -game tf -insecure -novid -nojoy -nosteamcontroller -nohltv -particle_fallback 2 -allowdebug.
      • Working Directory to $(SolutionDir)..\game.
        • *Note: All the paths here are relative to your copy of the repository (same place where games.sln is located).
    2. For server, follow the same procedures, but choose Server (TF) as the startup project, and set the following:
      • Command to $(SolutionDir)..\game\srcds.exe.
      • Command Arguments to -game tf -console -nomaster -insecure +sv_pure 0 +maxplayers 32 +sv_lan 1 -allowdebug.

See the Valve Developer Wiki for another explanation of the last two steps.

Other launch options to consider:

Option Description
-sw Force windowed mode. (Same as -startwindowed, -window, and -windowed)
-border Enable window borders.
-w WIDTH -h HEIGHT Set the resolution. (Same as -width and -height)
+map MAPNAME Automatically launch a map on startup.

Clone this wiki locally