From 2a9e848541f2e0c24aeb3bcf989691a6992cd045 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Wed, 15 Jan 2025 02:59:40 -0800 Subject: [PATCH] explain non-determinism bug --- strafe-client/src/mouse_interpolator.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/strafe-client/src/mouse_interpolator.rs b/strafe-client/src/mouse_interpolator.rs index b447990..233355d 100644 --- a/strafe-client/src/mouse_interpolator.rs +++ b/strafe-client/src/mouse_interpolator.rs @@ -122,7 +122,12 @@ impl MouseInterpolator{ // case 3: stop // a mouse event is buffered, but no mouse events have transpired within 10ms - // push buffered mouse instruction and flush buffer to output + // This is a potential source of non-determinism + // since the timestamp from the first instruction after timeout is used + // and not the precise timeout timestamp. + // This can be fixed by polling the mouse interpolator for timeout externally + // and then conditionally running the timeout right before every instruction. + // Essentially moving this if statement outside where the timer is accessible. if self.get_mouse_timedout_at(ins.time).is_some(){ // push buffered mouse instruction and flush buffer to output self.timeout_mouse(ins.instruction.time);