]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
added sv_clmovement_* cvars to disable movement prediction of players, or disable...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 28 May 2006 01:26:06 +0000 (01:26 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 28 May 2006 01:26:06 +0000 (01:26 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6398 d7cf8633-e32d-0410-b094-e92efae38249

server.h
sv_main.c
sv_user.c
todo

index c403d0608de1baf2a9f71b60d7ee4900d6d3ba15..d2e6c303bb0ba1bf7765e5f1f8a79d75679663e3 100644 (file)
--- 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;
 #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];
 
 // spawn parms are carried from level to level
        float spawn_parms[NUM_SPAWN_PARMS];
index 9463489c32cfa152bfd134e0c1ffde4d064e1881..5b8b7c4bf7757bb6f7018ada117ab1e35dbfc7a1 100644 (file)
--- 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" };
 
 
 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;
 
 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_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);
        Cvar_RegisterVariable (&sv_idealpitchscale);
        Cvar_RegisterVariable (&sv_aim);
        Cvar_RegisterVariable (&sv_nostep);
index bf13b1f8e7b84acce82cb88fd5a59dda436918e5..d880a87cc00570988897e9043c69a503056b29e5 100644 (file)
--- 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_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;
 
 
 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__);
        }
 
                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
        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 63b4e54db273dfdf18a95f3d15e72118a817814d..e28781a78fd0465bf49cc467bb56bea73cfa2d95 100644 (file)
--- a/todo
+++ b/todo
 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 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)
 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)
 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: .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 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)