bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
36.42k stars 3.59k forks source link

Gamepad unique id #13977

Open andrewbaxter opened 5 months ago

andrewbaxter commented 5 months ago

What problem does this solve or what need does it fill?

I need to remember which controller was which between process stops/starts.

What solution would you like?

gilrs provides multiple identifiers, like "os name" and "uuid". Bevy prints out an id like /dev/input/event13 at startup which would be unique to the system and consistent, I assume that's the os name. Exposing one or both of those would solve this.

What alternative(s) have you considered?

The gamepad currently is an integer which changes per session.

The name is generic: I have 2 xbox360-like controllers plugged in and the names of both are "Xbox 360 Controller" so it's not possible to differentiate them.

Additional context

Do typical amazon-sourced controllers have legit usb or info, maybe some are cloned and would have the same uuid? I'm not sure. UUID could be useful for per-controller calibration settings etc, where the os id might be useful for "whatever controller is plugged into the same port", maybe if someone needs to swap controllers mid-game. Both would work in my case, however.

s-puig commented 5 months ago

Last time i checked, UUID exposed by gilrs is unimplemented in most platforms. See issue.