Rebel Fork Framework
Urho3D::TickSynchronizer Class Reference

#include <Urho3D/Replica/TickSynchronizer.h>

Public Member Functions

 TickSynchronizer (unsigned leaderFrequency, bool isServer)
 
void SetFollowerFrequency (unsigned followerFrequency)
 
unsigned Synchronize (float overtime)
 
void Update (float timeStep)
 Update follower clock within one tick of leader clock.
 
unsigned GetPendingFollowerTicks () const
 
unsigned GetFollowerFrequency () const
 
float GetFollowerAccumulatedTime () const
 

Private Member Functions

void NormalizeOnClient ()
 

Private Attributes

const unsigned leaderFrequency_ {}
 
const bool isServer_ {}
 
unsigned followerFrequency_ {}
 
float timeAccumulator_ {}
 
unsigned numFollowerTicks_ {}
 
unsigned numPendingFollowerTicks_ {}
 

Detailed Description

Helper class that synchronizes two fixed-timestep clocks. Leader clock should not tick faster than follower clock. Leader clock should be explicitly reset on each tick.

Member Function Documentation

◆ Synchronize()

unsigned Urho3D::TickSynchronizer::Synchronize ( float  overtime)

Synchronize with tick of the leader clock. Overtime specifies how much time passed since leader clock tick. Returns number of follower clock ticks before leader and follower clocks are synchronized.


The documentation for this class was generated from the following files: