Re: Fwd: Joystick support

On Mon, Aug 29, 2011 at 7:54 AM, Olli Pettay <Olli.Pettay@helsinki.fi> wrote:
> On 08/29/2011 03:44 PM, Arthur Barstow wrote:
>>
>> Hi All - FYI, below is a thread started by Scott Graham re creating a
>> Joystick API standard [1]. I am forwarding Scott's email to the Web
>> Events WG's list since some people suggested this WG would be a
>> reasonable place to create a W3C standard for this API.
>>
>> Scott - when you have created the "rough strawman" you referred to in
>> [2], please notify the public-webevents@w3.org list.
>>
>
>
> Well, there is already https://wiki.mozilla.org/JoystickAPI
> as a possible starting point for discussions.

Indeed, David and Ted (and others?) have done a good job of getting
that documented already, we should start there.

Here's some things I'd like to to address relative to that document
(some already discussed on mozilla bugzilla, just for a summary here):

- I'd like to see a global object as a way to access the joystick
aside from the connected and disconnected events. window.joysticks
seems like 'right' place, but to avoid the interceptor/globalness,
perhaps document.joysticks would be best. This would be an enumerable
containing the connected and interacted-with joysticks.

- Add a .index field to joystick data to identify which joystick is
which when multiple are attached. See also
https://bugzilla.mozilla.org/show_bug.cgi?id=604039#c92 and
https://bugzilla.mozilla.org/show_bug.cgi?id=604039#c93 w.r.t.
determining what happens when joysticks are detached/reattached.

- The buttons array talks about 0 and 1, but that should be 0.0 and
1.0 for analog buttons.

- Add a timestamp on the joystick data to let the author determine if
the data are fresh (monotonically increasing, no particular meaning
other than the device has been polled again)

- I'd like to see the addition of suggested dead-zone data. The data
reported from the joystick object should only be linearly normalized
to the -1..1 or 0..1 range, but otherwise uninterpreted. Some joystick
APIs offer suggested deadzone values for the attacked device (e.g.
http://msdn.microsoft.com/en-us/library/ee417001(v=vs.85).aspx#dead_zone)
so it would be good to make those available to authors. I guess this
would also hang off of the joystick object.

- I'd like to see some way to clearly allow the author to identify the
specific brand of controller. This is needed to display on-screen user
instructions. For example, "press button 3 to jump" is not at all
helpful, where "press X to jump" is. Certainly there should be a
fallback for generic or unknown types of controllers, but being able
to customize for common controller types is important. I think simply
having some sort of general understanding of what will be reported in
".id" is sufficient.

My feedback is based on the polling api, I haven't had a chance to
prototype with the events-based one yet. I do worry about the
usefulness of the events-based one because of analog sampling noise --
when exactly should events be triggered if an analog axis is
"jiggling" without the user doing anything?

Regards,
scott

Received on Monday, 29 August 2011 15:41:50 UTC