]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
server: Remove unused/broken ping smoothing feature
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 29 Mar 2021 20:55:12 +0000 (20:55 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 29 Mar 2021 20:55:12 +0000 (20:55 +0000)
Removes unused ping smoothing feature (didn't actually compile so safe
to say nobody is using it). It could cause problems for QC mods that use
ping for antilag purposes, and QC can easily average pings if desired.

From bones_was_here

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13101 d7cf8633-e32d-0410-b094-e92efae38249

protocol.h
server.h
sv_main.c
sv_user.c

index 170db5b9ecb5e5158da187a7635731c721af7dcb..e637ea542ae8aa9303c47ad6a42ebb48c9ad2843 100644 (file)
@@ -388,9 +388,8 @@ typedef struct usercmd_s
        vec_t   cursor_fraction;
        int             cursor_entitynumber;
 
-       double time; // time the move is executed for (cl_movement: clienttime, non-cl_movement: receivetime)
-       double receivetime; // time the move was received at
-       double clienttime; // time to which server state the move corresponds to
+       double time; // time the move is executed for (non-cl_movement is executed at receivetime)
+       double receivetime; // time the move was received at (used for ping)
        int msec; // for predicted moves
        int buttons;
        int impulse;
index 9a9a6d9b4ffb9c4b80e4b5959d5878c00d623e0c..503d1b146aac2320fea96c8f8bfeebda599d5bad 100644 (file)
--- a/server.h
+++ b/server.h
@@ -179,9 +179,6 @@ typedef struct csqcentityframedb_s
        int sendflags[NUM_CSQCENTITIES_PER_FRAME];
 } csqcentityframedb_t;
 
-// if defined this does ping smoothing, otherwise it does not
-//#define NUM_PING_TIMES 16
-
 #define NUM_SPAWN_PARMS 16
 
 typedef struct client_s
@@ -225,11 +222,6 @@ typedef struct client_s
        /// PRVM_EDICT_NUM(clientnum+1)
        prvm_edict_t *edict;
 
-#ifdef NUM_PING_TIMES
-       float ping_times[NUM_PING_TIMES];
-       /// ping_times[num_pings%NUM_PING_TIMES]
-       int num_pings;
-#endif
        /// LadyHavoc: can be used for prediction or whatever...
        float ping;
 
index 2aa9a9875d4d65d88d80f7a1856740c67102685c..1a48d15bacf79e2e959692ad98044fd3380c70b0 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -910,11 +910,6 @@ void SV_SendServerinfo (client_t *client)
        client->movesequence = 0;
        client->movement_highestsequence_seen = 0;
        memset(&client->movement_count, 0, sizeof(client->movement_count));
-#ifdef NUM_PING_TIMES
-       for (i = 0;i < NUM_PING_TIMES;i++)
-               client->ping_times[i] = 0;
-       client->num_pings = 0;
-#endif
        client->ping = 0;
 
        // allow the client some time to send his keepalives, even if map loading took ages
index 1e3d581f0c186bd501531e93af826af6a60fcdf0..f3115088abd651d59d950f368b409d2b2a124acb 100644 (file)
--- a/sv_user.c
+++ b/sv_user.c
@@ -654,7 +654,7 @@ static void SV_ReadClientMove (void)
        // read ping time
        if (sv.protocol != PROTOCOL_QUAKE && sv.protocol != PROTOCOL_QUAKEDP && sv.protocol != PROTOCOL_NEHAHRAMOVIE && sv.protocol != PROTOCOL_NEHAHRABJP && sv.protocol != PROTOCOL_NEHAHRABJP2 && sv.protocol != PROTOCOL_NEHAHRABJP3 && sv.protocol != PROTOCOL_DARKPLACES1 && sv.protocol != PROTOCOL_DARKPLACES2 && sv.protocol != PROTOCOL_DARKPLACES3 && sv.protocol != PROTOCOL_DARKPLACES4 && sv.protocol != PROTOCOL_DARKPLACES5 && sv.protocol != PROTOCOL_DARKPLACES6)
                move->sequence = MSG_ReadLong(&sv_message);
-       move->time = move->clienttime = MSG_ReadFloat(&sv_message);
+       move->time = MSG_ReadFloat(&sv_message);
        if (sv_message.badread) Con_Printf("SV_ReadClientMessage: badread at %s:%i\n", __FILE__, __LINE__);
        move->receivetime = (float)sv.time;
 
@@ -779,9 +779,7 @@ static void SV_ExecuteClientMoves(void)
        double moveframetime;
        double oldframetime;
        double oldframetime2;
-#ifdef NUM_PING_TIMES
-       double total;
-#endif
+
        if (sv_numreadmoves < 1)
                return;
        // only start accepting input once the player is spawned
@@ -886,17 +884,9 @@ static void SV_ExecuteClientMoves(void)
                host_client->movesequence = 0;
                // make sure that normal physics takes over immediately
                host_client->clmovement_inputtimeout = 0;
+               // update ping time
+               host_client->ping = host_client->cmd.receivetime - sv_readmoves[sv_numreadmoves-1].time;
        }
-
-       // calculate average ping time
-       host_client->ping = host_client->cmd.receivetime - host_client->cmd.clienttime;
-#ifdef NUM_PING_TIMES
-       host_client->ping_times[host_client->num_pings % NUM_PING_TIMES] = host_client->cmd.receivetime - host_client->cmd.clienttime;
-       host_client->num_pings++;
-       for (i=0, total = 0;i < NUM_PING_TIMES;i++)
-               total += host_client->ping_times[i];
-       host_client->ping = total / NUM_PING_TIMES;
-#endif
 }
 
 void SV_ApplyClientMove (void)