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

Direct Input #216

Open
gohlrhi opened this issue Feb 14, 2024 · 7 comments
Open

Direct Input #216

gohlrhi opened this issue Feb 14, 2024 · 7 comments
Labels
client Client-side related question Further information is requested

Comments

@gohlrhi
Copy link

gohlrhi commented Feb 14, 2024

what does direct input do exactly and why is it recommended? Thus what is the difference between engine, raw input and direct input?

@tmp64 tmp64 added question Further information is requested client Client-side related labels Feb 17, 2024
@tmp64
Copy link
Owner

tmp64 commented Feb 17, 2024

TL;DR Use DirectInput on Windows and Raw Input on Linux because there is no mouse acceleration

The three input modes are:

  • Engine (which is incorrectly named, a better name is "WinAPI")
  • Direct Input
  • Raw Input

Engine/WinAPI method queries the on-screen mouse cursor position. This means that mouse movement is influenced by Windows settings (like sensitivity, mouse acceleration).

Direct Input and Raw Input both read raw data directly from the mouse, before Windows processes it.

Direct Input uses DirectX API, while Raw Input uses the SDL2 library bundled with the engine (like Raw Input checkbox in the mouse settings).

Windows: Direct Input is the preferred method on Windows. Before HL25 update, the game used an old version of SDL2 that had some bugs related to mouse input. Also, Direct Input was added to BHL before the 2013 SteamPipe engine update, that added SDL2 and Raw Input.

Linux: There is no WinAPI or DirectX so Raw Input is the only supported method.

@gohlrhi
Copy link
Author

gohlrhi commented Mar 19, 2024

thank you for your answer. i have another question. Via directinput what should be m_customaccel settings? i experienced that even m_customaccel set to 0, when you change m_customaccel exponent and m_customaccel scale values sensitivity or maybe acceleretaion changes. What customaccel settings commonly used and what should they set in order to 1:1 raw no accelereation?

@Safety1st
Copy link

@gohlrhi, when direct input is enabled, accel seeings don't matter anymore.

@gohlrhi
Copy link
Author

gohlrhi commented Mar 19, 2024

I doubt that because when directinput is enabled evet m_customaccel is set to 0 if i change m_customaccel_exponent and m_customaccel_scale values sensitivity and feeling change clearly.

@Safety1st
Copy link

I don't understand what are you talking about 🤷‍♂️

@tmp64
Copy link
Owner

tmp64 commented Mar 19, 2024

@Safety1st Input method only affects how mouse is read. m_customaccel stuff is applied after that, so it works with any input method.

@gohlrhi When m_customaccel == 0, no custom acceleration is applied. The relevant code is here. So it's a placebo effect or something similar. I personally don't feel any changes when setting m_customaccel_scale 1000 or m_customaccel_exponent 10.

Btw, the formula is mousesensitivity = ( rawmousedelta^m_customaccel_exponent ) * m_customaccel_scale + sensitivity

@gohlrhi
Copy link
Author

gohlrhi commented Mar 19, 2024

thanks for your answer but i am sure it feels different by different values of scale and exponent with m_customaccel is set to 0. i have found many other guy complain about it on net so may be there is a bug about it idk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Client-side related question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants