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

Option needed to disable OS-level adjustment for mouse acceleration #36

Open
NavidZ opened this issue Sep 13, 2018 · 17 comments · May be fixed by #49
Open

Option needed to disable OS-level adjustment for mouse acceleration #36

NavidZ opened this issue Sep 13, 2018 · 17 comments · May be fixed by #49

Comments

@NavidZ
Copy link
Member

NavidZ commented Sep 13, 2018

Some games need to disable mouse acceleration to achieve a better gaming experience (1, 2).

I believe this best fits in the pointerlock request api as an option to provide such a capability. Here is the Windows API allowing to disable that.

@smaug---- @EiraGe WDYT?

@EiraGe
Copy link
Contributor

EiraGe commented Sep 13, 2018

It sounds reasonable to me for letting developers be able to match the physical mouse movement and events movement.
A quick search on the internet I founds it's possible for player to disable mouse acceleration on the OS (except chromeOS crbug.com/589190). Considering gaming user might like to make their own choice on mouse preference, although a bit complicate, I feel adding this is actually less important.

@NavidZ
Copy link
Member Author

NavidZ commented Sep 13, 2018

Is it normal for the games to have this option within them? Or do people usually go and change the settings in their platform to achieve this?

@EiraGe
Copy link
Contributor

EiraGe commented Sep 20, 2018

I'm not familiar with gaming area, so I have no idea how people usually do. I think changing the setting in the platform seems very complicate, so it'd be nice to have this.
I'd also like to have more game developers' opinion to know whether this will help or not. (The cros bug has really high number of stars)

@smaug----
Copy link

I don't have enough experience on games to say what is preferred here. I would expect people to look at the platform prefs. Perhaps @juj has some feedback to this.

@scheib
Copy link
Contributor

scheib commented Oct 8, 2018 via email

@juj
Copy link

juj commented Oct 10, 2018

Games do commonly provide options to users to choose mouse sensitivity, and also sometimes provide options for enabling or disabling mouse acceleration. E.g. Counter-Strike:

steamworkshop_webupload_previewfile_126920260_preview

MineCraft has only a sensitivity setting:

p2j0a

On Windows based games for example, mouse acceleration control is done by switching between Win32 UI Mouse Events API that provides OS-level accelerated/nonlinear input, and Raw Input API that provides linear unaccelerated mouse movement.

The first API reports movement taking into account user's mouse sensitivity and acceleration settings in Windows Control Panel, whereas the second API provides raw input data directly from the mouse device.

If user has disabled mouse acceleration in their Mouse control panel, then Win32 UI events report unaccelerated content, but it is rare to expect players to go manage mouse acceleration and sensitivity for individual games via control panel, hence games providing custom options.

Whether linear or nonlinear acceleration should be used for first person content or some other types of games is a highly subjective experience. E.g. some Counter-Strike players prefer to have acceleration enabled, others prefer to disable it. But both usages are common.

I would recommend here to provide an option in pointer lock to choose between raw/linear input and desktop/nonlinear input. (Recording both linear/nonlinear input data for one event passed to JS would be technically difficult to implement due to lack of coherency in the received events from the OS)

@binoculars88
Copy link

I couldn't explain it better than @juj did above.
As a game developer, I'm definitely rooting for having the option to have as raw mouse input as possible, so we can present our players with options like shown above. Certainly when it comes to releasing for both stand-alone and web, having a consistent mouse movement feel is key for us.

@scheib is there anything in the backlog that would satisfy these desires :) ?

@eliwald
Copy link

eliwald commented Jul 2, 2019

This API would be immensely useful for us. We need the ability to allow games to switch back and forth between raw (non-accelerated) input and desktop (accelerated) input as necessary, depending on the context of their game. Adding this option to the pointerlock API would unlock this use case! :)

@NavidZ NavidZ linked a pull request Jul 16, 2019 that will close this issue
4 tasks
@smaug----
Copy link

Based on some feedback, implementing this properly on all the platforms can be tricky. Linux for example has several ways to control acceleration. And I'm not sure even about MacOS.

@EiraGe @NavidZ have you figured out how to implement this everywhere per program (in such way that if a browser crashes, OS still keeps the original behavior)?

@NavidZ
Copy link
Member Author

NavidZ commented Sep 19, 2019

@whsieh

@scheib
Copy link
Contributor

scheib commented Jun 2, 2020

Work is underway to offer unmodified movement data:

@binoculars88
Copy link

binoculars88 commented Jun 2, 2020

@scheib our users started reporting a bug with pointerlock a few days ago. It seems it started around the 28th of May. Could this be related to the release of Chrome 83? A bit more info on the bug being reported: We have a window saying the pointer isn't locked when that's the case. When users click the window we request a pointerlock again. Never had any issues, but since a couple of days, users complain the window won't go away. We can't consistently reproduce this ourselves, but in the rare case where we see this too, we notice the function gets called but for some reason, the pointer doesn't lock. From that moment on, the Chrome tab seems "broken" and even when refreshing in Incognito, pointerlock will always fail. Only trying it in a new Chrome tab locks the pointer again.

We don't have a lot to go from atm, as we can't reproduce consistently, but I wanted the share this already. The bug is there for sure. We have a very active community, never had bug reports regarding this, but the last days it's one after the other. We haven't made any changes on our side.

We will continue doing tests in the next couple of days. I'll keep you posted if we find something more concrete.

Note: we use requestPointerLock(), not the new requestPointerLock({unadjustedMovement: true})

@scheib
Copy link
Contributor

scheib commented Jun 2, 2020

@binoculars88 It may be related. This forum is for the spec change. Please file a new crbug.com and post a comment on https://crbug.com/982379 indicating that it may be related and we'll take a look. A repro case would help significantly.

@JamesHollyer
Copy link

@smaug---- We have successfully implemented this feature on all Platforms. It is now in Origin Trial and being used by Stadia and Nvidia's Geforce Now. Do you think Mozilla would support implementing this feature now that it is possible on all platforms and starting to get adoption?

@nondebug
Copy link

Based on some feedback, implementing this properly on all the platforms can be tricky. Linux for example has several ways to control acceleration. And I'm not sure even about MacOS.

@smaug---- Chrome implements the option on Windows, macOS, and Chrome OS. On Windows and macOS we don't need to modify any system-wide settings.

Windows: Use the Raw Input API to receive WM_INPUT notifications. RAWMOUSE contains linear unaccelerated pointer data.

macOS: Read CGEvent's kCGEventUnacceleratedPointerMovementX and kCGEventUnacceleratedPointerMovementY fields which are populated on 10.14+ but only declared in the SDK starting from 10.15.1.

No solution for Linux yet.

@smaug----
Copy link

So what does Chrome do then on Linux? Does it not expose unadjustedMovement at all in the dictionary or how can one do feature detection?

@mustaqahmed
Copy link
Member

On Linux, Chrome rejects the promise (and throws an exception) only when the pointer-lock request is made with {unadjustedMovement:true}.

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