[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Choppy analog input on Linux



My game can be downloaded here:
http://www.box.net/shared/dti5isqh2s

This (incomplete) game, Hand2Hand, supports analog control, something I definitely do not want to sacrifice. However, I have noticed a problem with it. While analog control works perfectly on Windows (Windows Vista, using the default Microsoft joystick driver), it is incredibly choppy and unreliable on Linux (Fedora 14, GNOME, using the Linux Joystick Driver). Basically, it seems to not update always; in many cases, if I move the stick too fast, additional movement will be undetected, resulting for example in a centered stick appearing to the game to be at a position it previously was at.

I have tested this on two controllers: my Logitech F310 and my Dualshock 3. The F310 has excellent analog sticks and is therefore barely affected by this problem (so little that it makes no difference in my game); however, the Dualshock 3 has bad enough analog controls that the sticks are rendered absolutely useless; it is not uncommon for the stick to be centered while the game reads it as being tilted halfway in one direction (the one it was in previously), which is quite significant in my game.

I know the problem is not in the Linux Joystick Driver itself, because when I run jstest, both controllers properly register as being centered without failure when the sticks are centered.

Am I experiencing a bug in Pygame or maybe SDL itself? Or is there maybe something in my code that I'm not noticing which is wrong? The relevant code is in hand2hand.py, somewhere around lines 733-807 (the get_joystick_input method of Console) and lines 482-504 (in the start_game method of Console). The impression I get is that Pygame is somehow not receiving all of the joystick events sent by the driver, causing an axis to appear tilted when it is actually centered. Any thoughts/ideas?

Thanks!