Score replication: peers' scores now reach every pod (rank fix)

Field report (playtest night, voice channel): everyone's HUD showed
them in 1st place.  Root cause: the engine's score-replication
machinery was complete -- Player::WriteUpdateRecord ships currentScore,
the replicant ReadUpdateRecord applies it, CalcRanking sums every
scoring player -- but nothing marked the player's update record dirty
on a score change (the engine only ForceUpdates at mission end for the
fade sync).  Every peer's replicant player therefore stayed at score 0
and each machine ranked its own (only-nonzero) player first.

Fix: ForceUpdate() after every score application in the BTPlayer
handlers (main, inflicted, and the severed-vehicle branch) -- the
existing update-record path does the rest.

Verified 2-node (force-damage kill scoring): the victim's machine ranks
the killer's REPLICANT at its replicated score (24) above its own
master (0); standings consistent on both nodes.  BT_RANK_LOG=1 kept as
the 1 Hz per-player ranking dump.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
arcattack
2026-07-23 09:39:19 -05:00
co-authored by Claude Opus 4.8
parent c8cba8c764
commit 12a1fea823
3 changed files with 44 additions and 0 deletions
+18
View File
@@ -553,6 +553,19 @@ int
{
int num_players = 0;
Player *active_player;
// BT_RANK_LOG (score-replication fix verification): 1 Hz dump of every
// scoring player this node ranks, with instance + score.
int rank_log_this_pass = 0;
if (getenv("BT_RANK_LOG"))
{
static unsigned long s_rankLogAt = 0;
unsigned long now_ms = GetTickCount();
if (now_ms - s_rankLogAt > 1000)
{
s_rankLogAt = now_ms;
rank_log_this_pass = 1;
}
}
//
//-----------------------------------------------------
// Iterate through the players add to the sorted chain
@@ -564,6 +577,11 @@ int
{
if(active_player->IsScoringPlayer())
{
if (rank_log_this_pass)
DEBUG_STREAM << "[rank] player " << active_player->GetEntityID()
<< " inst=" << (int)active_player->GetInstance()
<< " score=" << (float)active_player->currentScore
<< std::endl << std::flush;
player_rank.AddValue(active_player, active_player->currentScore);
++num_players;
//