summaryrefslogtreecommitdiff
path: root/content/notes/source-sdk.md
blob: 86fa4c3bd796af7c4c204a9b44024792ea8ff8de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
+++
title = 'Source SDK (Team Fortress 2) development notes'
+++

## Websites

* [ValveSoftware/source-sdk-2013](https://github.com/ValveSoftware/source-sdk-2013) - git repo
* [ValveSoftware/Source-1-Games](https://github.com/ValveSoftware/Source-1-Games) - issue tracker

## Development

Patches are merged by [EricS-Valve](https://github.com/EricS-Valve) from time to time, usually late in the day or on a weekend.

The SDK game code and live TF2 are not identical. There is code in the SDK that is not present in TF2, and vice versa. For example, `NotificationQueue_Add` is [disabled in the SDK](https://github.com/ValveSoftware/source-sdk-2013/blob/9cbe7d5d3c847fb2e2be6049c3e2a72853bd6b85/src/game/client/econ/econ_notifications.cpp#L1292) but not in live TF2. Not to mention, Valve uses Perforce P4 for version control instead of Git.

## Building with Visual Studio 2026

Valve Project Creator (VPC) only targets up to Visual Studio 2022. Visual Studio 2026 can be used if you install the 2022 toolchain:
```bat
"C:\Program Files (x86)\Microsoft Visual Studio\Installer\setup.exe" modify --installPath "C:\Program Files\Microsoft Visual Studio\18\Community" ^
    --add Microsoft.VisualStudio.Component.VC.14.44.17.14.x86.x64 ^
    --add Microsoft.VisualStudio.Component.VC.14.44.17.14.MFC     ^
    --add Microsoft.VisualStudio.Component.VC.14.44.17.14.ATL
```

You will need to install Python as well:
```bat
winget install Python.Python.3.14
```

After that, follow the build instructions in README.md.

## Running and debugging

Debug builds of the SDK are [broken](https://github.com/ValveSoftware/source-sdk-2013/issues/663). Use Release builds instead.

To run the game from Visual Studio, install the Source SDK Base 2013 Multiplayer and use the following project options:
![](/notes/source-sdk/debug-options.png)

## Code style

* Use tabs for indentation.
* Use [hungarian notation](https://en.wikipedia.org/wiki/Hungarian_notation) for any variable that is serialized.
* Curly braces get a new line. ([Allman style](https://en.wikipedia.org/wiki/Indentation_style#Allman_style))
* Curly braces can be omitted if the condition body is only one line.
* Pointer asterisks go on the right, next to the variable name.
* Put spaces around function arguments.
* Put spaces around template arguments. (Usually. The code base is like 60-40 in favor of this style.)

All this being said, much of the code base is not consistent. Just pay attention to the surrounding code and match the style.