An Automated Team Fortress 2 Benchmarker
To begin, you need:
- A Team Fortress 2 installation.
- (Optional) FPS config to benchmark from.
- A demo, placed in the
tf
directory, to benchmark against. - Commands to benchmark.
- Remove or disable any configs that could interfere with the benchmark (autoexec.cfg)
- Set the TF2 path to your
Team Fortress 2
directory (steamapps/common/Team Fortress 2). - Set the DirectX level, or leave it unchanged.
- Load an existing FPS config or use the default TF2 configuration.
- Load or add commands to benchmark. The file format for loading benchmarks is described below.
- (Optional) In the
Benchmark List
andFPS Config
tabs, uncheck values you don't wish to use. - Specify the demo to benchmark.
- Click start.
- After the benchmark completes, view the results in the
Results
tab.
Shift + F10
will stop a benchmark while one is running. TF2 will not immediately close, it will finish the current command and then stop. You should hear a sound confirmation after pressing it.
Alt + S
will start and stop the benchmark while in the GUI.
Alt + B
will run a baseline benchmark.
Alt + P
will open the dialog to select the Team Fortress 2
folder.
Any standard FPS config can be loaded and used alongside of a benchmark.
To quickly add commands to benchmark, you can place them in a .txt
file, with a command on each line.
Example:
my_command 1
my_other_command "2"
// Both of these are accepted, comments like this are ignored
Each command will be benchmarked separately.
If you want to run multiple commands at the same time, you can do so in the following format:
Name to display | a_command 1 | b_command "value" | c_command 3 ...
More examples can be found in the Benchmark Examples
folder.
Each time you start a benchmark, the program will perform the following steps:
- Any existing
cfg/config.cfg
andsourcebench.csv
files are backed up. - If needed, a baseline benchmark is performed. During this phase:
- The game is started.
- The DirectX level is set.
- If the
Default
option is selected, the game is started with the following parameters:
[DirectX Level] -default -timedemo_comment "Baseline" [Custom Launch Options] +timedemoquit [Demo Name]
- If the
Custom Config
option is selected, thedefault
parameter is not included and the FPS config is copied totf/custom/tfbench/cfg/autoexec.cfg
. - TF2 generates a clean
config.cfg
using the commandhost_writeconfig
. - The game exits.
- The main benchmark session starts.
- For every command in the
Benchmark
list, anautoexec.cfg
will be generated with the command combined with the FPS config (if used). - If the FPS config contains the same command as the one being benchmarked, it is overridden.
- If the
Run Twice
box is checked, thetimedemo_runcount
launch parameter will be set to2
, and the firsttimedemo
result will discarded to ensure consistency. Is is highly recommended that you use this option. - The game is started with the following launch options:
-timedemo_comment [Command Name] [Custom Launch Options] +timedemo_runcount [1/2] +timedemoquit [Demo Name]
- The game exits, and starts up again to benchmark the next command.
- Results are parsed from the
sourcebench.csv
file, and displayed in the results tab. - The backed up
config.cfg
andsourcebench.csv
files are restored, and the temporaryautoexec.cfg
is removed.
- Close out all applications that could interfere with the benchmark. This includes internet browsers, VoIP applications, etc.
- Under normal conditions, results can vary between ±2-3 fps between identical runs.
- Keeping
-dxlevel
in the launch options can negatively affect performance, and cause crashes. Remember to remove it once you've set your DirectX level to the desired value. Do not manually set the dxlevel level lauch option when using TF2Bench, instead use the DirectX selector. - The benchmark cannot run twice in once session when using the
-default
launch parameter (#5), thus baseline results when using this option may be inaccurate.