add prediction

main
_ 2022-01-09 14:26:09 +00:00
parent e742bcad5c
commit 176ff3de42
1 changed files with 7 additions and 1 deletions

View File

@ -364,7 +364,13 @@ async fn main () -> Result <()> {
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;
if graphics.frames == next_upf_print {