HUDs
A HUD in LHM context is basically a web app, which is encapsulated by LHM, and is provided with game & meta data for the currently spectated Match.
HUD Schemas
hud.json
When uploading or developing a HUD, it must have a hud.json
in it's root (or in /public
, or /static
directory in case of development). This file file is just a small metadata to describe some basic properties of the HUD, and it looks like this:
{
"name":"LHM CS2 Default HUD",
"version":"1.0.0",
"author":"Lexogrine",
"legacy": false,
"radar": true,
"killfeed": false,
"game":"cs2", // 'csgo' | 'rocketleague' | 'dota2' | 'f1' | 'leagueoflegends' | 'apexlegends' | 'cs2'
"variants": ["main", "replay"]
}
Fields name
, version
, author
and game
are self-descriptive.
legacy
field should always be set to false
, unless you are porting one of the pre-2020 Counter-Strike HUDs based on this repository and its forks, as it makes certain assumptions about assets' file structure.
radar
& killfeed
are Counter-Strike-only, and are just indicators on the HUD list, to show if those features are supported.
variants
are described in their own section: HUD Variants
HUD Variants
In case when HUD is having multiple purposes, such as being "Main" HUD, Replay HUD, and maybe is supposed to display at the same time at the LED Panels on stage, instead of creating multiple HUDs and potentially using more disk size for more builds, HUD have "variants" specified, by adding variants
array of string to hud.json
.
Using Ultra HUD
as an example, after adding a few variants, they are accessible by URL:
http://localhost:1349/huds/ultrahud/
http://localhost:1349/huds-variant/ultrahud/veto/
http://localhost:1349/huds-variant/ultrahud/veto-fullscreen/
All of those URLs point to the same HUD, so distinguishing when a HUD should render which compoment is a developer's duty. To do that, you can just read variant
query from the URL:
const query = new URLSearchParams(window.location.search);
export const variant = query.get("variant") || "default";
Reloading HUDs
Sometimes, due to bugs, lag, or inconsistent data from the game HUDs must be reloaded. We provided 2 different methods for that
Local overlay reload
If HUD is opened as an overlay window over the game, you can refresh this window by clicking special keybind (by default: Left Alt+F
). You can achieve the same effect the same effect by doing a HTTP request:
POST /api/huds/refresh
Browser Source reload
This method sends socket message to all connected HUDs to reload them. While this technically is dependent on the implementation, it is assumed that all HUDs are made with our open-source templates, which have this functionality.
Force reloading all HUDs can be triggered with a keybind (by default: Left Alt + Left Shift + F
), or by doing HTTP request:
POST /api/huds/refreshAll