]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
test a
authorbones_was_here <bones_was_here@xa.org.au>
Sat, 8 May 2021 07:26:40 +0000 (17:26 +1000)
committerbones_was_here <bones_was_here@xa.org.au>
Fri, 30 Jul 2021 09:58:54 +0000 (19:58 +1000)
server.h
sv_main.c
sv_phys.c

index 07639e4b5f52c530fa71cc50e974fe12201fc95d..1620466a07fc4ad32cc03562a4e38c8aaee7c3ed 100644 (file)
--- a/server.h
+++ b/server.h
@@ -421,6 +421,7 @@ extern cvar_t sv_clmovement_enable;
 extern cvar_t sv_clmovement_minping;
 extern cvar_t sv_clmovement_minping_disabletime;
 extern cvar_t sv_clmovement_inputtimeout;
+extern cvar_t sv_clmovement_inputtimeout_strict;
 extern cvar_t sv_clmovement_maxnetfps;
 extern cvar_t sv_cullentities_nevercullbmodels;
 extern cvar_t sv_cullentities_pvs;
index dcb91a7f9147ca33912d3ab6551c0a3cad8622d3..eebb6de961dc634e1736e5cbf5739d6de1cd3efb 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -77,6 +77,7 @@ cvar_t sv_clmovement_enable = {CF_SERVER, "sv_clmovement_enable", "1", "whether
 cvar_t sv_clmovement_minping = {CF_SERVER, "sv_clmovement_minping", "0", "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 = {CF_SERVER, "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)"};
 cvar_t sv_clmovement_inputtimeout = {CF_SERVER, "sv_clmovement_inputtimeout", "0.1", "when a client does not send input for this many seconds (max 0.1), force them to move anyway (unlike QuakeWorld)"};
+cvar_t sv_clmovement_inputtimeout_strict = {CF_SERVER, "sv_clmovement_inputtimeout_strict", "1", "prevent lagaporting (in other players' perspectives) and speeding up (in lagging player's perspective) when inputtimeout is exceeded"};
 cvar_t sv_cullentities_nevercullbmodels = {CF_SERVER, "sv_cullentities_nevercullbmodels", "0", "if enabled the clients are always notified of moving doors and lifts and other submodels of world (warning: eats a lot of network bandwidth on some levels!)"};
 cvar_t sv_cullentities_pvs = {CF_SERVER, "sv_cullentities_pvs", "1", "fast but loose culling of hidden entities"};
 cvar_t sv_cullentities_stats = {CF_SERVER, "sv_cullentities_stats", "0", "displays stats on network entities culled by various methods for each client"};
@@ -553,6 +554,7 @@ void SV_Init (void)
        Cvar_RegisterVariable (&sv_clmovement_minping);
        Cvar_RegisterVariable (&sv_clmovement_minping_disabletime);
        Cvar_RegisterVariable (&sv_clmovement_inputtimeout);
+       Cvar_RegisterVariable (&sv_clmovement_inputtimeout_strict);
        Cvar_RegisterVariable (&sv_cullentities_nevercullbmodels);
        Cvar_RegisterVariable (&sv_cullentities_pvs);
        Cvar_RegisterVariable (&sv_cullentities_stats);
index a72a7ca6acf5b8a0142c5df48bc506834fb4635c..edef55cdcd7e9aada47691aeac88b71b5bc8fffe 100644 (file)
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -3062,8 +3062,18 @@ static void SV_Physics_ClientEntity_PostThink(prvm_edict_t *ent)
        // synchronous physics
        if (host_client->clmovement_inputtimeout > sv.frametime)
                host_client->clmovement_inputtimeout -= sv.frametime;
-       else
-               host_client->clmovement_inputtimeout = 0;
+       else if (host_client->clmovement_inputtimeout > 0)
+               host_client->clmovement_inputtimeout = -1337; // sync phys next frame if no moves by then
+       else if (host_client->clmovement_inputtimeout == -1337)
+       {
+               // bones_was_here: sync physics ran this frame due to expired inputtimeout,
+               // so advance cmd.time to prevent warping caused by running sync AND async physics
+               if (sv_clmovement_inputtimeout_strict.integer)
+                       host_client->cmd.time = min(host_client->cmd.time + sv.frametime, sv.time);
+
+               // show that this cl_movement client has a connection problem
+               host_client->ping += sv.frametime;
+       }
 }
 
 static void SV_Physics_ClientEntity(prvm_edict_t *ent)