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

Lag seems to cause key release events to be missed #4664

Open
makoConstruct opened this issue May 5, 2022 · 5 comments
Open

Lag seems to cause key release events to be missed #4664

makoConstruct opened this issue May 5, 2022 · 5 comments
Labels
A-Input Player input via keyboard, mouse, gamepad, and more C-Bug An unexpected or incorrect behavior

Comments

@makoConstruct
Copy link

makoConstruct commented May 5, 2022

Bevy version

[[package]]
name = "bevy"
version = "0.7.0"

Operating system & version

Debian Linux, Wheezy

What you did

Ran a debug build of alien_cake_addict on my ancient gtx 980 (760?). Tried to play.

What happened

The framerate was low (maybe around 20fps). The keys tended to get stuck, in a sense, I would run in one direction for a bit, I would release the key, I'd press other directions, but the alien would not stop running in that direction, could not be turned. It would eventually stop pushing in that direction, seemingly at random, usually after the nearest cake had been tragically missed.

Oddly, the game also seemed to be harder with the lag (as if there were was less time to get each cake)

I can't think of a reason this amount of lag should cause this, but it seems to, and that makes me worry that sometimes it might miss key state changes at a normal framerate too, or during a lag spike.

Additional Information

Sometimes when my entire system is lagging, key repeats will occur. I wouldn't expect this to be the same issue though.

@makoConstruct makoConstruct added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels May 5, 2022
@makoConstruct makoConstruct changed the title Lag causes key release events to be missed Lag seems to be causing key release events to be missed May 5, 2022
@TheRawMeatball
Copy link
Member

Run in release mode instead. Rust debug builds are notoriously slow and bevy suffers these issues too. As for when making your own games, the tips in here: https://bevy-cheatbook.github.io/pitfalls/performance.html will likely be useful.

@makoConstruct
Copy link
Author

I did also try it in release mode, and performance was fine, and no key events were dropped. That doesn't solve the problem: Some amount of lag is often inevitable no matter how well a game is optimized, and dropping key events during those times seems bad and unnecessary.

@makoConstruct makoConstruct changed the title Lag seems to be causing key release events to be missed Lag seems to cause key release events to be missed May 5, 2022
@alice-i-cecile alice-i-cecile added A-Input Player input via keyboard, mouse, gamepad, and more and removed S-Needs-Triage This issue needs to be labelled labels May 5, 2022
@makoConstruct
Copy link
Author

related comment about input being dropped. Is running a faster polling loop really a sensible solution to this issue?/bug? #1343 (comment)

@geirsagberg
Copy link

geirsagberg commented Sep 8, 2022

Related problem, seems to be an issue whenever key repeat rate is faster than fps: #5909

@alice-i-cecile
Copy link
Member

Consolidating with #5984.

@B-head B-head mentioned this issue Jul 4, 2023
8 tasks
github-merge-queue bot pushed a commit that referenced this issue Aug 15, 2023
…in one frame (#9446)

# Objective

- Currently, (AFAIC, accidentally) after registering an event for a
Gilrs button event, we ignore all subsequent events for the same button
in the same frame, because we don't update our filter. This is rare, but
I noticed it while adding gamepad support to a terminal app rendering at
15fps.
- Related to #4664, but does not quite fix it.

## Solution

- Move the edit to the `Axis<GamepadButton>` resource to when we read
the events from Gilrs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Input Player input via keyboard, mouse, gamepad, and more C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

No branches or pull requests

4 participants