The full source of the two mods exactly as shipped in HiveLordHUDv3.zip (Source/). Highlighted blocks are explained in the tutorial: each one names the chapter it belongs to, and every chapter links back here.
Ch. 3The line the Loader looks forThe first line is the declaration the Loader uses to find the mod. The name must match the packed resource name exactly, and it must stay plain text: compiling to bytecode drops it.
Ch. 12Section indexThe order of the whole file, which is exactly the table in Chapter 12: data, detection, HP locator, zone tracking, GUI, per-frame worker, settings, install.
Ch. 4Lifecycle rules paid for in crashesRun inside the update wrapper, disarm on the first fault, check the world is live before every call, treat Gui as retained mode, pass real engine objects. Each of these five rules matches a crash in Chapter 4.
16-- Lifecycle (same as HUD+, which is known to be stable):
17-- * runs inside a wrapper around the engine's global `update` (main thread, once per frame) and disarms itself
Ch. 3Using the Loader's shared log folderPrefer the open_log the Loader provides so the log sits next to every other mod; fall back to %TEMP% only without the Loader.
50H.recent = {} -- last few log lines, mirrored on screen
Ch. 9A trace of being bundled with ReconIf the Recon research mod is present, lines go into its log. The first 69 HUD builds were packed together with Recon.
Ch. 8Design values decoded with FileDiverMax HP and constitution for all 38 zones, all from the health component decoded offline. These numbers later validate the record in memory.
Ch. 4Finding the Hive Lord with the engine APIWorld.units lists every unit; check Unit.alive, then compare Unit.resource_name against the Hive Lord hash. A dead corpse is skipped by address and never even asked alive again.
Ch. 4The Unit.world_position trapNode 0 reads (0,0,0) for every unit, so named bones (root, head) are used instead, checked with has_node first because an unknown name triggers an engine assert.
219-- Root node world position. Index 0 is the root (scene node indices are 0-based); guarded by node count.
220-- Vector3 fields are unreliable here, so parse tostring 'Vector3(x, y, z)'.
221-- Node 0 is a static root that reads (0,0,0) for the Hive Lord and every avatar, so named bones are used instead,
222-- resolved once per unit (Unit.has_node first: Unit.node asserts on unknown names).
Ch. 5Declaring Windows APIs with FFITell FFI what ReadProcessMemory and VirtualQuery look like, inside pcall (another mod may have declared them first), then load kernel32.
Ch. 7Offsets inside the recordOffsets of main HP, armour and the end marker relative to the zone array, plus the per-zone maximums. This is the code version of the memory map in Chapter 7.
Ch. 11Every read goes through ReadProcessMemoryThe comment says it: heap memory can be freed between the check and the read, and a raw read would crash; ReadProcessMemory just fails.
532-- All reads go through ReadProcessMemory on our own process: heap memory can be freed by another
533-- thread between a VirtualQuery check and a raw pointer read (that segfaulted in testing); RPM just fails.
Ch. 7The fingerprint: 39 armour valuesEvery record read checks the end marker, the 39 armour values that never change in a fight, and the HP range of every zone. Any mismatch means it is not a Hive Lord.
546-- Read the record around zone base z into WIN and validate it. Returns true if it still looks like a Hive Lord.
547-- Armor never changes in a fight, so it is the fingerprint: default zone, then slots 0..37.
Ch. 10The health system found by reverse engineeringThis comment records Chapter 10's result: how the damage function 0x9235F0 looks the table up, the global's RVA, the key-table and record-array offsets, and why a heap search can follow a frozen stale copy.
Ch. 6Base address + RVAGetModuleHandleA gives this launch's game.dll base; add the RVA 0x3326688 and read the health system's address. The base changes every launch, the RVA does not.
620-- Every (entity, index) in the health hash, in table order; calls fn(entity, index) until it returns true.
Ch. 7Walking the hash tableRead the whole key table and visit every (entity, index) pair. It does not compute the hash, so it does not need the multiplier the game uses.
Ch. 11The fallbackTake the fixed health-system path first; only if the global can't be read (for example after a game update) fall back to the slower heap search, and log why.
774-- Returns {main, zones[slot]}; zone values below 0 mean bleeding into constitution.
Ch. 11Re-validate every secondOnce a second, find the record again by entity and validate it; if it moved or was freed, search again instead of drifting to some other idle record.
Ch. 15Who changed this zone?Compare zone states every frame. HP landing exactly on -1 or -constitution while main HP did not drop means a host event; from the first host correction on, plate % get a '<'.
1075-- Push a prim's current state (colour p.c scaled by the group alpha) if anything visible changed.
1076-- Fades ramp brightness as well as alpha (the in-game alpha test showed alpha does blend; the brightness ramp
1077-- just makes the fade easier to see on bright backgrounds).
Ch. 4Undoing tone mappingThe Gui is drawn before exposure and tone mapping, so colours come out about 3x brighter. Before sending: sent = wanted / gain + black.
1078-- Colour correction. The screen gui is drawn before the game's exposure / tone mapping, so a colour comes out roughly
1079-- 3x brighter with the darks crushed (a {96,2,18} strip showed as 243,0,0; greys of 150-240 as pure white). Colours
1080-- are authored as they should look and mapped back here: sent = shown / gain + black. 'Colour correction' slider:
1081-- 100 = gain 3, black 18; 0 = off; 150 = stronger.
Ch. 4Projecting 3D to the screenCamera.world_to_screen turns the Hive Lord's position into screen coordinates. A log line is written before the first call: if the game crashes, the last line names the culprit.
Ch. 4Creating and tearing down the GuiCreate a screen Gui on a world; on teardown destroy it only if the world is still alive, and merely forget it if the world is gone.
Ch. 12The per-frame workerLook for units every 2 s, read HP every frame, handle death and the corpse, update distance and animation state, then render, and time itself.
2408 description = 'Marker on the Hive Lord with its distance, like a player tag (arrow on the screen edge when off-screen). Above ground: only while it is surfaced and within 1000 m. Always when alive: from when it is found until it dies, underground too (default).'},
2409 {key = 'panel_show', since = 3, type = 'choice', label = 'Armor panel', default = 'surface',
2411 description = 'Hive Lord silhouette with the armor % of each plate, plus the status lines. Above ground: only while it is surfaced and within 1000 m (default). Always when alive: from when it is found until it dies, underground or far away too.'},
2412 {key = 'bar_show', since = 3, type = 'choice', label = 'Boss bar', default = 'surface',
2414 description = 'Souls-style main HP bar with combo damage. Above ground: only while it is surfaced and within 1000 m (default). Always when alive: from when it is found until it dies, underground or far away too.'},
2417 description = 'Monochrome (default): white numbers, a thicker frame the lower the plate is; in the Poly style each part blackens unevenly, like scorch marks, as it loses HP (Pixel style: three grey steps); the boss bar turns red under 30%. Colour: plates go green > yellow > red.'},
2418 {key = 'style', type = 'choice', label = 'Panel art style', default = 'poly',
2420 description = 'Poly (default): low-poly silhouette, every part cut into 3-5 flat-shaded facets lit from the top-left. Pixel: the earlier blocky pixel-art silhouette.'},
2429 description = 'Shown: the status lines (HUD state, Hive Lord main HP, colour legend) above the armor panel. Hidden: no status text; the armor panel moves up into its place.'},
2430 {key = 'status_size', type = 'slider', label = 'Status text size (%)', default = 100, step = 10,
2431 description = 'Size of the status lines. 100 = original size.'},
2432 {key = 'bar_size', type = 'slider', label = 'Boss bar size (%)', default = 100, step = 10,
2433 description = 'Width, height and text of the boss bar. 100 = original size.'},
2434 {key = 'armor_size', type = 'slider', label = 'Armor value size (%)', default = 100, step = 10,
2435 description = 'Size of the armor % labels beside the panel. 100 = original size.'},
2437 description = 'The game brightens this HUD about 3x (greys turn white, dark red turns bright red). 100 = corrects that (default). Raise it if colours still look washed out, lower it if they look too dark; 0 = off.'},
2438 {key = 'preview', type = 'toggle', label = 'Preview with sample data (15 s)', default = false, gap = true,
2439 description = 'Works like a button: switch ON and apply, the boss bar and armor panel show sample HP for 15 s and this row goes back to OFF by itself. A real Hive Lord replaces it. Changing a size also previews for 8 s.'},
Ch. 12Working with another mod: the options menuMod Options Menu is a global API provided by another mod. The HUD only looks for it inside update (load order isn't guaranteed), registers its rows when found, and reads the values every 10 frames.
Ch. 2The hook: wrapping the game's update()The full version of Chapter 2's five lines: keep the original update, replace it, run the HUD under pcall each frame, disarm for good on a fault, and always call the original.
Ch. 10The bug, found by reverse engineeringZone state (collision) is always synced, but the gore that hides the model only runs on the machine that resolved the killing hit. The addresses in the comment were found with the methods of Chapter 10.
4-- A Hive Lord plate that is destroyed (zone HP -35000) always loses its collider and its crack overlay: that is zone
5-- state, synced to everyone (game.dll 0x925F10). The plate model itself is only hidden by gore (0x9057D0 -> 0x903C70),
6-- which runs only on the machine that resolves the killing hit, and only if that hit passes gore's checks. When
7-- gore never comes (seen on a client when a teammate's Eagle killed the plate), the plate stays drawn - looking
8-- intact again - while shots pass through it to the flesh behind.
Ch. 16The only write: one byteRead the byte, OR in one bit, write back a single byte, keeping the window against the game's own writes tiny. The value is the one the game's gore would write.
88-- OR one bit into the byte that holds it: a single-byte write keeps the window against the game's own writes tiny.
99local QFREQ = (k32.QueryPerformanceFrequency(QB) ~= 0 and tonumber(QB[0])) or 1e7
Ch. 13Seams for the testsBoth the clock and the game.dll base can be replaced by tests, so offline tests can run the module against fake memory structures.
100function M.now() -- seconds; tests replace this
Ch. 10Table layouts read from assemblyThe globals, key tables and entry layouts of the health and visibility-mask systems, all read out of game.dll's assembly.
Ch. 7The same fingerprint, plus plate-to-mask mappingThe same 39 armour values recognise a Hive Lord; it also lists which model mask belongs to each plate, and the delay and retry limits.
126-- The Hive Lord's armour values (default zone, then zones 0..37) never change in a fight: our fingerprint.
Ch. 6Base + RVA, then validateRead the system's address from the game.dll base plus the RVA, and check the key table and capacity look sane; if not, do nothing.
140local function table_header(base_rva, keys_off, cap_off)
Ch. 16When it writesIf the sanity check fails (masks 32 and 33 must be hidden), nothing is written. Only when a plate has been destroyed for 1.5 s and both the base and applied masks still show it is the hide bit written; at most 3 tries, each logged.
292 local ok, done = pcall(MOM.register_option, OPTION_ID, {
293 type = 'toggle', mod = 'Hive Lord Plate Fix', label = 'Fix dead plates that stay on', default = true,
294 description = "A plate destroyed by damage your game did not resolve itself (e.g. a teammate's Eagle) loses its collision but can stay drawn, looking intact. When a plate has been at 0% for 1.5 s and is still drawn, hide it the way the game would have. Only changes what you see."})