Dev's NoxDev's Nox
Relay Protocol

Reliable

Handling of reliable messages with guaranteed delivery and sequential processing.

The Reliable message allows sending several messages with guaranteed delivery in a single packet.

It groups several requests into a single container, optimizing network performance while maintaining reliability.

Priority

Critical - This message has the highest priority to guarantee the delivery of all contained messages.


Payload Format

Global Structure

[count: byte]
[message_1_length: ushort][message_1_data: bytes]
[message_2_length: ushort][message_2_data: bytes]
...
[message_n_length: ushort][message_n_data: bytes]

Detailed Structure

TypeNameDescription
byteCountNumber of contained messages (1-255)
ushortMessageLengthSize in bytes of the following message
byte[]MessageDataMessage data to process

Payload Example

Payload with 2 messages

[0x02]                    // Count = 2 messages
[0x00, 0x08]             // Message 1 Length = 8 bytes
[0x04, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07]  // Message 1 Data
[0x00, 0x04]             // Message 2 Length = 4 bytes  
[0x01, 0xAA, 0xBB, 0xCC] // Message 2 Data

Payload with a single message

[0x01]                    // Count = 1 message
[0x00, 0x0C]             // Message Length = 12 bytes
[0x04, "Hello World"]    // Message Data (Latency request example)

Processing

Server Side

  1. Counter reading: Extraction of the number of messages
  2. Sequential iteration: Processing of each message in order
  3. Size reading: Extraction of the length of each message
  4. Delegation: Redirection to Request.OnBuffer() for specialized processing

Processing Flow

// Processing pseudo-code
var count = payload.ReadByte();
for (int i = 0; i < count; i++) {
    var length = payload.ReadUShort();
    var messageData = payload.ReadBytes(length);
    Request.OnBuffer(clientRemote, messageData);
}

Benefits

Network Optimization

  • Packet reduction: Grouping of several messages
  • Efficiency: Less network overhead per message
  • Latency: More efficient grouped processing

Guarantees

  • Reliability: Critical priority ensures delivery
  • Order: Sequential processing of the contained messages
  • Atomicity: All messages or none

Use Cases

Action Batch

Sending of several user actions at once:

Reliable [
  Transform(x, y, z),
  Latency(now),
  ChatMessage("Hello")
]

State Synchronization

Update of several properties simultaneously:

Reliable [
  Join(1),
  Transform(x, y, z),
  Parameter("health", 100)
]

Limits

Maximum Size

  • Packet limit: Comply with the MaxPacketSize from the handshake
  • Number of messages: Maximum 255 messages per Reliable packet
  • Individual size: Each message limited to 65535 bytes

Performance

  • Sequential processing: Messages processed one by one
  • Critical priority: May delay lower-priority messages

On this page