Diarkis RUDP
Overview
Reliable User Datagram Protocol (RUDP) is an implementation of UDP communication where data delivery is guaranteed. Diarkis client can use RUDP to transmit data either in server communications or P2P communications, ensuring that crucial information necessary for game progression is reliably delivered to the other party. This page explains the specifications and settings of Diarkis RUDP.
Specifications of Diarkis RUDP
The combinations in which Diarkis RUDP can be established include server-client and client-client (P2P communication). Some features are only available in P2P communications.
In Diarkis RUDP, when data is received, an Acknowledgement (ACK) is returned to inform the sender of the data's arrival. If an ACK is not received within a specified timeframe, the Diarkis client will resend the same data. In this document, this timeframe is referred to as RetryInterval. Furthermore, if an ACK is not received after resending the data a specified number of times, the Diarkis client will disconnect the communication with the other party due to a timeout. In this document, this number of retries is referred to as RetryMaxCount.
Exclusively in P2P communications with RUDP, a sequence guarantee toggle feature is provided in addition to data delivery assurance. When sequence guarantee is enabled, it ensures that the data received by the application is in the order sent by the peer user. The Diarkis library will not pass data to the application until packets are received in the correct sequential order. If the sequence guarantee is disabled, the Diarkis library will pass packets to the application in the order they are received, and this order may vary due to network conditions or retransmission.
In server-client RUDP communication, the sequence guarantee is always enabled.
Configuration of Diarkis RUDP
Setting the RetryInterval
The RetryInterval can be adjusted using the following function:
The RetryInterval starts at the time specified by minMs
(milliseconds) and doubles each time the client resends until it reaches the time specified by maxMs
. For example, if minMs=300ms, maxMs=1000ms, and RetryMaxCount is 5, the RetryInterval changes as 300ms, 600ms, 900ms, 1000ms, 1000ms. If the fifth resend times out, the client disconnects the communication.
By making the RetryInterval exponential, you can reduce the client's network processing load. If you wish to have a fixed RetryInterval, specify the same value for both minMs
and maxMs
to keep the RetryInterval constant regardless of the number of retries.
Setting the RetryMaxCount
The RetryMaxCount can be adjusted using the following function:
The RetryMaxCount will be set to the value specified by count
.
Configuring Sequence Guarantee
a. When using the Diarkis Module, the behavior of RUDP can be controlled through the type
argument in functions like SendBroadcast
defined in DiarkisP2PBase.h
. Specify a value of the enumerated type RudpType
for the type
argument.
b. When directly using the library, set the bFixedOrder
flag to true
in the P2P communication data sending function found below.
Important Notes on Configuration
SetSendRetryInterval
andSetSendRetryMaxCount
configure the settings for RUDP communication with the server. For P2P communication, useSetSendRetryIntervalP2P
andSetSendRetryMaxCountP2P
.If the RetryInterval is set too low or RetryMaxCount is too high, the client may need to send a large number of packets, significantly increasing network processing load.
Last updated