Skip to content

Commit

Permalink
Add ChannelMode comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dubrowgn committed Jul 15, 2024
1 parent 31723b9 commit 7a27e07
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion shared/src/messages/channels/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ impl ChannelSettings {

#[derive(Clone)]
pub struct ReliableSettings {
/// Resend un-ACK'd messages after (rtt_resend_factor * currently_measured_round_trip_time).
pub rtt_resend_factor: f32,
}

Expand All @@ -77,14 +78,39 @@ impl TickBufferSettings {
}
}

// ChannelMode
#[derive(Clone)]
pub enum ChannelMode {
/// Messages can be dropped, duplicated and/or arrive in any order.
/// Resend=no, Dedupe=no, Order=no
UnorderedUnreliable,

/// Like SequencedReliable, but messages may not arrive at all. Received old
/// messages are not delivered.
/// Resend=no, Dedupe=yes, Order=yes
SequencedUnreliable,

/// Messages arrive without duplicates, but in any order.
/// Resend=yes, Dedupe=yes, Order=no
UnorderedReliable(ReliableSettings),

/// Messages arrive without duplicates and in order, but only the most recent gets
/// delivered. For example, given messages sent A->B->C and received in order A->C->B,
/// only A->C gets delivered. B gets dropped because it is not the most recent.
/// Resend=yes, Dedupe=yes, Order=yes
SequencedReliable(ReliableSettings),

/// Messages arrive in order and without duplicates.
/// Resend=yes, Dedupe=yes, Order=yes
OrderedReliable(ReliableSettings),

/// Per-tick message buffering, useful for predictive client applications. The Client
/// ticks "ahead in the future" of the Server and dilates its clock such that the
/// Server should always have a buffer of messages to read from for each player on
/// each and every Tick. Messages for which the Client hasn't received an ACK are
/// pro-actively sent every single Tick until receiving that receipt or it is measured
/// that the Tick has passed on the Server. This avoids typical resend latency in the
/// event of dropped packets, but also means messages can be lost in the worst case.
/// Note: can only be sent from client-to-server
TickBuffered(TickBufferSettings),
}

Expand Down

0 comments on commit 7a27e07

Please sign in to comment.