pub struct TickSynchronizer { /* private fields */ }Expand description
Client-side estimator for authoritative server Tick position.
Implementations§
Source§impl TickSynchronizer
impl TickSynchronizer
Sourcepub fn new(config: TickSyncConfig) -> NetcodeResult<Self>
pub fn new(config: TickSyncConfig) -> NetcodeResult<Self>
Creates an estimator with no accepted samples.
Sourcepub fn observe(
&mut self,
sample: TickSyncSample,
) -> NetcodeResult<TickSyncReport>
pub fn observe( &mut self, sample: TickSyncSample, ) -> NetcodeResult<TickSyncReport>
Observes one response and updates RTT and Tick-offset estimates.
The server Tick is defined at response send time. Half the network RTT is therefore added before comparing it with the client’s Tick at response receipt.
Sourcepub fn estimate_server_tick(&self, local_tick: f64) -> f64
pub fn estimate_server_tick(&self, local_tick: f64) -> f64
Estimates the server’s fractional Tick at a given local fractional Tick.
Sourcepub fn recommended_input_tick(&self, local_tick: f64) -> u64
pub fn recommended_input_tick(&self, local_tick: f64) -> u64
Chooses the next authoritative input Tick using the configured input delay.
Sourcepub fn offset_ticks(&self) -> f64
pub fn offset_ticks(&self) -> f64
Returns the smoothed server-minus-client Tick offset.
Sourcepub fn network_round_trip_time(&self) -> Option<Duration>
pub fn network_round_trip_time(&self) -> Option<Duration>
Returns the smoothed network RTT after subtracting server processing.
Trait Implementations§
Source§impl Clone for TickSynchronizer
impl Clone for TickSynchronizer
Source§fn clone(&self) -> TickSynchronizer
fn clone(&self) -> TickSynchronizer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TickSynchronizer
impl RefUnwindSafe for TickSynchronizer
impl Send for TickSynchronizer
impl Sync for TickSynchronizer
impl Unpin for TickSynchronizer
impl UnsafeUnpin for TickSynchronizer
impl UnwindSafe for TickSynchronizer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more