From 712073c2b82a8d7289ced8b7cf16535b6c5550b4 Mon Sep 17 00:00:00 2001 From: havoc Date: Sun, 28 May 2006 01:26:06 +0000 Subject: [PATCH] added sv_clmovement_* cvars to disable movement prediction of players, or disable it only when their ping is below a certain value (by default 100ms) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6398 d7cf8633-e32d-0410-b094-e92efae38249 --- server.h | 3 +++ sv_main.c | 8 ++++++++ sv_user.c | 9 +++++++++ todo | 4 ++-- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/server.h b/server.h index c403d060..d2e6c303 100644 --- a/server.h +++ b/server.h @@ -135,6 +135,9 @@ typedef struct client_s #endif // LordHavoc: can be used for prediction or whatever... float ping; + + // this is used by sv_clmovement_minping code + double clmovement_disable_minpingtimeout; // spawn parms are carried from level to level float spawn_parms[NUM_SPAWN_PARMS]; diff --git a/sv_main.c b/sv_main.c index 9463489c..5b8b7c4b 100644 --- a/sv_main.c +++ b/sv_main.c @@ -53,6 +53,11 @@ cvar_t sv_gameplayfix_qwplayerphysics = {0, "sv_gameplayfix_qwplayerphysics", "1 cvar_t sv_progs = {0, "sv_progs", "progs.dat", "selects which quakec progs.dat file to run" }; +// TODO: move these cvars here +extern cvar_t sv_clmovement_enable; +extern cvar_t sv_clmovement_minping; +extern cvar_t sv_clmovement_minping_disabletime; + server_t sv; server_static_t svs; @@ -83,6 +88,9 @@ void SV_Init (void) Cvar_RegisterVariable (&sv_accelerate); Cvar_RegisterVariable (&sv_airaccelerate); Cvar_RegisterVariable (&sv_wateraccelerate); + Cvar_RegisterVariable (&sv_clmovement_enable); + Cvar_RegisterVariable (&sv_clmovement_minping); + Cvar_RegisterVariable (&sv_clmovement_minping_disabletime); Cvar_RegisterVariable (&sv_idealpitchscale); Cvar_RegisterVariable (&sv_aim); Cvar_RegisterVariable (&sv_nostep); diff --git a/sv_user.c b/sv_user.c index bf13b1f8..d880a87c 100644 --- a/sv_user.c +++ b/sv_user.c @@ -28,6 +28,9 @@ cvar_t sv_maxairspeed = {0, "sv_maxairspeed", "30", "maximum speed a player can cvar_t sv_accelerate = {0, "sv_accelerate", "10", "rate at which a player accelerates to sv_maxspeed"}; cvar_t sv_airaccelerate = {0, "sv_airaccelerate", "-1", "rate at which a player accelerates to sv_maxairspeed while in the air, if less than 0 the sv_accelerate variable is used instead"}; cvar_t sv_wateraccelerate = {0, "sv_wateraccelerate", "-1", "rate at which a player accelerates to sv_maxspeed while in the air, if less than 0 the sv_accelerate variable is used instead"}; +cvar_t sv_clmovement_enable = {0, "sv_clmovement_enable", "1", "whether to allow clients to use cl_movement prediction, which can cause choppy movement on the server which may annoy other players"}; +cvar_t sv_clmovement_minping = {0, "sv_clmovement_minping", "100", "if client ping is below this time in milliseconds, then their ability to use cl_movement prediction is disabled for a while (as they don't need it)"}; +cvar_t sv_clmovement_minping_disabletime = {0, "sv_clmovement_minping_disabletime", "1000", "when client falls below minping, disable their prediction for this many milliseconds (should be at least 1000 or else their prediction may turn on/off frequently)"}; static usercmd_t cmd; @@ -528,6 +531,12 @@ qboolean SV_ReadClientMove (void) if (msg_badread) Con_Printf("SV_ReadClientMessage: badread at %s:%i\n", __FILE__, __LINE__); } + // disable clientside movement prediction in some cases + if (ceil((move->receivetime - move->time) * 1000.0) < sv_clmovement_minping.integer) + host_client->clmovement_disable_minpingtimeout = realtime + sv_clmovement_minping_disabletime.value / 1000.0; + if (!sv_clmovement_enable.integer || host_client->clmovement_disable_minpingtimeout > realtime) + move->sequence = 0; + if (!host_client->spawned) memset(move, 0, sizeof(*move)); else if (move->sequence && (float)move->time > (float)sv.time + 0.125f) // add a little fuzz factor due to float precision issues diff --git a/todo b/todo index 63b4e54d..e28781a7 100644 --- a/todo +++ b/todo @@ -254,7 +254,7 @@ 1 bug hmap: qbsp dies from runaway allocations if a duplicate plane is found on a brush (Tomaz) 1 change darkplaces client: reduce number of particles used, and particle limit, to save some memory (LordHavoc) 1 change darkplaces protocol: document the TEI stuff used in Nexuiz -1 change darkplaces protocol: send cvar commands to client to set cl_movement_* cvars and cl_slowmo and cl_gravity (Vermeulen) +1 change darkplaces protocol: send additional stats for movement parameters and slowmo and gravity, replacing the rather silly cl_movement and cl_slowmo and cl_gravity cvars (Vermeulen) 1 change darkplaces renderer: add gunshot (shotgun pellet) and nail (spike) decals to the particlefont so that these can look different from explosions (Morphed) 1 change darkplaces renderer: add r_shadow_realtime_world 2 mode (and update menu), make 1 only render rtlights if they came from a .rtlights file and mode 2 render them even if they were imported from the map, always render imported ones if editing mode is turned on (Willis) 1 change darkplaces renderer: make "sky" keys in worldspawn override q3 sky shaders (Vermeulen) @@ -345,7 +345,7 @@ 2 feature darkplaces protocol: .float bulge; field which makes an entity larger by moving vertices along their normals, well known as the fatboy mutator in Unreal Tournament (Wazat) 2 feature darkplaces protocol: add effects.txt file which would describe a bunch of numbered effects usable with a .effectindex field on entities, these would range from point effects, to continuous emitters, to beams with jitter and other properties, each effect would have various info like dlight and particle spawning and beam rendering (CheapAlert, Supa, FrikaC, [TACO], Urre, Vermeulen) 2 feature darkplaces protocol: add rcon_password system similar to quakeworld server (II`cyan) -2 feature darkplaces protocol: svc_spawnstatic should use a delta from defaultstate, instead of its outdated custom protocol (Spike) +2 feature darkplaces protocol: svc_spawnstatic should use a delta from defaultstate, instead of its outdated custom protocol (Spike, Dresk) 2 feature darkplaces release: add KDE/gnome icons somehow using darkplaces72x72.png (de-we) 2 feature darkplaces renderer: dpshader should support corona-model shaders somehow (equation: pow(normalizationcubemap(transform(eye, vertexmatrix)) dot3 '0 0 1', 8)), which are normally used around unusually shaped lights instead of flat coronas (Mitchell) 2 feature darkplaces renderer: q3 fog brush shaders (tZork) -- 2.39.2