diff --git a/crates/shards/src/plugins.rs b/crates/shards/src/plugins.rs index 5e1b26c8..4315a601 100644 --- a/crates/shards/src/plugins.rs +++ b/crates/shards/src/plugins.rs @@ -270,8 +270,22 @@ impl Plugin for EmbeddedLogCapture { fn with_window(group: PluginGroupBuilder, config: &EngineConfig) -> PluginGroupBuilder { let (width, height) = config.window; - let window = Window { title: config.title.clone(), resolution: (width, height).into(), ..default() }; - let group = group.set(WindowPlugin { primary_window: Some(window), ..default() }); + // The least latency a hand on the mouse can feel, at some of the frame rate: one frame queued on the GPU, not + // Bevy's two, and no pipelined rendering (with it the main world works on the next frame while this one is drawn, + // which is one frame more between a mouse move and the picture). With vsync and both, a look turned 3 to 4 frames + // after the hand moved, which a player felt as smoothing on the mouse. + let window = Window { + title: config.title.clone(), + resolution: (width, height).into(), + desired_maximum_frame_latency: std::num::NonZeroU32::new(1), + ..default() + }; + #[cfg_attr(not(feature = "render"), allow(unused_mut))] + let mut group = group.set(WindowPlugin { primary_window: Some(window), ..default() }); + #[cfg(feature = "render")] + if group.contains::() { + group = group.disable::(); + } // `/icon.png`, if the game has one, in the title bar and the taskbar; how long frames take. #[cfg(feature = "render")] let group = group