From 61e94826ea54ad60c88c2c4b42e7e2968b0744b9 Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Sun, 25 Aug 2024 17:18:17 +1000 Subject: [PATCH] server: don't report lag during intermission Some games do memory or cpu intensive things then. Signed-off-by: bones_was_here --- prvm_offsets.h | 2 ++ sv_main.c | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/prvm_offsets.h b/prvm_offsets.h index aea8da3e..aacadb39 100644 --- a/prvm_offsets.h +++ b/prvm_offsets.h @@ -478,6 +478,7 @@ PRVM_DECLARE_global(input_buttons) PRVM_DECLARE_global(input_movevalues) PRVM_DECLARE_global(input_timelength) PRVM_DECLARE_global(intermission) +PRVM_DECLARE_global(intermission_running) PRVM_DECLARE_global(killed_monsters) PRVM_DECLARE_global(mapname) PRVM_DECLARE_global(maxclients) @@ -818,6 +819,7 @@ PRVM_DECLARE_serverglobalfloat(force_retouch) PRVM_DECLARE_serverglobalfloat(found_secrets) PRVM_DECLARE_serverglobalfloat(frametime) PRVM_DECLARE_serverglobalfloat(gettaginfo_parent) +PRVM_DECLARE_serverglobalfloat(intermission_running) PRVM_DECLARE_serverglobalfloat(killed_monsters) PRVM_DECLARE_serverglobalfloat(parm1) PRVM_DECLARE_serverglobalfloat(parm2) diff --git a/sv_main.c b/sv_main.c index 7778f117..aff254e4 100644 --- a/sv_main.c +++ b/sv_main.c @@ -165,7 +165,7 @@ cvar_t sv_areadebug = {CF_SERVER, "sv_areadebug", "0", "disables physics culling cvar_t sys_ticrate = {CF_SERVER | CF_ARCHIVE, "sys_ticrate","0.01388889", "how long a server frame is in seconds, 0.05 is 20fps server rate, 0.1 is 10fps (can not be set higher than 0.1), 0 runs as many server frames as possible (makes games against bots a little smoother, overwhelms network players), 1/72 matches QuakeWorld physics"}; cvar_t sv_maxphysicsframesperserverframe = {CF_SERVER, "sv_maxphysicsframesperserverframe","10", "maximum number of physics frames per server frame"}; -cvar_t sv_lagreporting_always = {CF_SERVER, "sv_lagreporting_always", "0", "report lag even in singleplayer, listen, or an empty dedicated server"}; +cvar_t sv_lagreporting_always = {CF_SERVER, "sv_lagreporting_always", "0", "report lag even in singleplayer, listen, an empty dedicated server, or during intermission"}; cvar_t sv_lagreporting_strict = {CF_SERVER, "sv_lagreporting_strict", "0", "log any extra frames run to catch up after a holdup (only applies when sv_maxphysicsframesperserverframe > 1)"}; cvar_t sv_threaded = {CF_SERVER, "sv_threaded", "0", "enables a separate thread for server code, improving performance, especially when hosting a game while playing, EXPERIMENTAL, may be crashy"}; @@ -2545,12 +2545,16 @@ double SV_Frame(double time) if (!svs.threaded) { + prvm_prog_t *prog = SVVM_prog; + sv.perf_acc_sleeptime += host.sleeptime; sv.perf_acc_realtime += time; if (sv_lagreporting_always.integer) reporting = true; - else if (cls.state == ca_dedicated) + // bones_was_here: intermission_running isn't declared in dpdefs, but it's used by + // id1 Quake, all Quake mods (afaict), Nexuiz and Xonotic. + else if (cls.state == ca_dedicated && !PRVM_serverglobalfloat(intermission_running)) { // Report lag if there's players, so they know it wasn't the network or their machine for (i = 0; i < svs.maxclients; ++i) -- 2.39.2