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

Battlefield 2

BF2

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 rootmods/bf2 (Special Forces: mods/xpack)
Original binariesBF2.exe, bf2_w32ded.exe, RendDX9.dll, BF2Audio.dll, AIDLL.dll (citations BF2.exe!0x..., bf2_w32ded.exe!0x...)
Game modesgpm_cq (conquest), gpm_coop (co-op with bots); scripts in mods/bf2/python/game/gamemodes/
Python53 host functions, 16 host.Object methods, 42 events (reference)
OnlineGameSpy (gone); bf2-rs ships its own backend (crates/bf2-backend) for accounts, server lists and stats
Play in the browserthe 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_setEnableCommander and the ChangedCommander / ChangedSquadLeader events.
  • Kits: seven kits per side, chosen per level with gameLogic.setKit in the level's Init.con.
  • Ranks and unlocks (online): scored by the stats scripts in python/bf2/stats/; the unlock list goes through pers_plrSetUnlocks.
  • Grappling hooks and zip lines (Special Forces): the DeployGrapplingHook, DeployZipLine and DeployTactical events, which 2142 dropped.

Where to start#

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):

CrateWhat it is
crates/bf2-backendPROGRAM bf2_backend: master, server list, login and stats on one host; its deploy files and the site's pages are under deploy/
Source: docs/dev/games/bf2.md · built from bf2-rs e3b4f05 · part of the Battlefield 2 / 2142 / Heroes reimplementation. Not affiliated with EA or DICE.