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 GetFollowerFrequency () const
 
unsigned Synchronize (float overtime)
 
void Update (float timeStep)
 Update follower clock within one tick of leader clock.
 
unsigned GetPendingFollowerTicks () const
 Return number of the follower clock ticks that are expected to happen during current engine update.
 
float GetFollowerAccumulatedTime () const
 Return amount of time elapsed after latest follower tick.
 

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 and follower ticks are considered synchronized if their beginnings logically correspond to the same moment in time.

Note
Leader clock should not tick faster than follower clock.
Leader clock should be explicitly reset on each tick.
Follower clock will never tick ahead of the leader clock.

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: