TF2 HUD editing: how to change a HUD's files by hand
A TF2 HUD is just a folder of text files. Editing one means opening those files and changing numbers and names: where a panel sits, how big it is, which font and colour it uses. If you'd rather not touch any files, use the HUD builder in your browser.
What you need to edit a TF2 HUD
- A text editor. JarateKing's HUD reference recommends against Notepad because of how it handles line endings, and suggests Notepad++ or VS Code instead.
- GCFScape, to open the game's VPK files and pull out the default files.
- VTFEdit, only if you want to change images (HUD images are VTF files).
The folders of a HUD
A HUD is a folder inside tf/custom, named whatever you like. Inside it:
| File or folder | What it holds |
|---|---|
info.vdf | Tells the game which version of the interface the HUD was made for. |
resource/clientscheme.res | The named colours, fonts and borders that the other files use. |
resource/ui/*.res | One file per part of the HUD: hudplayerhealth.res, hudammoweapons.res, scoreboard.res and so on. |
scripts/hudlayout.res | Where most panels sit on the screen and how large they can be. |
scripts/hudanimations_tf.txt | The animations, such as low health flashing and changing colour. |
scripts/hudanimations_manifest.txt | The list of animation files the game loads. |
materials | The images the HUD uses. |
Every HUD needs an info.vdf like this. According to the reference, most HUD files won't load if it's missing or the number is too low. The default HUD is currently at 3.
"MyHud"
{
"ui_version" "3"
}You don't need every file. Anything missing from your HUD gets loaded from the game, so a HUD only has to include the files it changes. Grab those from the default HUD files or from a HUD you've installed.
How a .res file works
A .res file is a list of elements, each one a name followed by a block of values in curly brackets. Here's the ammo panel from the default hudlayout.res:
HudWeaponAmmo
{
"fieldName" "HudWeaponAmmo"
"visible" "1"
"enabled" "1"
"xpos" "r95"
"xpos_minmode" "r85"
"ypos" "r55"
"ypos_minmode" "r36"
"wide" "94"
"tall" "45"
}- xpos and ypos set where the element sits horizontally and vertically.
- wide and tall set its size.
- zpos, if it's there, decides which of two overlapping elements is on top: the higher number wins.
- visible and enabled turn the element on and off. The reference warns that the game forces a lot of elements on no matter what these say. Its workaround is to move the element off screen with an
xposof 9999. - A value ending in _minmode replaces the normal one in minimal HUD mode.
Positions and sizes
The numbers aren't pixels. The screen is always 480 units tall, and its width depends on the aspect ratio: 640 at 4:3, 768 at 16:10 and about 853 at 16:9. A letter in front of the number changes where it counts from.
| xpos or ypos | What it means |
|---|---|
50 | 50 units from the left edge for xpos, or from the top for ypos. |
r50 | 50 units from the right edge for xpos, or from the bottom for ypos. |
c50 | 50 units right of the centre for xpos, or below it for ypos. A negative number goes the other way. |
rs1.0 | Like r, counted in the element's own size: 1.0 moves it in by its full width or height. |
cs-0.5 | Like c, counted in the element's own size: -0.5 puts its middle on the centre of the screen. |
| wide or tall | What it means |
|---|---|
50 | 50 units wide or tall. |
f0 | The full width of the screen at every aspect ratio. |
p0.5 | Half of the screen's width for wide, or of its height for tall. |
o0.5 | The same share, taken from the other direction. With a p value on the other line it makes a square. |
A panel in hudlayout.res also clips whatever is inside it. The reference notes that an element bigger than its panel, or outside it, won't be drawn. Some HUDs make the panel cover the whole screen with wide f0 and tall 480, then position everything in the element's own file.
Colours and fonts: clientscheme.res
clientscheme.res has sections for colours, fonts and borders. A colour is a name with four numbers: red, green, blue and alpha. A font entry has a name the other files refer to, the font to use, a height in tall and antialias for smooth edges. To resize a number on the HUD, find the font its element uses and change tall in that entry. The TF2 fonts guide lists the game's fonts and how to add your own.
See a change without restarting
| Command | What it does |
|---|---|
hud_reloadscheme | Reloads the HUD's layout and animation files while the game runs. |
vgui_cache_res_files 0 | The HUD reference recommends this while you reload HUD files. 1 by default. |
vgui_drawtree 1 | Opens a list of every panel being drawn, with its name. Needs sv_cheats 1. |
vgui_drawtree_draw_selected 1 | Highlights the panel you select in that list on screen. |
showschemevisualizer | Shows the colours, borders and fonts of a scheme file, or of clientscheme.res if you leave out the name. |
cl_hud_minmode 1 | Turns on minimal mode, to check the values that end in _minmode. |
hud_reloadscheme has its limits. The reference says it doesn't reload clientscheme.res or most menus, so new fonts and colours only show up after a restart. Type the commands in the console.
Which file draws what
tf2-res-file-list by cooolbros is a table of HUD files with a screenshot of what each one draws. In game, vgui_drawtree 1 shows the name of every panel on screen.
Make it work on Linux
Linux file names are case-sensitive, and the reference says every file name has to be lower case to load there: resource/ui/mainmenuoverride.res, not Resource/UI/MainMenuOverride.res. It also says fonts on Linux need 0.8 times their Windows size to look the same. The HUDs for Linux list shows HUDs whose authors say they support Linux.
Where this comes from
How the files work comes from TF2-Hud-Reference by JarateKing (MIT licence), which goes a lot deeper than this page, with chapters on animations, materials, health, ammo and damage numbers. The ammo panel and the version number are from the default HUD files in TF2-Default-HUD. What the commands do is from the reference and from the game's own help text, as listed in mastercomfig's docs.
Next
Start from a HUD that already has options you can toggle (see the customizable HUDs list), add a custom crosshair or transparent viewmodels to a HUD, or go back to the default HUD.