Half-Life 2: Deathmatch

Half-Life 2: Deathmatch

70 ratings
[FAQ] HUD development in HL2DM
By 13rp and 1 collaborators
2
   
Award
Favorite
Favorited
Unfavorite
Before you begin
Why do custom HUDs work at sv_pure 2 servers?
Because you don't change models, textures or sounds. But if you do (for example you set custom background for GUI-menu) it will be changed to default as you connect to a sv_pure 2 server.

How to install custom HUDs or other modifications?
Since steampipe conversion you should place your custom files into:
Steam\steamapps\common\Half-Life 2 Deathmatch\hl2mp\custom
You can put here folders with your huds, sounds, etc or use single .vpk files.
Read readme.txt to understand how to use custom folder or watch the video in the next question.

Q: What tools do i need?
  • First of all - a good text editor, for example NotePad++[notepad-plus-plus.org] or Sublime Text[www.sublimetext.com].
  • Font editor: FontCreator[www.high-logic.com].
  • WinMerge[winmerge.org] - the tool which will help you to compare files if you, for example, investigate other's HUDs.
  • https://developer.valvesoftware.com/wiki/Vpk - since steampipe conversion some default models, textures and sounds are stored inside *.vpk files. If you need them or if you want to convert your custom files to single *.vpk use vpk.exe located in
    Steam\steamapps\common\Half-Life 2 Deathmatch\bin
    Just drag and drop your *.vpk or folder you want to convert onto the vpk.exe.
  • GCFScape[nemesis.thewavelength.net] - the tool made for working with *.gcf archives, but it also can open *.vpk. It is useful if you want to extract single file from gcf/vpk.

What are the general game-files i need if i want to make a new HUD from scratch?
  • ClientScheme.res located in hl2mp\resource. This file contains the information about the general fonts, colors, borders and so on.
  • halflife2.ttf located in hl2mp\resource. This is the main font-file the HUD uses.
  • valve_english.txt, valve_[your_lang].txt located in hl2\resource
  • HudAnimations.txt located in hl2mp\scripts describes animation of HUD elements running on in-game events.
  • HudLayout.res located in hl2mp\scripts defines all the HUD elements with their properties and postion.

How to make HUD development as fast as possible?
Create several shortcuts of steam.exe to run the game with the following options:
If you test the GUI: Steam.exe -applaunch 320 -console -window -w 1280 -h 1024
If you test your HUD: Steam.exe -applaunch 320 -console -window -w 1280 -h 1024 +map dm_lockdown
You will need to restart your game if you make any changes related to the Resource-folder.
If you make changes in files related to the Scripts-folder, type hud_reloadscheme in your console and the changes will be applied instantly. Bind it for your convinience.
General modification questions
Q: How do i change my crosshair?
There are 2 ways to change crosshairs. You can use a font symbol or material as a crosshair. Custom materials won't work on sv_pure 2 servers so forget about it. By default, the Q-symbol of halflife2.ttf-font is used by the game as a crosshair. So edit this symbol or copy and paste from another HUD and save. Here is an example:

Q: How to change crosshair's color to white?
// HL1-style HUD colors "Yellowish" "255 160 0 255" "Normal" "255 208 64 255" // This string in ClientScheme.res "Caution" "255 48 0 255"
Colors have format: "Red Green Blue Alpha", where Alpha is transparency.

Q: How to disable or lower the level of red screen splashes
This can be adjusted in HudAnimations.txt, starting from the string:
event HudTakeDamageLeft
. I personally prefer not to turn it completely off. I leave them very low http://pastebin.com/06MTfb0x.

Q: How to change health, armor, ammo colors?
You can do it quickly using the following keys in ClientScheme.res:
  • FgColor
  • BgColor
  • Panel.FgColor
  • Panel.BgColor
  • BrightFg
Note: As a rule every HUD element has Background color (Bg in short) and color itself (Foreground=Fg in short)
But this is the easiest way. If you want to make more advanced and colored HUD go to HudAnimations.txt.

Q: How to change the font of HP, Armor, ammo etc…
The responsible fonts are defined in ClientScheme.res. They are:
  • HudNumbers
  • HudNumbersGlow (don't remember exactly where it is used)
  • HudNumbersSmall (displays the quantity of picked up items)
You can either copy and paste symbols from other fonts to halflife2.ttf replacing original symbols or you can use the key name (for example "name" "Verdana") to include any font installed in Operating System. Also you can even make your hud more independent and portable: Put the necessary fonts in your resource folder and include it in ClientScheme.res using the following code:
CustomFontFiles { "1" "resource/HALFLIFE2.ttf" "1" "resource/HL2MP.ttf" "2" "resource/HL2crosshairs.ttf" "3" "resource/RUSRETURN TO CASTLE.ttf" }
Some examples:

Q: I renamed some font-file. I try to include it using CustomFontFiles and it does not work, but worked with an old name. What am i doing wrong?
Renaming filename is not enough. Open your file in FontCreator, navigate to Format==>Naming==>Font Family Name and change it.

Q: I try to make some font outlined, but it is still transparent and outline does not appear
Set key "Additive" to "0" for this font.

Q: I set outline for some font, but it is not steady and leave some space between symbol and outline. How to fix?
Looks like antialiasing does not always work properly for font outline so set key "antialias" to "0".

Q: How to change the icon of health/armor/ammo?
Here is one of possible ways which will make animating easier in the future:
Add new glyphs in halflife2.ttf and assign vacant symbols to it. Then go to valve_[your_lang].txt and change text of the keys "Valve_Hud_HEALTH", "Valve_Hud_AMMO", "Valve_Hud_SUIT" according to the symbols related to new glyphs with necessary icons.

Q: I've set new symbols/icons, but they are cropped, do not fit some invisible borders... How to fix?
It is time to investigate https://developer.valvesoftware.com/wiki/HudLayout.res. In this file you can change object's position (xpos,ypos), object's scale (wide,tall), text's position (text_xpos,text_ypos) and digit's position inside the object (digit_xpos,digit_ypos). And also Background type (PaintBackgroundType).
hud_reloadscheme will help you much.
By horizontal axis you can set the position from the right, left or center (in both directions). In horizontal axis the metrics are pixels. The following picture made by k3z will help you in understanding how it works:
By vertical axis the metrics are not pixels. The range of values inbetween your object will be visible is 0-480, so 480 is the bottom of the screen:

Q: Where can i change weapon icons showing in deathnotice area?
mod_textures.txt

Q: And suicide icon?
d_skull in mod_textures.txt

Q: How to make my xhair otlined? Adding "outline" to HudCrosshair does not work
This was very difficult question since HL2DM had been updated in october 2010. Once k3z was invstigating HUDs in L4D and discovered that there is an ability to make new hud elements in HudLayout.res. Here is an example of block of code from HudLayout.res.
OutlinedCrosshair //THX to k3z for great idea { "controlName" "Label" "fieldName" "OutlinedCrosshair" "visible" "1" "enabled" "1" "font" "OutlinedCrosshair" "LabelText" "Q" "xpos" "c-320" //100% centered, don't change "ypos" "1" //100% centered, don't change "wide" "640" //100% centered, don't change "tall" "480" //100% centered, don't change "textAlignment" "center" //100% centered, don't change "fgcolor_override" "0 255 0 255" //xHair color }
It will create a new element named "OutlinedCrosshair"
Note: that it can be animated in HudAnimations.txt as well.
You can also create as much elements as you want. Take a look on this awesome HUD made with several custom elements:
You can also create "Panel" elements and if you need to change the order the elelemnts are displayed, use "zpos" key.
Eample of "panel":
TestSite { "controlName" "Panel" "fieldName" "TestSite" "visible" "1" "enabled" "1" "xpos" "c-19" "ypos" "c-12" "zpos" "-100" "wide" "38" // 37 "tall" "16" "fgcolor_override" "255 255 255 255" }

Q: Is there any way to make individual outlined crosshair for every weapon?
No way :(

Q: I changed the crosshair but why stunstick and SLAM has default crosshair composed of 5 dots?
Because of the bug this game has for years: stunstick and SLAM use default sprite. To fix this you need to extract 2 files: weapon_slam.ctx and weapon_stunstick.ctx. Next download CtxConverter[gamebanana.com] and convert ctx to txt.
Open converted *.txt files and replace this:
"crosshair" { "file" "sprites/crosshairs" "x" "0" "y" "48" "width" "24" "height" "24" }
with this:
"crosshair" { "font" "Crosshairs" "character" "Q" }

Q:Same problem in free view while spectating. How to fix?
Open hud_textures.txt, find crosshair_default and replace it with:
"crosshair_default" { "font" "Crosshairs" "character" "Q" }
Advanced questions
Q: What is the difference between PaintBackgroundType values?

  • 0 - rectangle with rectangular corners
  • 1 - gradient background
  • 2 - rectangle with rounded corners

Q: How to make AUX power stripe to look continuous?
"BarChunkWidth" "1" "BarChunkGap" "0"

Q: How to make my scoreboard to look compact? What file is responsible for scoreboard settings?
Set key "tall" to "100″ in Resource/ui/ScoreBoard.res

Q: How to adjust scoreboard's colors?
In ClientScheme.res find this code:
SectionedListPanel.HeaderTextColor "Orange"// color of "score", "deaths", "latency" SectionedListPanel.HeaderBgColor "Blank" SectionedListPanel.DividerColor "Black"//color of horizontal separating lines SectionedListPanel.TextColor "Orange" SectionedListPanel.BrightTextColor "Orange" SectionedListPanel.BgColor "TransparentLightBlack"//scoreboard's background SectionedListPanel.SelectedTextColor "Black" SectionedListPanel.SelectedBgColor "Red" SectionedListPanel.OutOfFocusSelectedTextColor "Black" SectionedListPanel.OutOfFocusSelectedBgColor "255 255 255 32"//Horizontal line highlighting your nickname
Also:
Label.TextBrightColor - server's name
Fgcolor will change the border of your scoreboard.

Q: Where can i tune the chatbox?
The fonts can be found in ChatScheme.res, the chatbox is configured in ui/BaseChat.res

Q: Where can i tune the game-GUI (Main Menu List)?
GameMenu.res

Q: And colors of GUI?
SourceScheme.res

Q: How to make custom GUI background?
background01.vtf and background01_widescreen.vtf in materials\Console.
Note: It will be automatically changed to default connecting to sv_pure 2 server, deal with it.
The tool which will help you to make *.vrf texture is VTFEdit[nemesis.thewavelength.net].

Q: I am making custom backround. How can i remove translucent text "HALF-LIFE 2 Deathmatch" on it?
Make "Main.Title1.Color" and "Main.Title2.Color" in ClientScheme.res absolutely transparent.

Q: Which files are used for spectator's bar tuning?
spectatormenu.res, ui/Spectator.res, ui/BottomSpectator.res
Conclusion
If you are going to make a good HL2DM hud, you should know that modern HUDs contains:
  • centered crosshair
  • fixed redscreen
  • fixed slam, stunstick crosshairs and fixed crosshair in free view in spectator mode
  • very advisable to make good spectators bar
  • if you added any custom hud elements (for example outlined crosshair), make sure they disappear when you are dead (HudAnimations.txt will help you)

I want to thank people who helped me much when i tried to make my own HUD for the first time: TSMC, asf, k3z.

GL&HF
15 Comments
Goro Majima 14 Feb, 2024 @ 5:16pm 
dumb question but: does this works for half life 2 mods too?
[B.n.B] Gordon Fridgeman 25 Jan, 2024 @ 5:12am 
What can you use to make the gun display on your green hud?
SF|Pred 2 Mar, 2023 @ 5:17am 
Perhaps my program will be enough for you, in which you can design a HUD for hl2dm...
HL2 Pred's HUDs [gamebanana.com]
Phantom_Boy 22 Nov, 2022 @ 10:04pm 
no death icon showing up . kil feed lok like this : killerKilled
i didn't add any new icons orginal source sdk icons dont show
KOR_APUcard 13 Mar, 2022 @ 8:45am 
All video is private. Please post public video.
CommunityUs 16 Apr, 2019 @ 10:05pm 
top 3x vids are no longer playable? weird content shoulda been fine. anyway just a heads up
gang weed MLG 17 Aug, 2018 @ 6:28am 
hey so ive ran into a problem with the hud, i want to change the position of the hudsuitpower but because of the animation changing the position its stuck in the same position, how do i change the animation so the position of it is the same?
13rp  [author] 31 Jul, 2017 @ 12:52am 
I do not remember anything about that. Please use the info AS IS.
`Scorpio'M 30 Jul, 2017 @ 9:26am 
ClientScheme.res is located in hl2 folder, there's no such file in hl2mp.When i use hl2 scheme file custom hud works fine but menu screen is showing weapon symbols instead of "deathmatch" ?! Please answer.
ft 5 Mar, 2017 @ 12:38am 
Which font is responsible for the main menu buttons and "Health, Ammo, Suit, etc."'s text?
Because I just wanted to replace it with the other font I have.
Is it the bitmap font "Buttons"?
Thanks in advance!