fn max_frames_per_tick(&self) -> u32 {
        const MAX_FRAMES_PER_TICK: u32 = 5;

        if self.recent_run_frame_timings.is_empty() {
            5
        } else {
            let frame_time = 1000.0 / self.frame_rate;
            let average_run_frame_time = self.recent_run_frame_timings.iter().sum::<f64>()
                / self.recent_run_frame_timings.len() as f64;
            ((frame_time / average_run_frame_time) as u32)
                .max(1)
                .min(MAX_FRAMES_PER_TICK)
        }
    }
/// Get rough estimate of the max # of times we can update the frame.
///
/// In some cases, we might want to update several times in a row.
/// For example, if the game runs at 60FPS, but the host runs at 30FPS
/// Or if for some reason the we miss a couple of frames.
/// However, if the code is simply slow, this is the opposite of what we want;
/// If run_frame() consistently takes say 100ms, we don't want `tick` to try to "catch up",
/// as this will only make it worse.
///
/// This rough heuristic manages this job; for example if average run_frame()
/// takes more than 1/3 of frame_time, we shouldn't run it more than twice in a row.
/// This logic is far from perfect, as it doesn't take into account
/// that things like rendering also take time. But for now it's good enough.
Get rough estimate of the max # of times we can update the frame.
In some cases, we might want to update several times in a row.
For example, if the game runs at 60FPS, but the host runs at 30FPS
Or if for some reason the we miss a couple of frames.
However, if the code is simply slow, this is the opposite of what we want;
If run_frame() consistently takes say 100ms, we don't want `tick` to try to "catch up",
as this will only make it worse.

This rough heuristic manages this job; for example if average run_frame()
takes more than 1/3 of frame_time, we shouldn't run it more than twice in a row.
This logic is far from perfect, as it doesn't take into account
that things like rendering also take time. But for now it's good enough.
Get rough estimate of the max # of times we can update the frame . In some cases we might want to update several times in a row . For example if the game runs at 60FPS but the host runs at 30FPS Or if for some reason the we miss a couple of frames . However if the code is simply slow this is the opposite of what we want ; If run_frame () consistently takes say 100ms we don ' t want ` tick ` to try to " catch up " as this will only make it worse . This rough heuristic manages this job ; for example if average run_frame () takes more than 1 / 3 of frame_time we shouldn ' t run it more than twice in a row . This logic is far from perfect as it doesn ' t take into account that things like rendering also take time . But for now it ' s good enough .
fn max_frames_per_tick(&self) -> u32 {
        const MAX_FRAMES_PER_TICK: u32 = 5;
        if self.recent_run_frame_timings.is_empty() {
            5
        } else {
            let frame_time = 1000.0 / self.frame_rate;
            let average_run_frame_time = self.recent_run_frame_timings.iter().sum::<f64>()
                / self.recent_run_frame_timings.len() as f64;
            ((frame_time / average_run_frame_time) as u32)
                .max(1)
                .min(MAX_FRAMES_PER_TICK)
        }
    }
fn max_frames_per_tick ( & self ) -> u32 { const MAX_FRAMES_PER_TICK : u32 = 5 ; if self . recent_run_frame_timings . is_empty ( ) { 5 } else { let frame_time = 1000.0 / self . frame_rate ; let average_run_frame_time = self . recent_run_frame_timings . iter ( ) . sum :: < f64 > ( ) / self . recent_run_frame_timings . len ( ) as f64 ; ( ( frame_time / average_run_frame_time ) as u32 ) . max ( 1 ) . min ( MAX_FRAMES_PER_TICK ) } }
Get rough estimate of the max # of times we can update the frame.
Get rough estimate of the max # of times we can update the frame .
&self
&self