standards-positions icon indicating copy to clipboard operation
standards-positions copied to clipboard

Gamepad API Trigger-Rumble Haptics Extension

Open gabrielsanbrito opened this issue 3 years ago • 12 comments

Request for position on an emerging web specification

Information about the spec

  • Spec Title: Gamepad API Trigger-Rumble Extension
  • Spec URL: https://w3c.github.io/gamepad/extensions.html
  • GitHub repository: https://github.com/w3c/gamepad
  • Issue Tracker (if not the repository's issue tracker): https://github.com/w3c/gamepad/issues/138
  • Explainer (if not README.md in the repository): https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/GamepadHapticsActuatorTriggerRumble/explainer.md

Design reviews and vendor positions

  • TAG Design Review:
  • Mozilla standards-positions issue: https://github.com/mozilla/standards-positions/issues/656

Bugs tracking this feature

  • Chrome Status: https://chromestatus.com/feature/5162940951953408
  • WebKit Bugzilla:
  • Radar:

Anything else we need to know

We would like to extend the GamepadHapticActuator interface to expose the trigger-rumble capability in the Web for compatible gamepads.

P.S.: I have already sent an email to webkit-dev, but decided to continue the discussion here.

gabrielsanbrito avatar Jun 28 '22 22:06 gabrielsanbrito

I think @beidson & @marcoscaceres have opinions here.

hober avatar Jun 30 '22 20:06 hober

I'm personally opposed to this proposal (i.e., this position is NOT representative of the WebKit community; I'm posting it as input while waiting for further input from WebKit community members).

Although I'm are generally supportive of enabling haptic feedback, such as "trigger-rumble", on gamepads, I have significant reservations about the (non-standard) GamepadHapticActuator interface on which this proposal relies.

Specifically with the "trigger-rumble" proposal, I'm concerned that it’s targeting a narrow set of hardware. To alleviate this, it would be good to provide a canonical representation, such as an audio file, that can be used to consistently emulated "trigger rumble" across generic gamepads.

Returning to GamepadHapticActuator (and the changes that result directly from adding "trigger-rumble"), I've provided feedback on the design of the API via the W3C and outlined several issues. Some of the issues also appear in the "trigger-rumble" proposal (particularly around .canPlay()).

Lastly, I'm are sympathetic that GamepadHapticActuator has been shipping in Chromium-based browsers for a while despite the API not being a published standard. This situation is quite unfortunate and something the implementers should try to remedy through collaboration at the W3C: the more developers come to rely on the design of GamepadHapticActuator, the higher the chance that the Web Platform will be stuck with it.

I would be open to exploring alternatives to the GamepadHapticActuator, or evolving GamepadHapticActuator into something more useful - as well as looking at how we can enable more haptic effects on gamepad devices.

marcoscaceres avatar Jul 18 '22 00:07 marcoscaceres

Discussed with other folks and our position remains the one I posted above (https://github.com/WebKit/standards-positions/issues/1#issuecomment-1186652009)... basically, gamepad haptics are good, but we have concerns about GamepadHapticActuator. Marking as opposed for now, but happy to continue the discussion at the W3C.

marcoscaceres avatar Jul 22 '22 02:07 marcoscaceres

As mentioned earlier, the quest browser is exposing haptics and they're use quite a bit by developers. We just released a new controller that has 3 sets of haptic actuators and each also support frequency.

The main actuator also support audio samples so it could play music or other effects. Was this ever discussed?

cabanier avatar Oct 18 '22 12:10 cabanier

The main actuator also support audio samples so it could play music or other effects. Was this ever discussed?

Yes. The W3C was waiting on a proposal from Microsoft to allow playing audio files: https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/HapticsDevice/explainer.md

I'm hoping they will move that to the WICG (if they haven't already).

marcoscaceres avatar Nov 02 '22 02:11 marcoscaceres

@marcoscaceres what is the status of haptics? Would it make sense to join the CG or WICG?

cabanier avatar Nov 02 '22 04:11 cabanier

@cabanier, sorry I missed your question. It's still unclear if/where further haptic-related work will happen at this point. A few of us are discussing it as part of WebApps WG, but we are unsure of a venue. It will more than likely be a WICG thing.

In other news, although WebKit were opposed to this API, the vibratorActuator did end up getting implanted in WebKit and shipped in Safari Tech Preview 163 (release notes). The API has been around for a while in Chromium browsers, so it kinda made sense to ship it for web compat... even though we all agree that the design is less than ideal.

At the same time, folks involved with the Gamepad spec don't seek to pursue haptics using above model further... so we will try to figure out where, how how, we go forward from here with something better/more scalable, that better supports the capabilities of newer gamepads.

marcoscaceres avatar Feb 12 '23 23:02 marcoscaceres

Thanks @marcoscaceres Our newest controller doesn't just have frequency; it's even possible to play music using a special motor.

We don't have an immediate need to have support for this but it would be nice to have in the future.

cabanier avatar Feb 13 '23 05:02 cabanier

Closing as we've identified our position.

hober avatar Mar 23 '23 18:03 hober

@hober what do you think of my proposal in https://github.com/w3c/gamepad/issues/186?

cabanier avatar Apr 20 '23 06:04 cabanier

Reopening it on request of Chromium/Microsoft folks. I'll coordinate with @gabrielsanbrito on this.

marcoscaceres avatar Feb 09 '24 00:02 marcoscaceres

Hey @marcoscaceres, I have updated the explainer to match the latest version of the Gamepad API spec.

gabrielsanbrito avatar Feb 10 '24 00:02 gabrielsanbrito

Changed position to support, as we collaborated in the specification over in WebApps and implement this.

marcoscaceres avatar May 16 '24 23:05 marcoscaceres