Comment by YetiSpaghetti

Comment by YetiSpaghetti 3 days ago

11 replies

I think the author has two issues in their approach.

1) You should be processing the whole message queue for all types of messages in one go. When using raw input, author is peeking for "not input" event types. To me, this seems suspicious for performance. With a raw input device registered, the message queue is going to be huge.

While I don't know the underlying data structure of the message queue, if we assume an array, then the author's code will do a while loop of O(N) lookups for "not input" messages and remove them.

The correct approach is to dispatch the whole queue and ignore messages of types that you don't care about in your message handler.

2) You SHOULD be using the legacy input events for games, not raw input. The OS input massaging (ex: acceleration) is something that should remain consistent between applications. If there's acceleration: that's what users expect. You don't want the mouse to suddenly behave different in your application. Your games tuning values (sensitivity, accel) should apply relative to the OS values.

Matheus28 3 days ago

For shooter games, raw input is preferred. You want the same amount of mouse movement to move your camera the same amount every time.

In those type of games, you aren’t controlling a cursor, so there’s no “expected behavior”.

  • jamesgeck0 3 days ago

    I'd argue that linear camera movement with mouse _is_ the expected behavior for FPS these days.

  • YetiSpaghetti 3 days ago

    It's more complex than that. There's no right answer and therefore every answer is wrong :(

    For more critical observers, you're right: raw input is preferred. However, most users (casuals) expect similar settings as their OS. It's probably best left up to the user to decide, but to default things to the OS legacy settings. A more advanced player will know to tune the settings while the less advanced just want to launch and go.

    • CrimsonRain 3 days ago

      No. He's right. No fps gamer expects the game camera speed to "match" mouse movement speed. Raw input-> mouse DPI * in game sense = effective dpi. Everyone has their own preferred edpi. This was you can change mouse or computer or in different games, you always get consistent movement.

      • YetiSpaghetti 3 days ago

        Everyone plays fps games. This includes people who wouldn't consider themselves "fps gamers". Users who care about mouse input will go into the settings to target the 'correct' settings for them.

        For everyone else, there's the OS values.

        We're not having the same argument, but I didn't clarify in my initial post properly: It's best to launch your app for the first time with the default OS settings. Let the "power users (fps gamers)" tune settings that enable raw input.

  • ben0x539 3 days ago

    Surely even in a shooter game you spend some amount of time in menus where you do have a cursor, right? Is this why I sometimes get completely 'wrong' cursor movement in games?

munchler 3 days ago

> You SHOULD be using the legacy input events for games, not raw input.

The author claims that this generates an overwhelming number of events for a high-performance mouse. Is this not the case?

  • YetiSpaghetti 3 days ago

    Only when a raw input device is enabled. If I remember correctly, Windows will also send the raw input as legacy input messages. With no raw input device registered, the OG message queue is not bloated.