-
Notifications
You must be signed in to change notification settings - Fork 88
Compression
length | description |
---|---|
1 | packet type |
4 | retransmit mask |
2 | encapsulation seq |
2 | encapsulation ack |
2 | command stream seq |
2 | command stream ack |
2 | command stream len |
command stream length field is completely redundant with length field in the udp header.
encapsulation seq/ack and command stream seq/ack can be 8 bit fields since it takes 30 seconds for them to wrap around even then. In case of 10 seconds of no communication between 2 peers, a special value of 0xff in them can signal that a 16bit seq/ack field follows.
retransmit mask can be replaced by 1 bit in most cases, since it is zero basically all the time. bit=0 signals mask==0, bit=1 signals mask follows.
packet type can be replaced by 2 bits, since after the initial game setup stage, only command 4 and 5 are seen on the wire. 0==command4, 1==command5, 2==8bit command follows, 3==reserved
encapsulation header savings: 6 + 31 + 4*8 + 16 bits == 85 bits of 120 bits (70%) assuming 8 * (20 + 8) bits for IP4+UDP, total savings: 85 bits of 344 (25%)