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

Questions people ask

BF22142Heroes

Short answers, each with the page that has the long one.

About the project#

What is this? A rewrite in Rust of the engine behind Battlefield 2, Battlefield 2142 and Battlefield Heroes: one server program and one client program that run all three games from the games' own data. It is made by reading the original programs function by function and writing each again, with tests that hold the new code to the old behaviour.

Do I need the games? Yes. The tree holds code, scripts and notes only. Levels, models, sounds and scripts are read from your own install where it lies, and are never copied into the tree or changed. See build and run.

Is it an emulator or a mod? Neither. The original programs do not run when you play. Their code is used in tests only: single functions are called in a small host or a CPU emulator to get the expected answers (test rigs).

Why three games in one program? 2142 and Heroes were built from Battlefield 2's source. Most of the engine is the same, and where a game differs the code has a branch with that game's own address beside it. The pages mark it with the game badges at the top and coloured boxes for what is one game's own. See what the three games share and the glossary.

How close is it?#

How do you know it behaves like the original? By layers of checks: functions compared bit for bit with the original's own code, recorded input replayed against the original server tick by tick, and scenarios that play the game and assert on what a player sees. How a port is made walks through them.

What do the percentages mean? There are two per game. The strict one counts functions for which somebody wrote a test from the original's code; the generous one counts any proof, down to "it ran in a scenario that passed". Read the strict one first. Parity has the numbers and the classes.

What is a "filed difference"? A place where the port is known to do something else than the original, written down with what the original does and what a player would notice. It is a debt with a description, not a secret. Some are deliberate (a fix the original lacked), most are waiting for their turn.

What does "a reading" mean? That somebody read the original's listing and wrote down what the function does, and no check holds it yet. A reading can be wrong. The wiki never presents one as a fact; see reading the notes.

Why does bit-exact matter? Nobody sees the last bit of a float. The client predicts your own movement and the server corrects it. If the two compute a different last bit, the difference grows over a few ticks into a visible pull. So the physics is ported at the exact precision each program runs at. See the prediction walkthrough and float precision.

What works#

Can I play a round? Yes: join, spawn, fight on foot and in vehicles, capture flags, finish the round. Battlefield 2 is the oldest and most complete port. 2142 (conquest, co-op and Titan) and Heroes (its modes, classes and abilities) are younger and have more open rows. Each area's pages say what is ported, what is tested and what is open.

Are there bots? Battlefield 2's and 2142's co-op bots are ported from the original's AI library (2142's are rated partial in the notes). Heroes never had bots; the port adds them with the same AI, which is an addition and marked so. See bots.

Which game modes? Conquest and co-op, 2142's Titan, and Heroes' team deathmatch, capture the flag, the hill and team elimination: game modes.

Does the HUD look and behave like the original's? It is built from the same data by the same rules: the game's own HUD scripts make the nodes, and ported functions write the variables. The HUD of Battlefield 2, of 2142 and of Heroes each have a map you can point at.

Does it run in a browser? The client also builds for the browser, with the same code and the same scenarios run against the page. The build table says what that needs.

In Heroes, why do the tickets not fall when I hold every flag? Because the original's team deathmatch does not bleed tickets by flags on levels where each team has a base that cannot be taken: only deaths cost tickets. Game modes has the rule, and Heroes: questions more of this kind (hit points, speed, abilities).

Building and reading#

How do I build it? Build and run is the short way for a server and a client. The full table of programs, what each needs and how each is built is the file docs/release/BUILDING.md in the tree.

Where is what in the tree? docs/release/LAYOUT.md has one line for every top-level folder, every tool folder and every crate, and a test keeps it true.

Where do I look when a page is not enough? In the notes the page names on its last line. Reading the notes explains their layout and words.

What do the addresses mean? bf2_w32ded.exe!0x00557270 is a function of the original program at that address. They are the project's footnotes: every claim about the original points at the code it was read from.

Can I use the 3D viewer and the interactive pieces offline? Yes. They are plain JavaScript in the page, load nothing from elsewhere, and the one mesh the viewer shows is a shape made by the wiki's own script, not a game file.

Helping#

How can I help? Pick a function the count lists as not tested, read it, write a test from its address, and show the test red once. Or play, and report what differs from the original with the level, what you did and what you saw. How a port is made has the steps; parity says how to move a number.

I found a statement on a page that is wrong. Then the page is wrong, not the game. Every statement here should trace to a note with its evidence; one that does not is a fault of the wiki. Tell us which page and which sentence.

How it is tested#

This page explains; it holds no code of its own. Every answer points at the page that carries its evidence. The section "What works" is hand-written and can lag: the port's status and the three "today" pages are made by the build from the project's own records and are the ones to trust when the two differ. The wiki's test checks that every link and anchor on it leads to a page of the build and that its diagrams are the ones the script draws.

In the code#

This page names no crate of its own. How the codebase is organised maps the crates by area, and docs/release/LAYOUT.md in the tree has one line for every folder and crate.

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