Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2003:
[Freeciv-Dev] (PR#3648) Superfluous tiles bug
Home

[Freeciv-Dev] (PR#3648) Superfluous tiles bug

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] (PR#3648) Superfluous tiles bug
From: "Arnstein Lindgard" <arnstein.lindgard@xxxxxxx>
Date: Fri, 7 Mar 2003 05:03:10 -0800
Reply-to: rt@xxxxxxxxxxxxxx

I think this patch here will significantly reduce lag when a player
reconnects. It should probably be applied to the pubservers.

I set up a client to study incoming packets in the hope of optimizing
the network code itself, failed miserably, but found some redundancy
that seems not to increase the systems robustness.

When a dead player reconnects, the number of PACKET_TILE_INFOs is
reduced by 50% because each tile was blessed with to identical packets.
When a living player reconnects, the gain seems to be ~43%.

The other patch deals with Apollo. Seems the whole damn map is sent
every turn, and in duplicate because of the first bug! In function
do_apollo_program() it seems superfluous to send tile and city info,
since it's taken care of elsewhere in the code after map_know_all()
is called. You still get updates when a fogged city changes.

I tested by having the client check if a packet actually contained
new information. In the case of Apollo, 4000 out of 4006 packets each
turn were wasted (default mapsize 80 x 50 = 4000).


Arnstein

--- cvs/server/maphand.c        Sat Feb 22 10:43:01 2003
+++ antilag1/server/maphand.c   Fri Mar  7 12:23:09 2003
@@ -324,7 +324,9 @@
        send_tile_info_always(pplayer, &pconn->self, x, y);
       } else if (map_get_known(x, y, pplayer)) {
        send_NODRAW_tiles(pplayer, &pconn->self, x, y, 0);
-       send_tile_info_always(pplayer, &pconn->self, x, y);
+    if (!map_get_sent(x, y, pplayer)) {
+      send_tile_info_always(pplayer, &pconn->self, x, y);
+    }
       }
     } conn_list_iterate_end;
   } whole_map_iterate_end;
--- cvs/server/srv_main.c       Tue Feb 18 15:52:11 2003
+++ antilag1/server/srv_main.c  Fri Mar  7 13:17:35 2003
@@ -316,8 +316,6 @@
       } players_iterate_end;
     } else {
       map_know_all(pplayer);
-      send_all_known_tiles(&pplayer->connections);
-      send_all_known_cities(&pplayer->connections);
     }
   }
 }

[Prev in Thread] Current Thread [Next in Thread]