ValveSoftware / csgo-osx-linux

Counter-Strike: Global Offensive
http://counter-strike.net
766 stars 68 forks source link

[Linux] Auto-walk, movement keys hangs #501

Open ghost opened 8 years ago

ghost commented 8 years ago

At least a couple of times every match I start to auto-walk. The game misses the fact I released the button and just keeps on walking until I press the button down again and release it. You should fire the guy doing the keyboard code because this is an (extremely classic) acceptable bug for 11 year old kids, not for Valve.

FiraWolf commented 8 years ago

Does it come with micro stutters?

I got the same issue but only after a 1/2 sec freeze (micro stutter..)

ghost commented 8 years ago

Yes it only comes with stutters. They are missing the fact that I released the key (which is impossible to do if the code was properly written).

Gasur commented 8 years ago

@alexhultman While you're quick to jump and insult the developers, you fail to see the underlying issue. The issue here is that no input nor output is being updated, thus it does not detect any input (mouse, keyboard etc) nor does it detect/show any output such as graphical information. This does not have ANYTHING to do with the code checking if you still have it pressed down or not, as that code functions properly. It's another issue you need to look at, which is the stutter, that is what makes this work.

ghost commented 8 years ago

So are you done with your bullshitting? Do you even know what an interrupt is? Do you even know what an event is?

Your app gets keyboard press & release as events that are fired from interrupts by the system. If you use events, you are never going to have the auto-walk issue.

If you, however, in some crazy way do some crazy polling of the keyboard every frame (which about every game ever done does) you might get auto-walks. But even when you poll the keyboard every frame you should still be able to catch a release, like so:

bool shouldWalk = pollKey('W'); Even if you miss a frame, the next frame should poll the state of the key and see that in fact it is not still down. So I don't know how they messed this thing up but they sure did because auto-walk is a pretty serious bug in a competitive game where you get INF bad aim when you walk. No other game except Natural Selection 2, which is one of my 80+ Linux games, have this issue.
Gasur commented 8 years ago

Great idea. Lets waste CPU cycles on checking every single key on your keyboard. While we're at it, lets do that for the mouse too.

That's not how it should be done. Shouldn't have trade optimization for some simple wontfix bug, that I wouldn't really classify as a proper bug. This affects barely anyone and if you start checking events, that'll result in less FPS, regardless of how many times it checks, it's useless.

But yes, go on - let us just pretend that you know better than Valve :)

mlandalv commented 8 years ago

I have the same problem. Small micro stutters from time to time, and as OP points out the game misses the fact that buttons may have been released during that time.

I've tried to get rid of the micro stutters with cl_forcepreload 1, launching the game with -threads 4 , enabling/disabling multicore rendering (disabling it actually made it better in Left 4 Dead 2, but not CSGO), setting max performance in the NVIDIA Control Panel. No luck so far.

Processor Information:
    Vendor:  GenuineIntel
    CPU Family:  0x6
    CPU Model:  0x2a
    CPU Stepping:  0x7
    CPU Type:  0x0
    Speed:  5900 Mhz
    8 logical processors
    4 physical processors
    HyperThreading:  Supported
    FCMOV:  Supported
    SSE2:  Supported
    SSE3:  Supported
    SSSE3:  Supported
    SSE4a:  Unsupported
    SSE41:  Supported
    SSE42:  Supported

Network Information:
    Network Speed:  

Operating System Version:
    "Arch Linux" (64 bit)
    Kernel Name:  Linux
    Kernel Version:  4.2.3-1-ARCH
    X Server Vendor:  The X.Org Foundation
    X Server Release:  11702000
    X Window Manager:  Xfwm4
    Steam Runtime Version:  steam-runtime-release_2015-06-12

Video Card:
    Driver:  NVIDIA Corporation GeForce GTX 960/PCIe/SSE2

    Driver Version:  4.5.0 NVIDIA 355.11
    OpenGL Version: 4.5
    Desktop Color Depth: 24 bits per pixel
    Monitor Refresh Rate: 59 Hz
    VendorID:  0x10de
    DeviceID:  0x1401
    Number of Monitors:  1
    Number of Logical Video Cards:  1
    Primary Display Resolution:  1920 x 1200
    Desktop Resolution: 1920 x 1200
    Primary Display Size: 20.43" x 12.76"  (24.06" diag)
                                            51.9cm x 32.4cm  (61.1cm diag)
    Primary Bus: PCI Express 16x
    Primary VRAM: 4096 MB
    Supported MSAA Modes:  2x 4x 8x 16x 

Sound card:
    Audio device: Realtek ALC889

Memory:
    RAM:  16019 Mb

Miscellaneous:
    UI Language:  English
    LANG:  en_US.utf8
    Microphone:  Not set
    Total Hard Disk Space Available:  168880 Mb
    Largest Free Hard Disk Block:  74526 Mb

Installed software:

Recent Failure Reports:
ghost commented 8 years ago

Gasur, are you for real? Like, for realz?

FPS drops because you use events? Are you for real? My CPU is used like 10% of its capacity when rendering CSGO so if we assume you are correct it will not touch the FPS since it is not CPU bound. Never mind the fact that you are not correct.

So we can have a broken game that auto-walks or we can have a game that works. You consider polling the keyboard every frame less of a CPU waste than updating a boolean value on key down & up?

And no, Valve does not have monopoly on knowledge about basic keyboard input...

ghost commented 8 years ago

If you have 20 keys you are interested that means 20 polls per frame. Compare this to no polls per frame but instead one event call per key down and up. Polling is always slower no matter how you look at it. Also, whwn writing in the chat, they never drop keypresses meaning thry already use events. They might even use events for wasd, I don't know. It can be a problem in SDL, I don't know but the game is broken anyways.

ghost commented 8 years ago

What kind of brand your GPU has is not relevant. Most people doesn't have this bug.

The bug is not about having stutters or not having stutters - the bug is about writing code that handles stutters.

Stutters or not, input code should never miss anything. Events are queued meaning it doesn't matter if you stutter for 1ms or for 1 hour - the input is never lost if done correct.

Haven't you experienced typing into MS Word while the computer completely froze - then after like 5 seconds of total freeze the letters you typed still pop up. That's what I'm talking about - ensuring that input is never lost.

In games, I have seen this bug many times. Crysis is one such example. They even used polling for mouse clicks, meaning if you had less FPS than the speed of your click, the click did not register. If you click the mouse for 0.01 seconds, then at least one frame needs to poll the mouse when it is down. Now, given the FPS can drop or be low all the time, the click can get lost. In Crysis I had to hold down my mouse button for 1 second to get it to register (slow computer).

This is why you never should do polling - because it does not guarantee that the input gets registered. When you hit a key, the CPU jumps to a registered interrupt handler, this handler can then queue a software event that your app can process when it has the CPU time.

So yes, these things are so low level that even the CPU has built in hardware handling of keyboard events (or rather, many different events).

If you tap into these events, you never lose input.

Wieku commented 8 years ago

I fixed problem with micro-stuttering. Just turned off conky. Not sure about autowalking.

FiraWolf commented 8 years ago

@LudziE12 Conky stutters are a whole different story, as they appear on every conky refresh (like evey 1 second). They also can be avoided with a certain command (forgot which one, though... maybe "no_buffers yes" or "double_buffer yes")

UPDATE: It seems he is right. After killing Conky, there wasn't 1 stutter in 4 games (community server, comp rules)

UPDATE2: Screw it. Stutters still do happen in comp MM games. Seems to be less often without conky but that might be a placebo.

mlandalv commented 8 years ago

I still have this problem. I have a GTX 960 and I'm using the 358.16 drivers. Is this problem limited to NVIDIA users with the proprietary driver?

NeKJ commented 8 years ago

I have this issue too. The game "randomly" freezes for half a second and the keyboard keys get stuck. Also this seems to be a more generalized problem with the input of the game, when these microstutters happen everything gets out of whack: The netcode stutters (you can see people stuttering for half a second after the freeze), your movement stutters, your position changes etc.

It seems that somehow the game enters a tick that takes way too long which results in all timings getting unsynced causing many issues. The biggest issue is what this issue is about, keys stuck, but I think the underlying issue should be invistigated and fixed so these microstutters never happen and the game be always smooth and with no stuttering. That would make csgo perfect.

Processor Information:
    Vendor:  GenuineIntel
    CPU Family:  0x6
    CPU Model:  0x1a
    CPU Stepping:  0x5
    CPU Type:  0x0
    Speed:  2668 Mhz
    8 logical processors
    4 physical processors
    HyperThreading:  Supported
    FCMOV:  Supported
    SSE2:  Supported
    SSE3:  Supported
    SSSE3:  Supported
    SSE4a:  Unsupported
    SSE41:  Supported
    SSE42:  Supported

Network Information:
    Network Speed:  

Operating System Version:
    Linux (64 bit)
    Kernel Name:  Linux
    Kernel Version:  4.3.3-2-ARCH
    X Server Vendor:  The X.Org Foundation
    X Server Release:  11800000
    X Window Manager:  KWin
    Steam Runtime Version:  steam-runtime-release_2015-06-12

Video Card:
    Driver:  NVIDIA Corporation GeForce GTX 760/PCIe/SSE2

    Driver Version:  4.5.0 NVIDIA 358.16
    OpenGL Version: 4.5
    Desktop Color Depth: 24 bits per pixel
    Monitor Refresh Rate: 59 Hz
    VendorID:  0x10de
    DeviceID:  0x1187
    Number of Monitors:  2
    Number of Logical Video Cards:  1
    Primary Display Resolution:  2560 x 1600
    Desktop Resolution: 4480 x 1600
    Primary Display Size: 25,43" x 15,98"  (30,00" diag)
                                            64,6cm x 40,6cm  (76,2cm diag)
    Primary Bus: PCI Express 16x
    Primary VRAM: 2048 MB
    Supported MSAA Modes:  2x 4x 8x 16x 

Sound card:
    Audio device: 

Memory:
    RAM:  24105 Mb

Miscellaneous:
    UI Language:  English
    LANG:  el_GR.UTF-8
    Microphone:  Not set
    Total Hard Disk Space Available:  75294 Mb
    Largest Free Hard Disk Block:  45771 Mb

Installed software:

Recent Failure Reports:
    Sat Jan  9 17:15:25 2016 GMT: file ''/tmp/dumps/crash_20160109190714_1.dmp'', upload yes: ''Discarded=1''
mlandalv commented 8 years ago

@Nek80 OK, so you have an NVIDIA card too with the proprietary drivers too. I had an ATI card half a year or so ago and used the open source drivers then. I can't recall having this problem back then, but i could be wrong.

NeKJ commented 8 years ago

@mlandalv this issue really started happening 3-5 months ago only.

mlandalv commented 7 years ago

Is there something we/I can do to help narrow down the problem? I seem to get this micro-stutter in every source game (CSGO, L4D2, Insurgency). Keys hanging doesn't occur as often as earlier, but the stutter is still there.

The stuttering is more noticable when increasing the GFX settings. Something to do with loading resources? Is it possible to preload everything?

System info

Gasur commented 7 years ago

@mlandalv The problem described in this issue is the key hangs. Key hanging that does not occur very often and on very few systems as well, is not a priority to fix. Besides, it's not a game breaking bug, but just a small annoyance. Valve has other things they would like to get fixed first.

anibyl commented 7 years ago

I've fixed it by killing xneur that is actually a keyboard helper. Hope it can help.