Skip to content

Lore Zone

Jason edited this page Sep 28, 2022 · 10 revisions

WELCOME TO THE 😎 LORE ZONE 😎

This page is where I'll drop any random tidbits of information in regards to budhud, so others interested in any of the silly minutiae of how the hud works can potentially understand it better. For what it's worth, though, I'm pretty poor at explaining things, so I apologize in advance!

Origin

budhud was first started in June of 2014. Like most (if not all) huds at the time, budhud took the default tf2 hud files and made changes to them directly. While this made the process easy and quick, it came with the caveat of updates being a huge pain in the ass. Any time there was an update that added/changed/removed code, hud developers would need to find what files changed and make the changes to their hud (a process I absolutely hated).

At the time, I was also making multiple versions of my hud for my friends to use while streaming (STAR_ hud, truktruk hud, etc). These colloquially became to be known as streamer huds, as they usually hid all names from the hud to prevent stream sniping. What this meant, though, was that any change I made to the main hud had to also be made in the stream huds.

In August 2016, I started to mess with the idea of remaking my hud from scratch, and I had learned of a hud technique from Wiethoofd referred to as #base. The Valve developer wiki says that #base "reads the file and creates the controls as children of the panel that called the include statement."

One way of using #base is to have the default TF2 file act as a "directing" file that contains all of the information needed for the file to work. A way to look at this is that you're telling TF2 "instead of having all of the code needed for this file to work in one place, I'm going to split it out into multiple files and then tell the main file to look for those individual files".

Wiethoofd used #base by having his hud's files reference the default tf2 hud files. This meant that, whenever there was an update, all he'd have to do is download the default hud files and overwrite his older copy of the default hud folder, and then #base would take care of the rest. This would save him the headache of having to go through and manually make those changes. I liked this idea a ton, and wanted to implement it on a bigger scale by building the entire hud off of the #base method.

Demonstration of #base

explainingbase I tried to make this to make base easier to understand, but I think I may have just made it harder lol.

#base could be compared to layers in photo editing software. The higher a layer is, the more "precedence" it has -- it will be displayed above any layers below it. Furthermore, anything you drew in a lower layer doesn't need to also be drawn in the upper layers. These two principles are what makes #base flexible, especially when it comes to updating the default TF2 hud files when there are updates.

Here's an example from my hud:

Example 1

When you load into a game, one of the files TF2 will attempt to load is basechat.res, located in \<custom>\resource\ui. This is the file above. The #base lines above then tell TF2 to try to find and load the files in those three paths. TF2 will load the #base lines from bottom to top, with each step along the way overwriting values from the previous step. So, TF2 will first load _tf2hud\resource\ui\globalchat.res. Then, it will look at the code in _budhud\resource\ui\globalchat.res and "merge" this into the _tf2hud\resource\ui\globalchat.res file. Finally, it looks at _stream\resource\ui\globalchat.res and merges those changes into the two other files.

This means that I can tell TF2 to load the default hud files, then my hud's changes, then any stream hud changes. This allows me to cleanly separate out and prioritize the different versions of my hud.

One of the cool things I discovered was that you could also use this to "hide" files until they're needed by the end user. When you first download the hud, the folder called _stream is actually called _stream_. When the same file check is done in the above example, TF2 can't find the file in _stream and skips over it. This makes it possible to simply drag and drop files into a folder to enable them.

Example 2

Here's a more involved example. Given that HudDev, User Customization, and HUD Customization are disabled by default, it makes sense to have these be the files at the top first; if you're enabling customizations, they should overwrite anything the default hud would set. Since #base files are loaded in ascending order, a higher #base line results in higher priority.

For more information on #base, I'd encourage you to check out JarateKing's explanation over here..

So, what do all the folders do?

I use a variety of folders to keep my hud easy for me to work on:

  • _tf2hud contains all of the core TF2 hud files necessary for the hud to work. They are slightly modified by a script I run to remove conditional lines (`if, minmode, etc), but otherwise remain untouched. You should never need to edit any files in here
  • _budhud contains all of my changes to the _tf2hud (default hud) files
  • _stream contains changes that modify the _budhud and _tf2hud files to hide any server-revealing information
  • #customization contains any of budhud's various customization options. These changes will supersede every other file in the hud
  • #users is like #customization but already tuned to a specific person/player's preferences, and supersedes any #customization changes
  • materials contains any of the custom images and icons used in budhud
  • resource and scripts contain the files that TF2 actually look for when it first loads, and these files reference all of the above folders (_tf2hud, _budhud, _stream, and so on)

File Sizes

budhud itself is actually fairly lightweight, but a majority of its overall file size comes from backgrounds.

As of 8/23/20:

  • TF2 Hud files: ~3.86 MB
  • budhud Files: ~4.46 MB
  • Materials: ~28.6 MB (~23 MB of backgrounds)

Overall Size: ~37 MB (62% of which is backgrounds)

Clone this wiki locally