From: Espen Skoglund Newsgroups: rec.games.computer.xpilot Subject: Re: Cutting down on bandwidth usage [...] Date: 15 Mar 1999 10:18:37 +0100 Hmmm, I looked into what network trafic XPilot actually produces, and came up with the following numbers (as seen from the server side). ================================================================ Message Numb. bytes Purpose # # The following are sent by the server to a player joining the game. In # addition, the map data is sent to the client. Since this only happens # once, they will impose no network lag during gameplay. # Send_reply: 3 Sent during login of a new player Send_leave: 3 Someone leaving the game Send_motd: 21-523 Send a chunk of the MOTD # # The following are sent to all clients when a player joins the game. # This is a somewhat rare event, and may therefore be ignored when # calculating network bandwidth. # Send_player: 5+nickname+ Someone joining the game realname+hostname+ shipshape (max 1285, typically <350) # # Messages only used in certain type of games, or that only are sent # on rare occations to all the players. # Send_timing: 5 Race info for some player Send_time_left: 5 Number of seconds left of game Send_base: 5 Info on which base a player has Send_shutdown: 5 Shutdown message # # Messages only used in certain type of games, or that only are sent # on rare occations to a single player. # end_war: 5 Someone declaring war Send_seek: 7 Someone programming a robot to Send_loseitem: 2 Tell client that he lost an item seek a player Send_destruct: 3 Self destruct info Send_thrusttime: 5 Emergency thrust time left Send_shieldtime: 5 Emergency shield time left # # Messages that are sent regularly to the client. # Send_score_object: 7+scorestring Score information for self (typically scorestring is <15) Send_audio: 3 A single audio event # # Messages sent regularly to all clients. These should not impose # much network traffic though. They could however create quite a large # amount of network bandwidth if a player sends lots of talk messages, # or if there are lots of things happening on the map. (A message is # created each time people are shot, a target or treasure is destroyed, # or someone declares war). # Send_score: 8 The score for some player Send_message: 1+msgsize A server or talk message (max 257) # # Messages sent to a single player when something is visible to him. # Debris and fastshot comproises most of the bandwidth here. The number # of missiles + mines + items visible are probably less than 20, and are # only used on certain maps. The number of balls + targets + fuelstations + # cannons visible are probably less than 15. # Send_debris: 2-512 Send up to 255 debris (depending on # of debris) Send_fastshot: 2-512 Send up to 255 shots (depending on # of shots) Send_missile: 7 Info on a single missile/torpedo Send_mine: 8 Info on a single mine Send_item: 6 Info on a single item Send_ball: 7 Info on a single ball Send_target: 7 Info on a single target Send_fuel: 5 Amount of fuel in a fuel station Send_cannon: 5 Information for a single cannon # # The following may be sent to a single when a player is within # visible range. # Send_ship: 9 A single ship Send_paused: 7 Info that a player is paused Send_ecm: 7 A single active ECM Send_trans: 9 A single active transporter Send_refuel: 9 A single refuel/repair line Send_connector: 10 A single connector/tractor beam line Send_laser: 9 A single laser pulse Send_damaged: 2 How much damaged a player is # # Messages that are sent to every client every single frame. # Send_start_of_frame: 9 Sent at begining of a new frame Send_end_of_frame: 5 Sent at eend of a frame Send_self: 47-56 Data for self and HUD (depending on modifiers) # # Misc. # Send_radar: 6 A single radar object Send_eyes: 3 Id of player we're looking at when we are dead/paused. # # The following receives by the server are used during login/logout of # a new player, and hence should not impose much network lag. # Receive_play: 1 A player wants to join Receive_motd: 9 Request for more MOTD text Receive_display: 7 Information on display Receive_modifier_bank: 2+banksize Information on modifier bank Receive_shape: 1+shipshape Shipshape information (max 513) Receive_ack: 9 Ack used during a Reliable_send. Reliable_send is used during connection of a client and during Send_end_of_frame. Reliable_send packets are piggybacked at the end of frame update packets, or (if that is not possible) sent as separate packets. The latter case imposes another 11 bytes on the "reliable packet" size. Receive_ack is also used to calculate roundtrip delay. Receive_quit: 1 A quit event from a player # # The following receives are rare, and can therefore be ignored when # thinking of network bandwidth calculation. # Receive_fps_request: 2 Request a given framespeed Receive_audio_request: 2 Turn audio on/off Receive_power: 5 Player alters turnspeed or power # # The following acks are sent by the client as a response to a servers # Send_{cannon|fuel|target}. The number of cannons, fuelstations and # targets on screen at the same time will seldom be more than 15 (I guess). # Receive_ack_cannon: 9 Ack telling about last cannon update Receive_ack_fuel: 9 Ack telling about last fuelst. update Receive_ack_target: 9 Ack telling about last target update # # The folloiwing happens regularly, but should not impose very much # network traffic (if a player does not send large talk messages very # often, that is). # Receive_keyboard: 5 A keyboard event Receive_pointer_move: 3 Mousepointer has moved Receive_talk: 5+msgsize Player sends a talk message (max 261) # # My current wrecakge patch sends out about 4-5 wreckage parts when # a ship explodes. # Send_wreckage: 8 A single wreckage part ================================================================ So, how much traffic does a single frame on eg. Bloods impose on the network. Here's an example of how much traffic a single client is responsible for. Messages sent by the server start_of_frame: 9 + self: 47 + two players in sight: 2 * 9 = 18 + one of the players connected to a ball: 7 + 10 = 17 + 8 players on rader: 8 * 6 = 48 + a message from the server: 40 + 20 shots: 2 + 20 * 2 = 42 + 38 debris: 2 + 38 * 2 = 78 + end_of_frame: 5 ---- SUM: 304 ==== Messages received by the server keyboard event: 5 + ack for 5 fuel stations: 5 * 9 = 41 ---- SUM: 46 ==== Total: 304 b/f + 46 b/f = 350 b/f If a player on avarage results in 250 bytes worth of network traffic per frame, the client will need a bandwidth of: 250 b/f * 12 f/s = 3000 b/s. The eight players will consume; 3000 b/s * 8 = 24000 b/s = 24 kb/s worth of network bandwidth on the local network. Are these numbers sensible? eSk