]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Tell clients to reconnect before loading the next map. Should fix lag/stutter
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 1 Jul 2020 16:18:20 +0000 (16:18 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 1 Jul 2020 16:18:20 +0000 (16:18 +0000)
There is a noticable stutter/connection loss/lag when changing level in
some games, notably Xonotic. This is likely because the server already
started loading the world before telling clients to reconnect, which can
be an expensive process depending on the map.

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

sv_main.c

index 6d967254dfb788cd6690d6ad4d6e96227dd2b666..f89c307314260af5083f2abd27a6bc5104d16c1d 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -3440,6 +3440,15 @@ void SV_SpawnServer (const char *server)
 
        if(sv.active)
        {
+               client_t *client;
+               for (i = 0, client = svs.clients;i < svs.maxclients;i++, client++)
+               {
+                       if (client->netconnection)
+                       {
+                               MSG_WriteByte(&client->netconnection->message, svc_stufftext);
+                               MSG_WriteString(&client->netconnection->message, "reconnect\n");
+                       }
+               }
                World_End(&sv.world);
                if(PRVM_serverfunction(SV_Shutdown))
                {
@@ -3482,23 +3491,8 @@ void SV_SpawnServer (const char *server)
 //
 // tell all connected clients that we are going to a new level
 //
-       if (sv.active)
-       {
-               client_t *client;
-               for (i = 0, client = svs.clients;i < svs.maxclients;i++, client++)
-               {
-                       if (client->netconnection)
-                       {
-                               MSG_WriteByte(&client->netconnection->message, svc_stufftext);
-                               MSG_WriteString(&client->netconnection->message, "reconnect\n");
-                       }
-               }
-       }
-       else
-       {
-               // open server port
+       if (!sv.active)
                NetConn_OpenServerPorts(true);
-       }
 
 //
 // make cvars consistant