Battlefield 2
Battlefield 2 (2005, final patch 1.50) is the reference game: bf2-rs started with it, and most
subsystems were first reverse engineered from bf2_w32ded.exe (the dedicated server) and
BF2.exe.
At a glance#
| Data root | mods/bf2 (Special Forces: mods/xpack) |
| Original binaries | BF2.exe, bf2_w32ded.exe, RendDX9.dll, BF2Audio.dll, AIDLL.dll (citations BF2.exe!0x..., bf2_w32ded.exe!0x...) |
| Game modes | gpm_cq (conquest), gpm_coop (co-op with bots); scripts in mods/bf2/python/game/gamemodes/ |
| Python | 53 host functions, 16 host.Object methods, 42 events (reference) |
| Online | GameSpy (gone); bf2-rs ships its own backend (crates/bf2-backend) for accounts, server lists and stats |
| Play in the browser | the BF2 browser build on bf2.us/play |
What is special about BF2#
- Commander and squads: commander assets (artillery, UAV, supply drops), squad leaders, spawning on the squad leader. Python sees them through
pmgr_getCommander,sh_setEnableCommanderand theChangedCommander/ChangedSquadLeaderevents. - Kits: seven kits per side, chosen per level with
gameLogic.setKitin the level'sInit.con. - Ranks and unlocks (online): scored by the stats scripts in
python/bf2/stats/; the unlock list goes throughpers_plrSetUnlocks. - Grappling hooks and zip lines (Special Forces): the
DeployGrapplingHook,DeployZipLineandDeployTacticalevents, which 2142 dropped.
Where to start#
- Engine overview for the systems.
- Add a vehicle and add a weapon use BF2's HMMWV and M16A2.
- Run a server and join it: the codebase and
notes/play-guide.md. - In the wiki: the HUD of Battlefield 2, bots, game modes.
- Facts about the original:
notes/subsystems/*.md(written from BF2 1.50), the data tables inre/data/.
How it is tested#
Battlefield 2 is the game the original server can be run beside the port for, so it has every kind of proof (test rigs): the function oracle, the differentials against the original server (soldier movement, the vehicle replay, 519 player actions, the game rules), and scenarios. In numbers it has the largest share of functions held by a test of their own (parity, the port's status). Battlefield 2 today says what a player meets.
In the code#
The crates this page names, each with its line of docs/release/LAYOUT.md (the list is gathered by the wiki's build from the page itself):
| Crate | What it is |
|---|---|
crates/bf2-backend | PROGRAM bf2_backend: master, server list, login and stats on one host; its deploy files and the site's pages are under deploy/ |
docs/dev/games/bf2.md · built from bf2-rs e3b4f05 · part of the Battlefield 2 / 2142 / Heroes reimplementation. Not affiliated with EA or DICE.