flame-engine / gamepads

A Flutter plugin to handle gamepad input across multiple platforms.
MIT License
28 stars 8 forks source link

Support web #32

Open danPyk opened 4 months ago

danPyk commented 4 months ago

Are there any chances, that there will be implementation for web?

markvideon commented 4 months ago

Depends on whether there is someone (or someones) prepared to contribute a web version.

One consideration is that gamepad APIs for web do not support advanced controller features such as manipulating lights. A decision would have to be made to carve out specific interfaces for each platform or to "no-op" on web.

markvideon commented 3 months ago

I have taken a look at this, and I have something that should, in principle, (i.e. is supposed to) work. In my tests so far I'm seeing inconsistent behaviour across different browsers on the same platform. e.g. events & devices not being recognised by Firefox on macOS under any circumstance.

There are other kinds of gotchas even among browsers that do behave as expected, e.g. a scenario I observed where the browser does not immediately respond to device input. I was able to reliably force Google Chrome on macOS to recognise my device immediately once I had pressed a single button with the Developer Console open. Complicating things further, I suspect that there is some variance in behaviour between input devices.

I think if we were to ship a web implementation, we would need good coverage of various limitations on a per-platform and per-browser basis.

markvideon commented 3 months ago

In addition to the practical observations above, a look at https://github.com/w3c/gamepad/ suggests the W3C Gamepad API is still a work in progress with changes being discussed that would have material effects on the implementation of gamepads_web.

E.g.