Counts a real client's prediction misses while it moves, jumps and fires.
python3 scripts/prediction_test.py /path/to/CoD2 --protocol {115|118} [--binary PATH] [--server PATH] [--max-misses N] [--max-anim-misses N] [--moves CFG] [--spot 'X Y Z YAW'] [--delay MS] [--maxfps N] [--wine CMD]
Runs the dedicated server with scripts/contact_test.py's mod and a minimal
client as its target, and a real client (cod2_linux, held at 20 fps) as the
second player, which the mod puts in front of a ledge (--spot, by rcon) and a
config file drives: it mantles onto the ledge, turns away from the target,
walks forward, crouches and goes prone twice leaning right, walks back and to
both sides, crouches, goes prone, stands, jumps
and fires its rifle, fires, reloads and switches to its thompson and back
during the drop, then aims down its sight and back twice. It keeps away from
the target: the client clips against
other players with a box one unit smaller on each side than the server's (as
the original does), so running into one misses by design.
With each snapshot the client predicts its moves again from the server's
playerstate, with its own bgame, and compares the result with what it had
predicted for the same time; with cg_showmiss 1 it prints, as 1.3,
"Prediction miss: <distance>" when they
differ by more than 0.1. Prints the number of misses and their total and
largest distance, and exits with 0 when the client still runs, walked over
300 units (as the target sees it), left no crash report, and the misses are
at most --max-misses (60). With COD2_TRACE_PREDANIM the client also prints
"Prediction anim miss" when the moves predicted again give other legs or
torso animations than it had predicted (with the origin's miss); those must
be at most --max-anim-misses (6). They come from what the client cannot
predict, not from its animation script (scripts/anim_script_test.py
compares that with the server's): the weapon the mod gives at spawn, and the
MOVETYPE condition the landing event reads, which lives outside the
playerstate and is not set back when the moves are predicted again (3 or 4
per run, all with no origin miss). With COD2_TRACE_PREDDIFF=all the client
prints every playerstate field it predicted otherwise than the server; the
sight's fraction (fWeaponPosFrac) must match it (--max-ads-misses, 0), and so must
the weapon's state (weaponTime, weaponDelay, weapon, weaponstate) through a
fast reload, a shot cut by a reload and a switch to its thompson and back
during the drop, which a Plus server plays by its own rules (--max-weapon-misses,
0, leaving out the weapon the mod gives at spawn), and its lean going prone while leaning
(--max-lean-misses, 0). --delay MS puts a UDP relay between the
client and the server that holds each packet MS milliseconds each way (a
ping of twice that, as online); --maxfps sets the client's com_maxfps
(default 20). --wine CMD runs a Windows client given with --binary, our
cod2_win32.exe or 1.3's CoD2MP_s.exe as a baseline (copy it with its DLLs
off a Windows drive: Wine cannot map mss32.dll from DrvFs), and reads its
console_mp.log. The client opens a window and needs a CD key in
~/.cod2/preferences; without one the test is skipped (exit 0).