tmp64 / BugfixedHL-Rebased

Bugfixed and improved Half-Life
GNU General Public License v3.0
109 stars 21 forks source link

Direct Input #216

Open gohlrhi opened 4 months ago

gohlrhi commented 4 months ago

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

tmp64 commented 4 months ago

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

The three input modes are:

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 commented 3 months ago

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 commented 3 months ago

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

gohlrhi commented 3 months ago

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 commented 3 months ago

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

tmp64 commented 3 months ago

@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 commented 3 months ago

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.