Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add features for Gamepad API #1835

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

queengooborg
Copy link
Contributor

This PR adds three new features related to the Gamepad API. The haptics-related features were split into their own subfeature, as not all browsers support haptics and the interface has changed for haptic feedback.

@github-actions github-actions bot added the feature definition Creating or defining new features or groups of features. label Sep 25, 2024
@@ -0,0 +1,23 @@
name: gamepad
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: gamepad
name: Gamepad extensions

This suggestion is to make the name more consistent with other names in the repo, but I'm not very happy with it either because I don't think web game devs call it that. It looks like, from looking at MDN, that these extensions are only extensions because they came in another spec. But from a dev standpoint, they're just features of the Gamepad API.
It seems to me like we should make this feature specific to XR headsets' gamepads. Something like:

Suggested change
name: gamepad
name: XR headset gamepad support

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spec itself is called the "Gamepad Extensions", so that's why I elected to call it as such. It is true that these updates are tailored towards XR controllers, but looking at some of these interfaces, I could see them used for a non-XR gamepad. For example, the DualShock 4 and DualSense controllers have a gyroscope in them, which could be reflected through GamepadPose.orientation. They also have a touchpad, which could be reflected by GamepadTouch.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Though our overarching goal is to design features around what developers would want to use in their apps, not around how specs are structured. So if a spec contains one set of interfaces for doing X, and another set of interfaces for doing Y, we would create 2 separate features: X and Y.
I think this is likely due to how we generated a bunch of the draft features, which we did by using a script that looped over specs.

From what you said, it seems like there could almost be one feature for gamepad XR headset support, one for gamepad orientation, and one for gamepad touch support.
What do you think?

Also pinging @ddbeck on this one, to help make a decision re splitting this feature.

features/gamepad.yml Outdated Show resolved Hide resolved
features/gamepad.yml Outdated Show resolved Hide resolved
- api.Gamepad.timestamp
- api.GamepadButton
- api.GamepadButton.pressed
- api.GamepadButton.touched
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This event is not supported in Safari yet. It's worth doing one of these two things:

  • Either it's important enough (e.g. there are a lot of controllers that have touch-enabled buttons now) to warrant a separate feature tracking just that one event.
  • Or we decide to keep it here (essentially ignoring it), in which case we need to add a comment saying why, so our future selves can remember.

Comment on lines +25 to +26
- api.Window.gamepadconnected_event
- api.Window.gamepaddisconnected_event
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for these 2 BCD keys. They're not baseline, but since you can use the Gamepad API without them, we should ask ourselves whether they make sense as a separate feature, or if we keep them silent in here.

I'm not sure what to do here, because the tutorial on using the Gamepad API mentions those 2 events as essential to the feature: https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API/Using_the_Gamepad_API
The gamepadconnected event seems to be the main entry point to the feature.
Can you use the Gamepad API without these events?

features/gamepad-haptics.yml Outdated Show resolved Hide resolved
features/gamepad-haptics.yml Outdated Show resolved Hide resolved
features/gamepad-extensions.yml Outdated Show resolved Hide resolved
queengooborg and others added 2 commits September 25, 2024 08:24
Co-authored-by: Patrick Brosset <patrickbrosset@gmail.com>
Co-authored-by: Patrick Brosset <patrickbrosset@gmail.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
feature definition Creating or defining new features or groups of features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants