From b3f780204680bc1786db34c3d80c74c88fd86311 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Sat, 30 Sep 2023 00:13:26 -0700 Subject: [PATCH] Idle instruction: important concept for marking the end of instruction streams, including real time networking --- src/body.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/body.rs b/src/body.rs index a70d37bb..005d3a7e 100644 --- a/src/body.rs +++ b/src/body.rs @@ -29,6 +29,10 @@ pub enum InputInstruction { Jump(bool), Zoom(bool), Reset, + Idle, + //Idle: there were no input events, but the simulation is safe to advance to this timestep + //for interpolation / networking / playback reasons, most playback heads will always want + //to be 1 instruction ahead to generate the next state for interpolation. } pub struct Body { @@ -1022,6 +1026,7 @@ impl crate::instruction::InstructionConsumer for PhysicsStat self.walk.state=WalkEnum::Reached; self.grounded=false; }, + InputInstruction::Idle => (),//literally idle! } //calculate control dir let camera_mat=self.camera.simulate_move_rotation_y(self.mouse_interpolation.interpolated_position(self.time).x-self.mouse_interpolation.mouse0.x);