BF2.US bf2-rsdeveloper wiki Parity Discord bf2.us
Battlefield Heroes
On this page

Heroes: the HUD, variable by variable

Heroes

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.

The screen, and who writes what (BFHeroes.exe 1.126) tickets and control points FriendlyTicketsString .. 0x004a7b84 the level arc and portrait XpBarValue 0x008ee699 event lines, kill messages the event line 0x008a1ee8 personal lines: happy, sad, level-up 0x00897644, 0x008977d3, 0x008a62e2 respawn countdown (when dead) TimeToSpawnString 0x004b10b2 health cross: hit points PlayerHealthString 0x008ee735 vehicle armor bar and number VehicleArmorString 0x008ee0c0 the item bar: 10 slots ItemSlot0..9 .. 0x008e4855 ammunition and reload PrimaryAmmoString 0x0090deb1 seat keys F1 F2 F3 (in a vehicle) OccupyingControl1..3 0x008efe3d A dead hero who follows a team mate sees that hero's health block and item bar in the same places.
Where things are on the screen, the variable behind each and the function of the original that writes it.

How the HUD is built#

  • The data is the install's own: the 39 files under HUD/HudSetup hold 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-client where the writer is Heroes' own, and in crates/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.
The verdicts

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 atVariableThe originalOursVerdict
the number at the health crossPlayerHealthString0x008ee735 (0x008ee960 to 0x008ee9a8): hit points: ceil(maximum x the stored ratio), cut, %iheroes_health_number in bf2-client hud_live.rsMENDED: the port printed Battlefield 2's percent (100 for every class) and now prints 80, 110 or 150
the health barPlayerHealthhit points over the maximum; 0 while a delayed death runsthe ratio; no zero in the delayed-death armDIFFERS: 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 barPlayerHealthExtra, PlayerHealthExtraShowhidden unless the armor's extra health is above 0 and the ratio above 0.99bfh-client player_hud.rs update_extra_healthSAME
the shield barExtraHealth, ExtraHealthActivea shield above 0: shown with the shield; else an unavailable time: hidden; else the player's effect timer: shown with its secondsplayer_hud.rs update_shield: the same four armsSAME
the +N at the crossPlayerAddedHealthString0x008ef3c8, event 0x63: +%i of the amount, a timer of 1.0AddedHealth126::eventSAME
the XP arc and the level digitXpBarValue, PlayerLevelString0x008ee699, 0x006e4992PlayerBlock126SAME

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.

PartVerdict
the health block of the followed hero, the arc offMENDED (heroes_player_block_not_alive; test heroes_followed_hero; played on a page)
ShowSpectatorInfo, ShowSpectatorMouseInstructionsMENDED with it
the followed hero's portrait under the spy glassMENDED 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 heroMENDED 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
IsSpectatorNOT WIRED: nothing differs for a playing hero
the VIP slot lineMENDED 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 atVariableThe originalVerdict
a slot's cooldown sweepItemSlot0..9ReloadValue1 less the item's reload value; a finished reload plays ReloadFinished. The bar has no cooldown number.SAME
an ability's duration barItemSlot0..9AbilityValuethe item's ability value; shown above 0 unless the ability's template hides itSAME
the count on a consumableItem0..9ConsumableNo%d of the player's count of that consumableSAME
the key on a slotItem0..9Indexthe key bound to weapon select and the slot's number plus 1SAME
reloading, in use, the blinkItemSlot0..9Reloading, ..Using, Item0..9BlinkColorShowreloading: 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-useSAME
the no-use markItem0..9NoUseIconbelowMENDED 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 without allowInParachute;
  • an enabled ability of his locks the weapon bar (the Overcharge does);
  • the template says disableOutsideVehicle and he is on foot, or disableInsideVehicle and 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#

VariableThe original (0x0090deb1)Verdict
PrimaryAmmoString%i of the rounds in the magazine; empty with endless ammunition; not written while a reload runsSAME
PrimaryAmmorounds over the magazine size; 1 when endlessSAME
PrimaryReloadTime1 less the reload value; shown strictly between 0 and 1SAME
AltAmmoString, AltAmmo, AltReloadTimethe alternate fire's, 0x0090cca7SAME
the crosshair and the hit marker0x0090b810: the marker's alpha is the local player's hit alphaSAME

The top of the screen#

VariableThe originalVerdict
FriendlyTicketsString, EnemyTicketsString0x004a7b84, 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 flagSAME
CtfTimeleftString, CtfScoreFriendlyStringthe same function's capture-the-flag arm: the clock, and x%i of the capturesSAME
FriendlyCPString, EnemyCPString0x004a7028: the control points of each team, counted only where a point can change teamSAME
the two capture bars at a control point0x004a75d9: the flag's height by the shown team and the ownerSAME
the low-ticket blink and its sound0x004a5ba6SAME
the seconds until a just-taken flag can be taken0x008a1492SAME

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#

LineThe originalVerdict
the happy and the sad personal line0x00897644, 0x008977d3: setting one clears the other; the sad line stays for the caller's time plus 0.7 sMENDED: the sad line now stays the 0.7 s longer; its timed scenario is written and not yet played
the level-up line0x008a62e2: the level-up text and the rank, 3.5 s, with the valor and hero points linesSAME
the healed linethe same function's case: "healed" with the healer's name, on the happy line for 2.0 sSAME
the +N over a target0x00911011: +%i of the slot's sum; points within the merge window add to the newest number of the same targetSAME for the text
the killed panel0x008a9653: the killer's name, his weapon's text, his health barSAME
the welcome message0x004a63caSAME
the important, help and special message lines0x0089723d, 0x00898033 (the tutorial mode only), 0x00897c19SAME for the setters
the missions' lines0x0089f89f: written only while a round is on and not in the start countdownMENDED, and played on a page with a hero who holds a mission; tutorial and missions
the mission message0x0089f57a: a queued message waits until play is onMENDED on its test; not played on a page
the in-game event line, the prestige level-up line0x008a315c, 0x008a1ee8SAME

The map's flags#

VariableThe originalVerdict
MapMinSize, MapBorderAlternateShowthe 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 barread in round 28SAME

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:

WhatThe original, as readState
the end-of-round card's lineseach 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 spawnone 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 popthe 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 linewritten 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 labelsHeroes' own text keysMENDED, on tests only: a demo's playback was not played
a chat line of a sender without a teamwhiteMENDED, on tests only
the purple points over a target in a damage fieldthe 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 paneltutorial and missionsNOT WIRED: the port has no tutorial manager and tasks; more than a mend
the centre info line's two timed textsHeroes' own keysMENDED; nothing changes on a screen (no node of version 1.126 shows the line)

What differs, filed and not mended:

WhatThe original, as readThe port
the picture that slides in while an ability is activethe original's component does nothing when its ability turns on or off (0x007e4bdc), and no statement posts the two HUD events the pictures' manager handlesthe 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 anotherthe 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 resultrefreshed while the result standsnot landed
a kill's assistersthe 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:

VerdictRowWhat a player meets
DIFFERSthe 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
DIFFERSthe add-friend result line at a round's startthe original's reset empties the line; the port leaves it for the rest of its 6 s. A corner
DIFFERSthe tutorial's running-away warningthe original takes the line off after 5 s (0x0093148c); in the port it stays once it fired
NOT WIREDthe tutorial's task progress, task complete and task description linesin basic training a hero sees no task text (tutorial and missions)
NOT WIREDIsSpectatornothing differs for a playing hero
NOT SETTLEDthe watched player's namethe callers of the HUD's slot were not found
NOT SETTLEDthe control point's message line
NOT SETTLEDthe name tag's prestige linename 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_time and 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#

WhatWhere
Heroes' own writerscrates/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 writerscrates/bf2-client/src/ (hud_live.rs, hud_writers.rs, hud_vehicle.rs, spawn_screen.rs, hud_hit.rs)
name tagscrates/bf2-hud/src/nametag/
how the HUD's files become a picturethe Flash layer

Notes: notes/bfheroes/hud_sweep.md, notes/bfheroes/screen_sweep.md, notes/bfheroes/hud.md. See also widgets, classes.

Source: docs/dev/heroes/hud.md · built from bf2-rs e3b4f05 · part of the Battlefield 2 / 2142 / Heroes reimplementation. Not affiliated with EA or DICE.