add prediction
parent
e742bcad5c
commit
176ff3de42
|
@ -364,7 +364,13 @@ async fn main () -> Result <()> {
|
||||||
|
|
||||||
window.gl_make_current (&gl_ctx).unwrap ();
|
window.gl_make_current (&gl_ctx).unwrap ();
|
||||||
|
|
||||||
graphics.draw (&game_state.static_level, &game_state.logic, &mut gl_state, &level, &camera);
|
let prediction_frames = 4;
|
||||||
|
let mut predicted_logic = game_state.logic.clone ();
|
||||||
|
for _ in 0..prediction_frames {
|
||||||
|
predicted_logic.step (&game_state.static_level, &phys_params, p_gp);
|
||||||
|
}
|
||||||
|
|
||||||
|
graphics.draw (&game_state.static_level, &predicted_logic, &mut gl_state, &level, &camera);
|
||||||
graphics.frames += 1;
|
graphics.frames += 1;
|
||||||
|
|
||||||
if graphics.frames == next_upf_print {
|
if graphics.frames == next_upf_print {
|
||||||
|
|
Loading…
Reference in New Issue