Packet headers
There is only so much you can compress data and data you can avoid sending until you wear down that bandwidth optimization, so what do you do from there? Things look great when you're sending only about 10 bytes of data every second per player connected, but then all the sudden, someone crushes your dreams with something called Packet Headers. These have been mentioned a few times in previous pages, but I refused to talk about them until now.
Every packet has a specific place it needs to go to, along with information on how it is structured. This is all carried in the header. TCP has a packet header of 20 bytes, while UDP has a packet header of 8 bytes. That means every packet you send with TCP is +20 bytes + the data. Combined with that, there is the IPv4 headers, which are another 20 bytes. So overall, a TCP packet with one byte of information has 41 bytes - uhoh, I smell trouble! For TCP and Reliable UDP, it gets even worse, since you have to factor in the ACKs and resending of dropped packets!
The worst part is, theres no compressing these headers. These are read by every gateway and server they pass through, so they must be supported on a universal level. If you were directly connected to another computer via a LAN connect for instance, you could write custom routines to minimize the header size since each computer can be updated with the routine, but unless you update every computer in the world with your algorithm, you have to just accept headers and that most of your bandwidth (on a well written system) is going to go to these headers.
This doesn't mean we can't do anything about them though. Packet Buffers, as explained in the next section, allow us to hold data as long as possible, and send it all in one big batch. As you can imagine, though, this can add a lot of problems if done incorrectly. You can't just send data once every 500 milliseconds or so and assume things will go fine, because doing so would add 500 milliseconds latency on top of the natural server latency. So, what do we do? Read the next section to find out!