# Capability tiers

> How @gamepadly/sdk progressively enhances from the Gamepad API to WebHID and optional 4-channel audio.

Source: https://gamepadly.com/sdk/start/tiers

The SDK reads every controller through the best channel available and reports what it found. Your game always
runs on the lowest tier and picks up extra features when they appear.

## L0: Gamepad API (default)

- Works with any controller the browser exposes, with no permission prompt.
- Raw stick axes with **no hidden deadzone** (apply your own with `p1.input.applyDeadzone()`).
- Dual-motor rumble where the browser supports `vibrationActuator`.
- Xbox Series impulse triggers in Chrome and Edge (`trigger-rumble`).

## L1: WebHID (one click, desktop Chrome / Edge)

`hub.connectWebHID()` opens the browser's device picker. After the player chooses a controller:

- **DualSense / DualSense Edge** (USB and Bluetooth): 10-zone adaptive triggers, 6-axis gyro and accelerometer,
  two-finger touchpad, RGB lightbar, battery.
- **Switch Pro Controller**: dual-band HD Rumble, 6-axis gyro and accelerometer.

The browser remembers the permission. `hub.reconnectAuthorized()` reattaches a remembered controller on the next
visit without a prompt, and `hub.disconnectWebHID(slotId, { forget: true })` revokes it.

## L2: 4-channel DualSense audio (optional)

On Windows with a USB DualSense, `@gamepadly/sdk/link` can drive the controller speaker and the left/right voice
coils as audio channels. It is entirely optional. See [Optional Link (L2)](https://gamepadly.com/sdk/guides/link).

## Asking what is available

```ts
const caps = p1.getCapabilities();
caps.tier; // 'dualsense_full_4ch' | 'dualsense_hid_only' | 'switch_pro_hid' | 'xbox_impulse' | 'standard_gamepad' | 'keyboard_mouse'
caps.identity.brand; // 'sony' | 'xbox' | 'nintendo' | 'generic' | 'none'
caps.hasAdaptiveTriggers; // also hasHdRumble, hasImpulseTriggers, hasDualRumble, hasGyro, hasTouchpad, ...

hub.onCapabilitiesChange(({ active }) => updateHud(active));
```

`onCapabilitiesChange` fires when a controller connects or disconnects, upgrades to WebHID, becomes the active
controller, or gains 4-channel audio.

## Haptic routing

Haptic calls such as `p1.haptics.playPreset('recoil')` pick the richest output the controller has and return
which one played:

| Return value | Played on |
| :--- | :--- |
| `'4ch_vcm'` | DualSense voice coils through 4-channel audio (L2) |
| `'hd_rumble'` | Switch Pro HD Rumble (L1) |
| `'impulse_triggers'` | Xbox trigger motors (L0, Chrome / Edge) |
| `'dual_rumble'` | Standard dual-motor rumble (L0) |
| `'none'` | Nothing: no controller, or no rumble support |

Log it, show it in a debug HUD, or assert on it in tests.
