See:
|
const TARGET_TPS: u64 = 60; |
which is used for estimating the remote player's frame for timesyncing purposes:
|
pub fn set_local_frame_number(&self, local_frame: Frame) { |
|
let mut stats = self.stats.write(); |
|
// Estimate which frame the other guy is one by looking at the |
|
// last frame they gave us plus some delta for the one-way packet |
|
// trip time. |
|
let remote_frame = self.input_decoder.last_decoded_frame() |
|
+ (stats.round_trip_time.as_secs() * TARGET_TPS) as i32; |
|
|
|
// Our frame advantage is how many frames *behind* the other guy |
|
// we are. Counter-intuative, I know. It's an advantage because |
|
// it means they'll have to predict more often and our moves will |
|
// pop more frequently. |
|
stats.local_frame_advantage = remote_frame - local_frame; |
|
} |
On an unrelated note, it that calculation correct? The comment seems to suggest round_trip_time.as_secs() / 2.
See:
backroll-rs/backroll/src/protocol/mod.rs
Line 38 in 3c6bdc0
which is used for estimating the remote player's frame for timesyncing purposes:
backroll-rs/backroll/src/protocol/mod.rs
Lines 740 to 753 in 3c6bdc0
On an unrelated note, it that calculation correct? The comment seems to suggest
round_trip_time.as_secs() / 2.