On this page
The test rigs
"Does it behave like the original?" is not one question. Does this function give the same bits? Does this vehicle end the slalom in the same place? Does a round end when the tickets run out? Each has its own rig, and each rig has its own reference: the original's code, the original server, or the game's own data.
L1: the function oracle#
The oracle calls functions of the original executables in-process with crafted inputs and compares their outputs with our Rust for the same inputs, without running a game.
- A small 32-bit host maps one original image per process, at its link base when that range is free. No entry point and no static initialiser of the image runs.
- The image's imports are traps, except the C runtime it needs: a function that reaches for something the host did not give it fails its case instead of doing something.
- A case names the function's address, its calling convention as read from the listing (
thisinecx, stack words, a struct returned through a buffer, the custom register conventions of link-time code generation) and input vectors. The same vector goes to a generated Rust shim. - An access violation or a trap inside a call is a result (
fault <code> at <address>), and the host goes on with the next call.
python tools\retail_oracle\retail_oracle.py run [--case ID] [-v]
cargo test -p retail-oracle-rsA function with a passing oracle case counts as tested in the strict sense (parity numbers). The oracle suits pure functions best: arithmetic, curves, matrix products, the bit stream's primitives. It is how the float precision findings are held bit for bit.
Where a function cannot be called whole (it needs a live object graph), one statement of it can still be held: the original's instructions for that statement are run in a CPU emulator over generated inputs, once per x87 control word, and the test holds ours to those rows (for example 600 rows, 300 a control word, for one sum of Heroes' heightmap walk). Such a test says which statement its rows hold and that the function is not held whole.
L3: differentials against the original server#
The same inputs go to our server and to the original dedicated server, and the outputs are compared.
| Rig | Inputs | Compared | Reference |
|---|---|---|---|
| soldier movement | recorded player actions | the soldier's position, every tick | captures of 543 and 776 ticks |
| vehicle drive (the vehicle replay) | recorded driving: a slalom, a ram | every vehicle's node state, every tick | captures of 500 and 1,227 ticks |
| player action sweep | 519 cases of a kit, an item and an action | what the server sends back | the original server, side by side on 127.0.0.1 |
| game rules | headless players that play a script | scores, tickets, the round's end, squads, votes, teams, chat, awards | the original server |
The vehicle replay is the strictest of them: after a change to the physics, "the whole vehicle replay identical" means that not one float of one node moved in any tick of any capture. A change that is meant to move something says which rows moved and why.
L4: scenarios#
A scenario is a small file that starts a server on a level, adds headless players or real clients, plays a script (keys, waits, console commands) and asserts on what it finds: the server's state, a client's trace lines, a screenshot's pixels, the packets.
tools\scenarios\run.ps1 smoke -Parallel 3 -PortBase <base>
python tools\scenarios\scn.py run bfh_client_widget_sweepEvery scenario also runs the invariants, whatever it asserts itself: no panic, no hang, no unclassified error line, no correction storm, no pop in the sound, no sound that failed to resolve, the frame time and the tick rate within their limits.
| Suite | What | About |
|---|---|---|
smoke | 7 scenarios | 4 to 10 minutes; on every merge |
wall_a, wall_b | the regression wall: one scenario per fault that was once found in play | 11 minutes each |
actions | 21 kit tours | 12 minutes |
vehicles | 9 | 5 minutes |
hud, menus | 14 and 3 | 11 and 4 minutes |
full | everything | about an hour, three at a time |
A scenario can run its client as the desktop program or as the page in a headless browser, with the same script. That is how the browser client is held to the desktop's behaviour.
L5: sweeps#
Sweeps are generated, not written: every kit with every item and every action; every vehicle with every seat and every weapon; every HUD screen and menu; and the picture sweep, which replays a client's frames on a reference Direct3D 9 device and compares the pictures.
L2 and the floor#
- Static coverage asks whether every function of the original is ported (cited by address in the Rust), ruled out of scope, or library code. It has been complete for every binary since October 2026, which is why it stopped being a useful number and the parity count took its place.
- Wiring asks which of the cited functions really ran in play, on our client and, with a tracer, on the original server. A ported function that never runs is a function nobody has seen work.
L6: soak#
Bots that must keep fighting for 30 game minutes on a fast-forwarded server; rotations of levels with limits on what may grow per level, per round and per minute, beside the original server's memory over the same rotation.
Which rig for which question#
| You changed | Run |
|---|---|
| arithmetic in a ported function | its oracle case and its crate's tests, in both precisions |
| the soldier's or a vehicle's physics | the movement differential, the vehicle replay |
| a game rule, a score, a spawn | the gp_* differentials, the scenario of that rule |
| the network layout | the bit-stream and join tests of bf2-net |
| something a player sees or hears | a scenario with a client; the picture or the HUD sweep |
| the browser client | the same scenario as a page; the browser smoke |
Rules every check follows#
- 127.0.0.1 only, and our own servers only.
- Clients run off screen with injected input; every process ends within 5 minutes of wall time.
- The original client never runs as a program in a check: only its code, inside the oracle's host.
- A fix lands with a check that fails before it and passes after it; "matches the original" needs a check that runs.
- An expected failure is listed with the open row behind it, and the summary says when the entry can go.
Which rig a new port meets in which order: how a port is made.
Notes: notes/tracks/validation-quickref.md, notes/tracks/validation-strategy.md, notes/retail_oracle.md, notes/tracks/scenarios.md.
Each rig in depth: the oracle, scenarios, sweeps, the wall and soak.
How it is tested#
Each rig's reference is named in its table above. The vehicle replay's captures are fixed files: a physics change either leaves every float of every tick identical or says which rows moved and why.
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-net | the wire-compatible network protocol |
docs/dev/testing/rigs.md · built from bf2-rs e3b4f05 · part of the Battlefield 2 / 2142 / Heroes reimplementation. Not affiliated with EA or DICE.