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

Battlefield Heroes

Heroes

Battlefield Heroes is a descendant of the 2142 code (its binary still embeds the 2142 source tree paths). bf2-rs runs it as the 2142 engine generation plus a product axis: Product::Heroes, chosen by a data root with mods/bfheroes, with the Heroes-only systems in the bfh-* crates.

At a glance#

Data rootmods/bfheroes (client 1.126 data; 1.89 kept for comparisons)
Original binariesBFHeroes.exe (citations BFHeroes.exe@bfh126!0x... for 1.126, BFHeroes.exe!0x... for 1.89), RendDX9.dll@bfh126, SwiffPlayer.dll@bfh126, SoundEngine.dll
Game modesgpm_cq (conquest), gpm_ctf (capture the flag), gpm_cdm, gpm_hoth, gpm_tut (tutorial) in mods/bfheroes/python/game/gamemodes/
Python75 host functions, 24 host.Object methods, 86 events (reference)
OnlineEA Plasma: FESL (login, personas, store), Theater (game lobby), Magma (web API), reimplemented in crates/bf2-backend
Playthe browser player at bf2.us/play/heroes with the account site at bf2.us/heroes

What Heroes adds#

  • Heroes and classes: soldier, gunner, commando per faction (Royal, National), with appearance items and a hero level. The server keeps per-hero data through pmgr_p_getXData / pmgr_p_setXData.
  • Abilities: class abilities with cooldowns and levels; the ActivateAbility, Shield, Stomp, MarkTarget events, obj.soldier_getParam / soldier_setParam, and the extra attackerActiveAbility argument of PlayerKilled.
  • XP, valor and prestige: pmgr_p_giveXP, pers_getPrestigePointsNeeded, sgl_sendPrestigeLevelEvent, the PlayerXP, AwardValorPoints, AwardPrestigePoints* events; ELO helpers pers_eloGet* for ranked play.
  • Store and customisation: custo_listItems, store items as templates, item effects on stats.
  • No commander and no squads UI; simpler vehicles; cartoon rendering (outlines, toon lighting).

How it is tested#

Heroes cannot be compared with a running original server, so its proofs are of three kinds: a test written from the original's listing in a Heroes process (red before a mend, one mutation caught), an oracle or emulator row where one function or one statement of the original's machine code can be run alone, and a played scenario with a picture read. What each feature has of those, line by line, is on the feature checklists; Heroes today says what a player meets.

In the code#

WhatWhere
Host tables (functions, object methods, events, with addresses)crates/bfh-server/src/tables.rs
Heroes host functionscrates/bfh-server/src/lib.rs (call_shared, object_call)
Data, templates, console additionscrates/bfh-data
Game rules (abilities, XP, rounds)crates/bfh-game, crates/bf2-server hooks
Client, UIcrates/bfh-client, crates/bfh-ui
Notesnotes/bfheroes/ (README.md charter, abilities.md, python.md, templates.md, gamemodes.md, levels.md)
Paritythe parity dashboard

In depth#

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