[aquaria] joystick support

Mathias Panzenböck grosser.meister.morti at gmx.net
Sat Apr 23 15:14:51 EDT 2011

Here are some minor improvements and fixes for joystick support and rumble support under Linux:

Pull URL:

  * properly initialize all joystick effect fields
  * properly close joystick on shutdown!
  * Linux: detect if rumble is supported and don't send rumble events if it isn't
  * Linux: translate leftMotor & rightMotor into direction & magnitude
  * Linux: wrote about rumble support in README.txt

I recommend to pull this, because at least in theory quitting the game without properly shutting 
down the joysticks could cause them to continue rumble without the game running. (If the effect 
replay length is long enough. I think it can't be infinite.)

However, I'm not sure if direction is supported in combination with FF_RUMBLE. I can't feel any 
difference anyway. I use a XBox 360 Gamepad, which should have two rumble motors. But how these two 
motors are meant to be used I'm not sure.

XInput and BBGE denote the motors as "left" and "right", so I figured it might be used to simulate 
movement/position (hence the translation to direction). But here the left and right motors are 
assigned to low- and high-frequency rumbling:

But then Linux defines ff_rumble_effect with a strong_magnitude and weak_magnitude field:

Which denote two motors, but yet with another meaning. So now we have 3 possible meanings for the 
motors: position, frequency and magnitude.

Maybe I should just use 0 for the direction and assign leftMotor to weak_magnitude and rightMotor to 
strong_magnitude? Or the other way around? What do you think?

Also I noticed that joystick support is a bit hacky. Parts of the engine code should be able to cope 
with multiple joysticks but then there is always only one joystick object in the game. This is ok 
for Aquaria, because it is single player only, but the BBGE should be able to do more.

Also maybe more importantly it means that the user has no choice which joystick device he/she can 
use. The user can only use the first joystick (index 0) and has to unplug all joysticks he/she don't 
want to use in case they have a smaller index than the one he/she wants to use. Without an UI with 
which you would be able to choose the joystick you want to use there isn't another way anyway.


More information about the aquaria mailing list