Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input delay when moving mouse #2

Open
tqwewe opened this issue Jan 8, 2024 · 3 comments
Open

Input delay when moving mouse #2

tqwewe opened this issue Jan 8, 2024 · 3 comments

Comments

@tqwewe
Copy link

tqwewe commented Jan 8, 2024

Thanks for building such an awesome showcase!

I just compiled it and tested it myself, though there's quite a noticeable delay when moving my mouse to click buttons. I ran in release mode, and my PC is quite powerful with a 4070, so its definitely not my PC under performing.

Any ideas where this delay might be coming from?

For context, here's some of the logs I see when running the app:

AdapterInfo { name: "NVIDIA GeForce RTX 4070", vendor: 4318, device: 10118, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "535.86.05", backend: Vulkan }
SystemInfo { os: "Linux 23.05 NixOS", kernel: "6.1.63", cpu: "13th Gen Intel(R) Core(TM) i5-13600KF", core_count: "14", memory: "31.2 GiB" }

And I'm on Linux

@nicopap
Copy link

nicopap commented Jan 8, 2024

Bevy by default has the worst possible input latency. IE: it polls input right after the end of the previous frame, resulting on input latency of exactly one frame, even without counting accidental lag caused by bad system ordering. Using bevy_framepace might help a bit https://crates.io/crates/bevy_framepace

@IDEDARY
Copy link
Owner

IDEDARY commented Jan 8, 2024

@nicopap This is a usefull advice, thanks. I will try it if there is a difference. Bevy_Lunex currently uses a dummy entity to track cursor, so you can style it. Notice the bloom of the cursor for example. It pulls cursor data, puts it as transform on entity and then that is used. So there might even be 2 frame delay. I will try to add option to style native cursor sprite instead, which was recently merged in winit. Altough, its kinda surprising you noticed this delay. When OS cursor is hidden, I can't tell the difference, but that might be because of my 165hz display.

@tqwewe
Copy link
Author

tqwewe commented Jan 9, 2024

I've tried setting the present_mode to PresentMode::Immediate, since I noticed it was capped at 60fps, and this definitely removed the input delay feeling.. though I was getting over a thousand FPS at that point.
I'm not sure why it was capped at 60fps since my monitor is 144hz.
(Btw the background moving graphic was animating super fast with a higher FPS compared to a lower FPS).

I added bevy_framepace to have a more reasonable FPS (around 400), and this also felt just fine to move the mouse. Though still not as crispy as styling the native cursor I'd say.

Btw, not related but when I clicked "Quit Game" in the UI, I got a segfault:

fish: Job 1, './bevypunk' terminated by signal SIGSEGV (Address boundary error)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants