Reworked network protocol
I'm starting to work my way towards improving the usability of Second Monitor for endurance racing on Assetto Corsa Competizione. Part of this was me identifying a need to establish a networking protocol that would allow this. Previously you only had one type of datagram and its type was discriminated with an enum on the datagram. I've opted for an approach that writes an enum to the very start of the datagram and can be read on the receiving side to determine which strategy to follow for unpacking the data.
The message types are:
|Heartbeat||When Network Conservation settings are enabled, a heartbeat is sent if no messages had been sent in the last second.|
|SessionStart||Sends the initial "config" for the connected sim. This includes the relevant connector used, the simulator source info as well as session info.|
|SessionInfo||Updated session info will be sent to ensure that the session timer and info is updated regularly.|
|PlayerInfo||Timing info of all the drivers.|
|DriversInfo||Timing & telemetry info of the driver currently driving.|
It's important to note that this protocol is sending a message for each message type, so there might be a small amount of overhead introduced, but I do think overall the networking throughput is reduced because message types only contain data relevant to the specific message. I couldn't verify this, but I could verify that networking usage wasn't worse when compared to the previous protocol.
I was hoping I'd be able to alter the way the
PlayerInfo messages were sent but felt this was a large enough change to first test its reliability before proceeding.
I've also included the ability for the user to pick which version of the protocol they'd prefer to use and it's configurable in the "Manage Plugins" app as can be seen below:
Once I've done some more battle testing of this latest protocol I'll consider dropping the previous protocol entirely.