On this page
Heroes: the HUD, variable by variable
The Heroes HUD is data: 39 script files that bind text nodes, bars and pictures to named variables, and code that writes the variables every frame. To make the HUD right, each variable's writer in the original was read and laid beside ours. This page lists what a player looks at, who writes it, and where the port stands.
How the HUD is built#
- The data is the install's own: the 39 files under
HUD/HudSetuphold 1,626 binding lines, among them 153 variables of text nodes (setTextNodeStringVariable) and 38 of bar nodes (setBarNodeValueVariable), and several hundred show, picture, position, alpha and colour lines. - The registrations give each variable's name the member it stands for: the player and vehicle block (
BFHeroes.exe@bfh126!0x008ea5c1, 127 names), the weapon block (0x00908b2c, 166), the item bar's numbered families (0x008e4104), the score pop-ups (0x00910729) and the information layer's own (0x004a90e6, 391). - The writers are the functions below. Ours are in
crates/bfh-clientwhere the writer is Heroes' own, and incrates/bf2-client(hud_live.rs,hud_writers.rs,hud_vehicle.rs,spawn_screen.rs) where Heroes runs the writer it shares with Battlefield 2 or 2142.
SAME: the original's function was read (its stored decompiled text, the disassembly where that had lost the arguments) against ours' statements. MENDED: it differed and is mended in the tree. DIFFERS: filed, not mended. NOT WIRED: nothing of ours writes the name. NOT SETTLED: the original was not read far enough. The sweep began on 2026-11-27; after its round 30 (2026-11-28) it has 100 rows: 75 SAME, 15 MENDED, 3 DIFFERS, 4 NOT WIRED, 3 NOT SETTLED. What is open is gathered below.
The health block#
| The player looks at | Variable | The original | Ours | Verdict |
|---|---|---|---|---|
| the number at the health cross | PlayerHealthString | 0x008ee735 (0x008ee960 to 0x008ee9a8): hit points: ceil(maximum x the stored ratio), cut, %i | heroes_health_number in bf2-client hud_live.rs | MENDED: the port printed Battlefield 2's percent (100 for every class) and now prints 80, 110 or 150 |
| the health bar | PlayerHealth | hit points over the maximum; 0 while a delayed death runs | the ratio; no zero in the delayed-death arm | DIFFERS: during the delayed death of the two machine gun abilities the armor holds 1 hit point (0x0082898a), which ours shows as a sliver and the number 1 where the original shows an empty bar and 0 |
| the extra health bar | PlayerHealthExtra, PlayerHealthExtraShow | hidden unless the armor's extra health is above 0 and the ratio above 0.99 | bfh-client player_hud.rs update_extra_health | SAME |
| the shield bar | ExtraHealth, ExtraHealthActive | a shield above 0: shown with the shield; else an unavailable time: hidden; else the player's effect timer: shown with its seconds | player_hud.rs update_shield: the same four arms | SAME |
the +N at the cross | PlayerAddedHealthString | 0x008ef3c8, event 0x63: +%i of the amount, a timer of 1.0 | AddedHealth126::event | SAME |
| the XP arc and the level digit | XpBarValue, PlayerLevelString | 0x008ee699, 0x006e4992 | PlayerBlock126 | SAME |
In a vehicle the same holds for the armor: VehicleArmorString is hit points too (0x008ee0c0), mended the same way; the bar VehicleArmor is the ratio, SAME.
The followed hero's block#
When a hero dies and his camera follows a team mate, the original keeps the health block on and fills it with the followed hero's health, extra health and shield (0x008f075f: the health writer 0x008ee735 runs for the followed player's soldier), hides the level arc, and shows a spy glass with a mouse hint for six seconds.
| Part | Verdict |
|---|---|
| the health block of the followed hero, the arc off | MENDED (heroes_player_block_not_alive; test heroes_followed_hero; played on a page) |
ShowSpectatorInfo, ShowSpectatorMouseInstructions | MENDED with it |
| the followed hero's portrait under the spy glass | MENDED and played on a page: the original sets it on the picture node by name at the camera's change (0x00717f3d posts a HUD event, 0x008ef3c8 handles it), and the port does now |
| the ammunition panel of the followed hero | MENDED and played on a page: the original's weapon block runs for the followed hero's soldier (0x0091022a, the writer chain 0x0090fffd), and the port now takes this client's copy of his weapon: the dead hero's panel shows the mate's rounds. His second ammunition line (0x0090f0db) is ported on tests only |
IsSpectator | NOT WIRED: nothing differs for a playing hero |
| the VIP slot line | MENDED on the client: one of three texts for 4 seconds on an event of the server (0x008a62e2). It cannot be played: the port's server has no statement that sends the event |
The item bar#
The bar's frame update is 0x008e4855; ours is ItemBar::update in crates/bfh-client/src/hud.rs.
| The player looks at | Variable | The original | Verdict |
|---|---|---|---|
| a slot's cooldown sweep | ItemSlot0..9ReloadValue | 1 less the item's reload value; a finished reload plays ReloadFinished. The bar has no cooldown number. | SAME |
| an ability's duration bar | ItemSlot0..9AbilityValue | the item's ability value; shown above 0 unless the ability's template hides it | SAME |
| the count on a consumable | Item0..9ConsumableNo | %d of the player's count of that consumable | SAME |
| the key on a slot | Item0..9Index | the key bound to weapon select and the slot's number plus 1 | SAME |
| reloading, in use, the blink | ItemSlot0..9Reloading, ..Using, Item0..9BlinkColorShow | reloading: the value strictly between 0 and 1; in use: an ability item whose active byte is set; five blinks from the frame a slot stops being no-use | SAME |
| the no-use mark | Item0..9NoUseIcon | below | MENDED in part |
The no-use marks#
The original crosses a slot out when any of these holds:
- the hero swims and the item's template has no
allowInWater; - he sky dives without
allowInSkyDive, or hangs under a parachute withoutallowInParachute; - an enabled ability of his locks the weapon bar (the Overcharge does);
- the template says
disableOutsideVehicleand he is on foot, ordisableInsideVehicleand he sits in a seat; - the slot reloads, or the item is not selectable.
The port marked a slot only when the item was not selectable or reloading. The original's tests are ported (slot_no_use) and were played for the water: swimming, the knife, the rifle, the Rocket Jump and the TNT carry the cross and the Bandage, whose template has allowInWater 1, carries none. Left open: a ladder, a closed seat and the parachute were not played; the followed hero's bar of a dead player; and one word of the soldier's interface that is not named yet.
The ammunition#
| Variable | The original (0x0090deb1) | Verdict |
|---|---|---|
PrimaryAmmoString | %i of the rounds in the magazine; empty with endless ammunition; not written while a reload runs | SAME |
PrimaryAmmo | rounds over the magazine size; 1 when endless | SAME |
PrimaryReloadTime | 1 less the reload value; shown strictly between 0 and 1 | SAME |
AltAmmoString, AltAmmo, AltReloadTime | the alternate fire's, 0x0090cca7 | SAME |
| the crosshair and the hit marker | 0x0090b810: the marker's alpha is the local player's hit alpha | SAME |
The top of the screen#
| Variable | The original | Verdict |
|---|---|---|
FriendlyTicketsString, EnemyTicketsString | 0x004a7b84, by the game mode: a clock %02d:%02d of the tickets on the mode that counts time, plain numbers on team deathmatch, cleared on capture the flag | SAME |
CtfTimeleftString, CtfScoreFriendlyString | the same function's capture-the-flag arm: the clock, and x%i of the captures | SAME |
FriendlyCPString, EnemyCPString | 0x004a7028: the control points of each team, counted only where a point can change team | SAME |
| the two capture bars at a control point | 0x004a75d9: the flag's height by the shown team and the owner | SAME |
| the low-ticket blink and its sound | 0x004a5ba6 | SAME |
| the seconds until a just-taken flag can be taken | 0x008a1492 | SAME |
The respawn countdown#
TimeToSpawnString is written by the layer's update (0x004b10b2, 0x004b1580 to 0x004b1660): the text "time to respawn" and ceil of the player's time, held to 0..1000. It is written only off the round's end screen, while no team is out of tickets and the round is not over. The port held the number to Battlefield 2's 0..120 and rewrote it in every frame. MENDED (heroes_time_to_respawn in bf2-client spawn_screen.rs, test program heroes_respawn_countdown) and played: with a spawn time of 150 s the dead panel reads 150 and counts down.
The message lines#
| Line | The original | Verdict |
|---|---|---|
| the happy and the sad personal line | 0x00897644, 0x008977d3: setting one clears the other; the sad line stays for the caller's time plus 0.7 s | MENDED: the sad line now stays the 0.7 s longer; its timed scenario is written and not yet played |
| the level-up line | 0x008a62e2: the level-up text and the rank, 3.5 s, with the valor and hero points lines | SAME |
| the healed line | the same function's case: "healed" with the healer's name, on the happy line for 2.0 s | SAME |
the +N over a target | 0x00911011: +%i of the slot's sum; points within the merge window add to the newest number of the same target | SAME for the text |
| the killed panel | 0x008a9653: the killer's name, his weapon's text, his health bar | SAME |
| the welcome message | 0x004a63ca | SAME |
| the important, help and special message lines | 0x0089723d, 0x00898033 (the tutorial mode only), 0x00897c19 | SAME for the setters |
| the missions' lines | 0x0089f89f: written only while a round is on and not in the start countdown | MENDED, and played on a page with a hero who holds a mission; tutorial and missions |
| the mission message | 0x0089f57a: a queued message waits until play is on | MENDED on its test; not played on a page |
| the in-game event line, the prestige level-up line | 0x008a315c, 0x008a1ee8 | SAME |
The map's flags#
| Variable | The original | Verdict |
|---|---|---|
MapMinSize, MapBorderAlternateShow | the layer's update (0x004b10b2) asks the map node whether it is small (0x00916f0d: small unless one of three mode bytes is set and its transition is done) | MENDED behind Heroes' switch, on its test; not played on a page |
UsingChildHud, the bottom right panel's slide and fade, XpBarOuterValue, the scan bar | read in round 28 | SAME |
Name tags#
The bar over a hero's head is drawn by the renderer (RendDX9.dll 1.126 0x1020535a): the bar's value is ((end - start) x ratio + start) / width of its atlas entry. SAME for a player's tag (crates/bf2-hud/src/nametag/draw.rs). The level line is SAME; the prestige line is read in outline only.
The screens around the game#
A second sweep, with a page of its own (the screens around the game), read what a hero sees around the play itself: the scoreboard, the kill messages and the killed panel, the points shown in game, the round's start and end, the chat's lines (2026-11-27; its state here is that of its round 40, 2026-11-28: 78 rows, 60 SAME, 13 DIFFERS, 4 NOT WIRED, one another sweep's).
Mended since the sweep began, each with a test that was red before and one mutation caught:
| What | The original, as read | State |
|---|---|---|
| the end-of-round card's lines | each team's players sorted by score (0x00528d2f) | MENDED and played on a page: the card lists by score where it listed by joining order |
| capture the flag, the line at the spawn | one of three lines: the enemy carries our flag, we carry theirs, nobody carries one (0x008a2203) | MENDED and played on a page ("Go capture the enemy Flag!" under the flags' counters) |
| the XP booster's pop | the points times the boosters' factor, cut toward zero (0x006e607c) | MENDED and played on a page: +5 for 10 points at a factor of 0.5 where ours popped +10 |
| the pre-game line | written only in the start delay and in the round itself (0x004a5b6e) | MENDED; its change is one frame's write and owes no play |
| a demo's key labels | Heroes' own text keys | MENDED, on tests only: a demo's playback was not played |
| a chat line of a sender without a team | white | MENDED, on tests only |
| the purple points over a target in a damage field | the factor over the fields that hold the target's player; a field counts only once it is active (0x0078cf65) | MENDED on tests; not seen on a page (its scenario is written and was not played) |
| basic training's task panel | tutorial and missions | NOT WIRED: the port has no tutorial manager and tasks; more than a mend |
| the centre info line's two timed texts | Heroes' own keys | MENDED; nothing changes on a screen (no node of version 1.126 shows the line) |
What differs, filed and not mended:
| What | The original, as read | The port |
|---|---|---|
| the picture that slides in while an ability is active | the original's component does nothing when its ability turns on or off (0x007e4bdc), and no statement posts the two HUD events the pictures' manager handles | the port posts the two events itself and shows the picture. One shipped ability has the component. No mend is written: whether the picture goes is the owner's call |
| the change from one screen to another | the lists of flags each screen writes (0x008e6a5d, read whole) | the same for most screens; four things differ (the missions' list flag, three flags the round's end hides, the two spawn sub-screens' lists, one screen that writes nothing). The mend is written, not built. Not read: whether a hero reaches those sub-screens at all |
| the list of killed heroes under the round's result | refreshed while the result stands | not landed |
| a kill's assisters | the server gives each assister of a kill one kill in the scoreboard's kills column and tells his client (0x00753ebe); his HUD adds the row "Assist Kill" with the victim's portrait (0x008a9653) | the server runs Battlefield 2's loop alone, and the client has no case for the event: no row, no kill for the assister. Open: whether the port takes it waits for the owner's word. |
What the original does not show, read so that nobody ports it by mistake:
- No kill feed line for everyone. The texts are built and handed to a function that only frees them (
0x00930032). - No line in words for a kill, an assist, a heal, a repair, a capture or a defence: all 37 calls of the line's setter pass the flag that leaves it out.
- No level and no ping in a scoreboard row, and no totals rows.
- No "has left the game" line.
Of the 251 text keys the original's code references, 34 are named by no source file of the port; the sweep lists them (the lines above among them), and for texts no further key of the original is missing.
What is open today#
The HUD sweep's rows that are not SAME or MENDED, after its round 30:
| Verdict | Row | What a player meets |
|---|---|---|
| DIFFERS | the health bar during a delayed death (the two machine gun abilities) | the original empties the bar and prints 0; the port shows a sliver and the number 1 |
| DIFFERS | the add-friend result line at a round's start | the original's reset empties the line; the port leaves it for the rest of its 6 s. A corner |
| DIFFERS | the tutorial's running-away warning | the original takes the line off after 5 s (0x0093148c); in the port it stays once it fired |
| NOT WIRED | the tutorial's task progress, task complete and task description lines | in basic training a hero sees no task text (tutorial and missions) |
| NOT WIRED | IsSpectator | nothing differs for a playing hero |
| NOT SETTLED | the watched player's name | the callers of the HUD's slot were not found |
| NOT SETTLED | the control point's message line | |
| NOT SETTLED | the name tag's prestige line | name tags |
Mended on tests and not yet played on a page, by the sweep's last round: the mission message's step, the map's small-size flag, the players' lives at a heat's turns in team elimination, the bookmark line in the tutorial, the followed hero's second ammunition line. Other rows on this page that say DIFFERS are the screen sweep's (below) or a part of a mended row.
What is not read yet#
Most of the remaining text variables (pop-ups among them; the missions' lines and the event line are read now), two bars, the blink flags of health, armor and ammunition, most show, picture and colour variables, the scoreboard's rows, the minimap, and what each writer is handed by the network state behind it.
How it is tested#
- A test from the address for every mend. Each MENDED row above names its test program (
heroes_followed_hero,heroes_slot_no_use,heroes_respawn_countdown,heroes_sad_line_timeand the others). Each ran in a Heroes process, was red before the mend and green behind it, and one mutation of the mend was caught. - The client's frame door (
crates/bf2-client/tests/it_bfh/app_frame_door_bfh126.rs): the application's own per-frame HUD pieces called as the app calls them: the watched hero's portrait under the spy glass, a dead hero's weapon block reading the followed hero's soldier. - Played on a page: where a row says "seen on a page", a scenario ran the browser client, read a screenshot, and was run again on a page built from the commit before the mend, where it had to fail on that row alone.
- SAME rows rest on a read of the original's function against the port's statements. A read is not a test: such a row is in no strict number until one stands (feature checklists).
42 of this page's 55 addresses stand in a test's own text.
In the code#
| What | Where |
|---|---|
| Heroes' own writers | crates/bfh-client/src/ (hud.rs, player_hud.rs, weapon_hud.rs, tickets.rs, ctf.rs, cdm.rs, killed.rs, level_up.rs, scorings.rs) |
| the shared writers | crates/bf2-client/src/ (hud_live.rs, hud_writers.rs, hud_vehicle.rs, spawn_screen.rs, hud_hit.rs) |
| name tags | crates/bf2-hud/src/nametag/ |
| how the HUD's files become a picture | the Flash layer |
Notes: notes/bfheroes/hud_sweep.md, notes/bfheroes/screen_sweep.md, notes/bfheroes/hud.md. See also widgets, classes.
docs/dev/heroes/hud.md · built from bf2-rs e3b4f05 · part of the Battlefield 2 / 2142 / Heroes reimplementation. Not affiliated with EA or DICE.