Grand Prix
Garage - GPL
The workings of
GPL Online - Part 2
Detailed notes
on Bandwidth
From traces and replays I made using a server and one client
in a local network, I noted the following figures. I checked them
using an Internet connection between the systems as well. I
simulated a multi client race by letting ai cars in.
- Upload packet size from client to server in all cases: 36
bytes, occasionally 16 bytes extra. The 84 bytes that are
default are never fully used.
- Download packet size from server to client:
net_xxx_server_send_size bytes.
- The number of surrounding cars shown if the
packet is completely filled is: (packet size - 4)
/ 16, so 5 cars for the default modem class
packet size of 84.
- If there are not enough cars to fill the maximum
packet size, the packet size is 4 + 16 * [number
of surrounding cars shown] + 16 bytes, with
occasionally another 16 bytes extra. I don't know
what the extra data of 16 or 32 bytes might be.
So when hosting few clients on a modem
connection, it may help to reduce
mdm_server_send_size to 4+16*[number of
surrounding cars shown], thereby preventing that
the extra data is sent.
- For modem class connections, the default
net_mdm_server_send_size of 84 is also the maximum.
Specifying a greater value does not result in larger
packets on the link. Therefor the maximum number of
surrounding cars shown for a modem class connection is 5
(4 cars in front and 1 behind). The number can be reduced
by specifying a smaller packet size.
- For lan class connections, there is no maximum. Since the
maximum number of surrounding cars is 19, the largest
packet that makes sense would be 4 + 32 + 16 * 19 = 340
bytes.
- The number of surrounding cars shown is split in cars
ahead and cars behind as follows:
- 1 - 3 cars shown: 1 -3 cars ahead, no cars behind
(very dangerous unless only 1 - 3 other cars on
track!)
- 4 - 7 cars shown: 3 - 6 cars ahead, 1 car behind
- 8 - 11 cars shown: 6 - 9 cars ahead, 2 cars
behind
- 12 - 15 cars shown: 9 - 12 cars ahead, 3 cars
behind
- 16 - 19 cars shown: 12 - 15 cars ahead, 4 cars
behind (could not test >16 cars)
- The protocol overhead for all packets is 54 bytes:
- UDP: 8 bytes
- IP: 20 bytes
- Link level:
- Ethernet (cable & adsl connections):
26 bytes (8 bytes flag + 14 bytes header
+ 4 bytes CRC)
- PPP (dial-up connections): 7 bytes (1
byte flag + 4 bytes header + 2 bytes FCS
+ 1 byte flag);
extra bytes will be inserted into the
data to maintain transparency. For
reasons of simplicity I will use the
Ethernet values for calculations as this
is most common among hosts.
- To go from bytes to bits, I will multiply by 8 (based on
Ethernet frames).
- TCP parameter settings play no role as all traffice is
UDP. So there is no need to optimize MSS or
DefaultRCVWindow. Since the largest IP packet GPL will
send is 340 bytes application data + 28 bytes UDP/IP,
there will be no segmentation even for the smallest value
of MaxMTU (576).
- The client uses its local net_xxx_client_send_every
setting to determine the send frequency of the local car
data.
The server uses its local net_xxx_server_send_every
setting for the send frequency of the data on surrounding
cars.
The server uses its local net_xxx_server_send_size
setting to determine the size of the packets it sends to
the clients. If a client has a smaller value for
net_xxx_server_send_size in its core.ini, a bandwidth
mismatch will be reported when trying to connect.
The net_xxx_client_send paramaters are ignored on the
server.
(xxx = lan when net_use_mdm_bandwidth_for_tcp_ip = 0
xxx = mdm when net_use_mdm_bandwidth_for_tcp_ip = 1)
- The same amount of data is sent all the time, whether the
local car is on the track or in the pits, in practise and
in race.
When the local car of the server never enters the track,
its data is not sent to the clients.