indigo
indigo copied to clipboard
Support DualSense (PS5 controller) as a gamepad
I tried using a DualSense for the Pirate game demo, and to my surprise it doesn't seem to work.
I see this in the console:
According to the mapping, 14
is 14 D Left
, which I suppose is the left arrow on the D-pad... which seems to be an axis in the DualSense layout:
It would be great to support this gamepad as well :)
My guess is that, to properly handle this, GamepadInputCaptureImpl
will have to dispatch to a device-specific mapping, and someone with a controller will have to implement that layout for DualSense. Happy to give it a go sometime :)
Just to echo what I said on Discord: Any and all assistance welcome here if you're interested in having a go!
I implemented PS4 gamepad support a long time ago and very quickly, and haven't revisited it since. It wouldn't surprised me if it needed a bit of a rethink!
Thanks for raising the issue.
OK, it's even funnier: this is only on Firefox. The d-pad is actually represented as buttons in Chrome. It still doesn't work in your demo, but apparently for another reason.
I... don't like this very much.
Frontend dev is always... exciting. Accounting for how different hardware / browsers / platforms works, getting a bit creative with how to support things. :smile:
One thing we're been discussing, is for Indigo to become a Tyrian App: https://github.com/PurpleKingdomGames/indigo/issues/506
If we do that, all the work around interacting with the browser / world (websockets, frameticks, gamepads...) becomes a Tyrian problem. There's actually nothing preventing this from happening right now as embedding Indigo into Tyrian is really easy.
Might be worth making something similar to https://luser.github.io/gamepadtest/ in Tyrian and seeing how it looks. Also has the benefit of not needing to conform to the existing Indigo implementation.
Just an idea, maybe it'll go nowhere, but it could be interesting. :shrug:
There's an example of an Indigo game inside a Tyrian App here, just if you're interested: https://github.com/PurpleKingdomGames/tyrian/blob/main/examples/indigo/src/main/scala/example/Main.scala
That surely seems interesting. I suppose we'd still want the button mappings to live in Indigo or a helper library, and Tyrian would only deal with the DOM nonsense... either way, I like the idea of a gamepadtest in Tyrian. Might pick this up some time.
I like the idea of a gamepadtest in Tyrian
Yeah so do I. Be good to see it working and then worry about the other details like who owns the config and so on. Let me know if you have a go. :+1: