Communications Layer Implementation
Changes
The most important change in the structure of the communications system has
been the shift from using TCP streams to UDP datagrams. This change was
necessary because of the poor performance and rather extreme latency exhibited
by the original prototype. This change, while it required significantly more
code to implement, has resulted in a drastic improvement in overall system
performance, with the latency between clients usually being less than the time
for the graphical client to render a frame. A more detailed explanation of
the benefits of this change can be found here.
Communications Protocol
The communications protocol is based upon a simple acknowledgement and
retransmission scheme. Events can be either guaranteed or non-guaranteed.
This allows events (such as update_agent_state) that update transient state
to be unguaranteed, thus lowering both bandwidth and latency. Both the client
and server implement both sides of this protocol, so that update packets going
both ways can be made more efficient.
The various events used to communicate between the client and server are
described in detail here.
System Structure
Shared Code
The top-level directory of the build tree contains code that is referenced
by both the server and the client library. It is primarily utility code and
type definitions, but also includes the shared event structures. Placing the
event structures here allows them to remain in sync between the client and
server, which avoids many unpleasant debugging headaches. In addition, the
code for packing and byte-swapping event definitions for sending across the
network is placed here for simplicity.
Addendum 1: The comm layer and agents
Addendum 2: Modifying the comm layer for new Agents
Quarterly Additions