Skip to main content

NetworkStats

Struct NetworkStats 

Source
pub struct NetworkStats {
    pub send_queue_len: usize,
    pub ping: u128,
    pub kbps_sent: usize,
    pub local_frames_behind: i32,
    pub remote_frames_behind: i32,
    pub last_compared_frame: Option<Frame>,
    pub local_checksum: Option<u128>,
    pub remote_checksum: Option<u128>,
    pub checksums_match: Option<bool>,
}
Expand description

The NetworkStats struct contains statistics about the current session.

Fields§

§send_queue_len: usize

The length of the queue containing UDP packets which have not yet been acknowledged by the end client. The length of the send queue is a rough indication of the quality of the connection. The longer the send queue, the higher the round-trip time between the clients. The send queue will also be longer than usual during high packet loss situations.

§ping: u128

The roundtrip packet transmission time as calculated by Fortress Rollback.

§kbps_sent: usize

The estimated bandwidth used between the two clients, in kilobits per second.

§local_frames_behind: i32

The number of frames Fortress Rollback calculates that the local client is behind the remote client at this instant in time. For example, if at this instant the current game client is running frame 1002 and the remote game client is running frame 1009, this value will mostly likely roughly equal 7.

§remote_frames_behind: i32

The same as local_frames_behind, but calculated from the perspective of the remote player.

§last_compared_frame: Option<Frame>

The most recent frame for which checksums were compared between peers.

This is None if no checksum comparison has occurred yet (e.g., early in the session or if desync detection is disabled).

§local_checksum: Option<u128>

The local checksum at last_compared_frame.

This is the checksum computed locally from the saved game state at that frame. Compare with remote_checksum to check for desync.

§remote_checksum: Option<u128>

The remote checksum at last_compared_frame.

This is the checksum received from the remote peer for that frame. Compare with local_checksum to check for desync.

§checksums_match: Option<bool>

Whether checksums matched at the most recently compared frame.

This is a convenience field derived from comparing local_checksum and remote_checksum. It is None if no comparison has occurred.

  • Some(true) - Checksums match, peers are synchronized
  • Some(false) - DESYNC DETECTED - game state has diverged
  • None - No comparison available yet

Implementations§

Source§

impl NetworkStats

Source

pub fn new() -> Self

Creates a new NetworkStats instance with default values.

Trait Implementations§

Source§

impl Clone for NetworkStats

Source§

fn clone(&self) -> NetworkStats

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NetworkStats

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for NetworkStats

Source§

fn default() -> NetworkStats

Returns the “default value” for a type. Read more
Source§

impl Display for NetworkStats

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for NetworkStats

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for NetworkStats

Source§

fn eq(&self, other: &NetworkStats) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for NetworkStats

Source§

impl Eq for NetworkStats

Source§

impl StructuralPartialEq for NetworkStats

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more