diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 2a03e3231..4b5eb2f93 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -6924,6 +6924,28 @@ static void Command_Staffsync(void) CONS_Printf("\n"); + CONS_Printf(" %d syncs (%d error)\n", result->numerror, result->totalerror/FRACUNIT); + + CONS_Printf(" presync: "); + + for (UINT32 j = 0; j < PRNUMSYNCED; j++) + { + if (result->rngerror_presync[j] > 0) + CONS_Printf("%s %d ", rng_class_names[j], result->rngerror_presync[j]); + } + + CONS_Printf("\n"); + + CONS_Printf(" postsync: "); + + for (UINT32 j = 0; j < PRNUMSYNCED; j++) + { + if (result->rngerror_postsync[j] > 0) + CONS_Printf("%s %d ", rng_class_names[j], result->rngerror_postsync[j]); + } + + CONS_Printf("\n"); + i++; } diff --git a/src/doomstat.h b/src/doomstat.h index 42d7b07e5..38f814d00 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -245,6 +245,10 @@ struct staffsync_t char name[MAXPLAYERNAME+1]; UINT32 reason; UINT32 extra; + fixed_t totalerror; + UINT32 numerror; + UINT32 rngerror_presync[32]; + UINT32 rngerror_postsync[32]; }; extern staffsync_t staffsync_results[1024]; diff --git a/src/g_demo.cpp b/src/g_demo.cpp index 7ecc422b6..2f9c64626 100644 --- a/src/g_demo.cpp +++ b/src/g_demo.cpp @@ -505,11 +505,19 @@ void G_ReadDemoExtraData(void) { P_SetRandSeed(static_cast(i), rng); + if (staffsync) + { + if (demosynced) + staffsync_results[staffsync_failed].rngerror_presync[i]++; + else + staffsync_results[staffsync_failed].rngerror_postsync[i]++; + } + if (demosynced) { if (G_FailStaffSync(SYNC_RNG, i)) { - CONS_Alert(CONS_WARNING, "Demo playback has desynced (RNG class %d)!\n", i); + CONS_Alert(CONS_WARNING, "Demo playback has desynced (RNG class %d - %s)!\n", i, rng_class_names[i]); storesynced = false; } } @@ -1268,6 +1276,12 @@ void G_ConsGhostTic(INT32 playernum) } demosynced = false; + if (staffsync) + { + staffsync_results[staffsync_failed].numerror++; + staffsync_results[staffsync_failed].totalerror += abs(testmo->x - oldghost[playernum].x) + abs(testmo->y - oldghost[playernum].y) + abs(testmo->z - oldghost[playernum].z); + } + P_UnsetThingPosition(testmo); testmo->x = oldghost[playernum].x; testmo->y = oldghost[playernum].y; diff --git a/src/g_game.c b/src/g_game.c index b329f0a6b..c7bba11ae 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1885,7 +1885,7 @@ void G_Ticker(boolean run) P_MapStart(); - if (demo.playback && staffsync && !demosynced) + if (demo.playback && staffsync && !demosynced && false) // We want to assess the magnitude of position desync, don't bail early! { G_ClearRetryFlag(); G_StopDemo(); diff --git a/src/k_hud.cpp b/src/k_hud.cpp index e28f780a9..c7c8953ac 100644 --- a/src/k_hud.cpp +++ b/src/k_hud.cpp @@ -7768,7 +7768,7 @@ void K_drawKartHUD(void) return; } - if (staffsync) + if (staffsync && staffsync_total) { V_DrawFadeScreen(31, 8); V_DrawCenteredGamemodeString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 - 30, 0, 0, "Staff Ghost Sync Test"); diff --git a/src/m_random.c b/src/m_random.c index 8737c7cdc..035a92dfa 100644 --- a/src/m_random.c +++ b/src/m_random.c @@ -21,7 +21,42 @@ #include "m_random.h" #include "m_fixed.h" - +char rng_class_names[34][30] = { + "UNDEFINED", + "EXECUTOR", + "ACS", + "DECORATION", + "TERRAIN", + "BUBBLE", + "RANDOMANIM", + "PLAYERSTARTS", + "VOICES", + "RANDOMSKIN", + "RANDOMAUDIENCE", + "RULESCRAMBLE", + "MUSICSELECT", + "ITEM_ROULETTE", + "ITEM_RINGS", + "ITEM_SHRINK", + "ITEM_BUBBLE", + "ITEM_DEBRIS", + "ITEM_BOOST", + "EXPLOSION", + "SMOLDERING", + "SPARKLE", + "MOVINGTARGET", + "TRACKHAZARDD", + "BATTLEUFO", + "BOTS", + "AUTOROULETTE", + "FUZZ", + "FROSTTHROWERS", + "ITEM_SPAWNER", + "TEAMS", + "DUMMY", + "INTERPHUDRANDOM", + "NUISANCE" +}; // --------------------------- // RNG functions (not synched) diff --git a/src/m_random.h b/src/m_random.h index 934880e0a..4e0502623 100644 --- a/src/m_random.h +++ b/src/m_random.h @@ -103,6 +103,7 @@ typedef enum PRNUMCLASS } pr_class_t; +extern char rng_class_names[34][30]; // M_Random functions pull random numbers of various types that aren't network synced. // P_Random functions pulls random bytes from a PRNG that is network synced.