TF2 HUD editing: how to change a HUD's files by hand

A TF2 HUD is a folder of text files. Editing a HUD means opening those files and changing numbers and names: where a panel sits, how large it is, which font and colour it uses. This page explains the files and the values in them. To change a HUD without touching files, use the HUD builder in your browser.

What you need to edit a TF2 HUD

The folders of a HUD

A HUD is a folder inside tf/custom. Its name is yours to choose. Inside it:

File or folderWhat it holds
info.vdfTells the game which version of the interface the HUD was made for.
resource/clientscheme.resThe named colours, fonts and borders that the other files use.
resource/ui/*.resOne file per part of the HUD: hudplayerhealth.res, hudammoweapons.res, scoreboard.res and so on.
scripts/hudlayout.resWhere most panels sit on the screen and how large they can be.
scripts/hudanimations_tf.txtThe animations, such as low health flashing and changing colour.
scripts/hudanimations_manifest.txtThe list of animation files the game loads.
materialsThe images the HUD uses.

Every HUD needs an info.vdf like this one. The reference says that most HUD files do not load when the file is missing or the number is too low. The default HUD is at 3 today.

"MyHud"
{
    "ui_version"    "3"
}

A HUD does not need every file. A file that is not in your HUD is loaded from the game, so a HUD can hold only the files it changes. Take those from the default HUD files or from an existing HUD you installed.

What a .res file says

A .res file is a list of elements. Each element is a name with a block of values in curly brackets. This is the ammo panel in 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"
}

Positions and sizes

The numbers are not pixels. The screen is always 480 units tall. Its width in units 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 the count starts.

xpos or yposWhat it means
5050 units from the left edge for xpos, or from the top for ypos.
r5050 units from the right edge for xpos, or from the bottom for ypos.
c5050 units right of the centre for xpos, or below it for ypos. A negative number goes the other way.
rs1.0Like r, counted in the element's own size: 1.0 moves it in by its full width or height.
cs-0.5Like c, counted in the element's own size: -0.5 puts its middle on the centre of the screen.
wide or tallWhat it means
5050 units wide or tall.
f0The full width of the screen at every aspect ratio.
p0.5Half of the screen's width for wide, or of its height for tall.
o0.5The 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 cuts off what is inside it. The reference notes that an element which is larger than its panel, or sits outside it, is not drawn. Some HUDs make the panel cover the whole screen, with wide f0 and tall 480, and place everything in the element's own file.

Colours and fonts: clientscheme.res

clientscheme.res has a section for colours, one for fonts and one for borders. A colour is a name with four numbers: red, green, blue and alpha. A font entry has a name that the other files refer to, the font to use, a height in tall and antialias for smooth edges. To change the size of a number on the HUD, find the font name its element uses and change tall in that entry. The TF2 fonts guide lists the game's fonts and shows how to add one.

See a change without restarting

CommandWhat it does
hud_reloadschemeReloads the HUD's layout and animation files while the game runs.
vgui_cache_res_files 0The setting the HUD reference recommends while you reload HUD files. 1 by default.
vgui_drawtree 1Opens a list of every panel that is drawn, with its name. It works only while sv_cheats is 1.
vgui_drawtree_draw_selected 1Highlights on the screen the panel you select in that list.
showschemevisualizerShows the colours, borders and fonts of a scheme file. With no name after it, clientscheme.res.
cl_hud_minmode 1Turns on minimal mode, to check the values that end in _minmode.

hud_reloadscheme has limits. The reference says it does not reload clientscheme.res or most menus, so a new font or colour shows after you restart the game. 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 the game, vgui_drawtree 1 shows the name of every panel that is on the screen.

Make it work on Linux

Linux tells upper and lower case apart in file names, 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 the size they have on Windows to look the same. The HUDs for Linux list shows the HUDs whose authors list Linux support.

Where this comes from

How the files work is from TF2-Hud-Reference by JarateKing (MIT licence), which goes much further than this page: animations, materials, health, ammo and damage numbers each have a chapter. 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 to switch on, in the customizable HUDs list, put a custom crosshair in a HUD, add transparent viewmodels, or go back to the default HUD.