The fun of input devices

So I’ve been looking around at various input devices again, and pondering about how VectorStorm might support them.  Tablets and styluses and light guns are, of course, easy, as from software’s point of view, they’re basically just mice which have cursors which ought to vanish when their buttons aren’t being held down..  the VectorStorm engine can handle these quite easily right now.

Multitouch surfaces (such as many modern laptop trackpads, iPhones, and other devices) are a little more tricky;  one could argue that they’re just multiples of the tablet “vanishing mouse”;  instead of one cursor that behaves that way, you have three or four of them.  Unfortunately, none of them are actually implemented that way in the OS, and the current version of SDL which I use doesn’t support these types of devices.  Well.. my MacBook Pro’s trackpad has a “two-finger-scrollwheel” feature which works in VectorStorm games, but only because it’s being treated as a scrollwheel.

Speaking of scroll wheels, it’s worth mentioning that under Windows and Linux, scroll wheels act like buttons.  They have integer “clicks”, and send a “button down” event every time they’re spun a distance of one “click”, however that’s defined for the particular mouse.  You can’t scroll by a half-click;  if you had a mouse which didn’t have ‘stops’ on it, and you spun the wheel by half of a ‘click’ (however far that is on that mouse), you’d get no scrolling at all.  By contrast, under Mac OS X, scroll wheels typically have no ‘stops’, and report a floating point distance.  The VectorStorm engine treats a scroll wheel as a digital button — that is, the extra precision available under OS X is lost.  Or to be more specific, SDL swallows that extra precision, and never shows it to VectorStorm in the first place.  Similarly, the current version of SDL does not support horizontal scroll wheels at all, either on the rare Windows mice equipped with them, or Apple’s “scroll ball” on the Mighty Mouse or two-finger scrolling on trackpads or touch-scrolling on the Magic Mouse.  SDL does support tilt wheels, which while still somewhat unusual, are no longer considered exotic under Windows.  On tilt wheels, the left and right tilting of the wheel shows up as two extra mouse buttons, and so can easily be mapped to functions inside VectorStorm.  I imagine that proper support for horizontal scrolling is probably going to require a new version of SDL, and even then, it probably won’t support full-resolution scrolling  under OS X.  And even if full-resolution scrolling was supported for OS X, I couldn’t actually use it for anything important, as Windows and Linux users wouldn’t have access to it, as it’s not provided at an OS level for them.

Most popular custom controllers like Guitar Hero guitars and Dance Dance Revolution mats are easy to support;  they’re just joysticks without the sticks.  If you can get your OS to detect them as gamepads, VectorStorm should be able to make use of them.

Gesture controls are, of course, big business these days, and every platform does them slightly differently.  But when you come right down to it, gesture controls are the first big thing that really doesn’t fit well into the VectorStorm input model.  Oh, sure, I briefly ported VectorPhysics (from the testbed apps) over to the iPhone, and used the accelerometer to set the gravity for the simulation.  But I couldn’t use SDL to get at the data, and passing the data through the sysInput interface was a real kludge;  sysInput is designed to handle one-dimensional data.  Passing matrices and 3D vectors through it was just awkward and unpleasant.  I don’t expect to see SDL providing support for these any time soon.

And things like Microsoft’s Project Natal would be even more difficult to shoehorn into my current input model, which was relying on all input forms being, at a certain level, exactly the same, as they have been pretty much from the Atari 2600 up until the Wii, with only very minor evolutionary adjustments a few times per decade.