Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Opinion: SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS should default to 0 #6117

Closed
SuperSamus opened this issue Aug 23, 2022 · 17 comments
Closed
Milestone

Comments

@SuperSamus
Copy link
Contributor

SuperSamus commented Aug 23, 2022

As described here, SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS makes the game controller face buttons report their values according to their labels instead of their positional layout.
Right now, this hint defaults to 1, but in my opinion it should default to 0.
Most players do not look at the controller while playing, and while players used to the Nintendo layout will have to rewire the brain to adjust the labels, it's definitely easier than rewiring the brain to push different buttons (with 1, if someone plays a game on Switch, then plays the same game on PC with a Switch Controller, they'd have to change the buttons to press).
It's important that the button positions are consistent between gamepads, and also games between different platforms (since the same game on Xbox and Switch map the buttons so that are in the same position (except for menus)).
Many games are also designed to have buttons in a specific layout (like the Binding of Isaac, or Inversus). Even if they aren't, many games show a gamepad layout when prompting a specific button.

@smcv
Copy link
Contributor

smcv commented Aug 24, 2022

Am I right in paraphrasing your opinion as being like this?

With SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS=1, what primarily matters is how the button is labelled: the button at the bottom of the diamond is A on an Xbox controller or B on a Switch controller, the button at the top is Y on Xbox or X on Switch, and so on, and the game might expect you to press A to jump and Y to block, regardless of where that button is physically situated. This is good if the game displays prompts like "Press A to jump", but confusing if the game displays prompts like "Press (diagram of buttons with a highlight on the bottom one) to jump".

With SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS=0, what primarily matters is where the button is: the game might expect you to press the button at the bottom of the diamond to jump, regardless of whether it's labelled A (Xbox), B (Switch) or cross (Playstation), and similarly press the button at the top of the diamond to block, regardless of whether it's labelled Y (Xbox), X (Switch) or triangle (Playstation). This is good if the game displays prompts like "Press (diagram of buttons with a highlight at the bottom) to jump", but confusing if the game displays prompts like "Press A to jump".

The SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS=0 model is also good for games that care about the physical layout of the ABXY buttons, like older Assassin's Creed titles which map the diamond of ABXY buttons to the player character's body (top button = head/first-person view, bottom button = legs/jump/run, left button = weapon hand/attack, right button = empty hand/grab).

Your reasoning is that the physical location of the buttons is the most important thing and their labels are secondary, similar to the way most games that are ported between Xbox and Playstation directly mirror the function of the Xbox ABXY buttons with the Playstation button that is in the corresponding position (Y = triangle and so on). Correct?

For what it's worth, the Linux kernel agrees with you: the evdev gamepad interface is written in terms of BTN_NORTH, BTN_SOUTH, BTN_EAST and BTN_WEST buttons, with BTN_NORTH aliased as BTN_Y, BTN_EAST as BTN_B and so on following the Xbox convention. The native Linux driver for Switch controllers, hid-nintendo, maps the Switch controller's top button labelled X to Linux BTN_NORTH, and so on, disregarding the button labels and using the physical layout of the buttons as the thing that matters.

@SuperSamus
Copy link
Contributor Author

You are perfectly right with your paraphrase.

@slouken
Copy link
Collaborator

slouken commented Aug 24, 2022

I agree with your reasoning and I'll leave this open for further discussion, however making a change like this isn't something we should do lightly.

In the meantime, you can set the behavior you like by setting the environment variable:
SDL_GAMECONTROLLER_USE_BUTTON_LABELS=0
and then all games that use SDL will use positional layout instead of label layout.

@smcv
Copy link
Contributor

smcv commented Aug 24, 2022

For comparison, what does Steam Input remapping do with Nintendo controllers? Do they follow the positions or the button labels by default?

I don't currently have a Nintendo gamepad connected to any of my Steam devices, only Steam Controllers (which follow the convention that controllers designed for PC label and colour-code their buttons like an Xbox controller) and various generations of Playstation gamepads (which don't use the ABXY labels, but Steam treats them as equivalent to the Xbox button that has the corresponding position, disregarding labels and colour-coding).

@slouken
Copy link
Collaborator

slouken commented Aug 24, 2022

Steam defaults to using the buttons as labeled, and has a setting to change that to positional mapping.

@smcv
Copy link
Contributor

smcv commented Aug 25, 2022

Steam defaults to using the buttons as labeled, and has a setting to change that to positional mapping.

Consistent with current SDL (without the change proposed here), then, which makes sense.

@SuperSamus
Copy link
Contributor Author

SuperSamus commented Aug 25, 2022

Steam however shows this is a GUI option, close to the one to enable the controller support in the first place. SDL's option is far less discoverable.

And while Steam defaults to the equivalent of SDL_GAMECONTROLLER_USE_BUTTON_LABELS=1, many other programs/drivers do not: DS4Windows, BetterJoy, hid-nintendo...

The alternative to not changing the default could be making the option more discoverable, but I have no idea how. The only idea I have would be a log in the terminal when SDL detects a controller that makes use of the hint, but that would only be useful for only a small percentage of users.

lbschenkel added a commit to lbschenkel/SDL_GameControllerDB that referenced this issue Jan 5, 2023
Controllers such as 8BitDo Pro Wired 2 actually have their physical
labels according to the "Nintendo layout" (bottom = B, east = A) and
not the "Xbox layout" (default, bottom = A, east = B).

SDL supports the SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS for this
purpose, which hints to the application that the user wants to follow
the labels in the controller, and not the physical layout of the
buttons [1]. That hint defaults to 1.

The mappings for this particular controller are made in the "default
layout" (hint=0) and do not support the "Nintendo layout" (hint=1),
which is inconsistent with how SDL works by default.

This commit addresses that by introducing a new copy of each one of the
three mappings for this controller (as it has 3 operations modes which
result in 3 different GUIDs [2]), which will activate depending on the
hint.

Naturally there are other controllers with the "Nintendo layout" that
would benefit from the same improvements, however the author of this
commit is restricting the scope of the change to the controller he
personally has and can test.

[1] libsdl-org/SDL#6117
[2] mdqinc#650
@SuperSamus SuperSamus changed the title Opinion: SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS should default to 0 Opinion: SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS should default to 0 Feb 21, 2023
@Lokathor
Copy link
Contributor

Lokathor commented Mar 8, 2023

This seems to be approximately the same issue as #6665, which I closed because a majority of the commenters seemed to be against the idea.

@SuperSamus
Copy link
Contributor Author

Bump, is anything changing with SDL3?

@Squall-Leonhart
Copy link

Bump, is anything changing with SDL3?

I hope not.

@SuperSamus
Copy link
Contributor Author

So, a recap.

Problem with PC gaming: when playing with a Nintendo controller, the prompts don't match the buttons you press.
Is it severe? Not really, people don't look at the controller once they understood the controls.
Still, are there some solutions?

  1. Change the prompts to match the buttons. This is what you get when playing on a Nintendo console (only exception is confirm/cancel). Some games on PC offer this.
  2. Change the mapping to match the prompts. This creates more problems than it solves, because now you are playing a game with a mapping that the developer didn't intend. If the player is also used to playing with another controller (or the same game on console, including a Nintendo one), their muscle memory will be destroyed. This is what SDL (and Steam) are doing, enabled by default.

(Also, applying both solutions at the same time will make a game with both the wrong mapping and the wrong prompts. Meaning, if you play a game with the default SDL setting, you should not enable Nintendo prompts on a Nintendo controller.)

So, @Squall-Leonhart, are you going to write a motivation on why not? The motivation so far was because it was a big change, but now that they should be fair game due to SDL3, I'd want another one.

@Squall-Leonhart
Copy link

simply put, you're the only one that cares

thats not reason enough to invert behaviors from one sdl version to another.

@Lokathor
Copy link
Contributor

Lokathor commented Jul 9, 2023

If the prompt says "X" and I'm holding a switch pro controller I expect that the top button will do it. If the prompt says "Y", the left, and so on. I don't look at the controller, but I know by instinct which button is which on that controller. Programs should learn to respect Nintendo controller users, not the other way around. If i wanted an xbox controller I'd just get one and use that.

@SuperSamus
Copy link
Contributor Author

SuperSamus commented Jul 9, 2023

thats not reason enough to invert behaviors from one sdl version to another.

Could say the same about SDL 2.0.12, which introduced this to begin with. (With 9a76beb)

simply put, you're the only one that cares

Found someone else! https://www.reddit.com/r/linux_gaming/comments/fguome/comment/fk8o7lt/?context=3

Programs should learn to respect Nintendo controller users, not the other way around.

Alright, but you should motive why it's worth these tradeoffs:

  • Having button prompts that the game designers didn't intend (e.g.: Binding of Isaac, face buttons should make the character shoot in the direction of the button's position)
  • Having inconsistent button mapping depending on the controller. Once you looked at the prompts, you don't look at them anymore, meaning that when you switch controllers you don't have to readjust muscle memory (because hands remember west, east, north and south).
    • Also, having a button layout different from the same game on the Nintendo console (both physically and in prompts, instead of just prompts). Right now, Sonic with a Nintendo controller jumps with the B button on a Nintendo console and with A on PC. Why is this better than making it jump with B on both? (Even if the prompt is A on PC.)

And as I said, some games do offer Nintendo prompts (which make sense only if SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS=0).

@CaptainCoward
Copy link

i stumbled over this trying to get the "correct" mapping for my WiiU-Pro Pad. The Launch parameter works fine. I just wonder, is there a more persistent way so that i wouldn't have to set that launch parameter for each game?

@SuperSamus
Copy link
Contributor Author

SuperSamus commented Nov 10, 2023

If you want to set the environment variable for the entire user, add the following line to ~/.bashrc (assuming you are using Bash):

export SDL_GAMECONTROLLER_USE_BUTTON_LABELS=0

https://wiki.archlinux.org/title/Environment_variables

slouken added a commit to slouken/SDL that referenced this issue Nov 10, 2023
…rate label

This gives applications and binding systems a clearer view of what the hardware is so they can make intelligent decisions about how to present things to the user.

Fixes libsdl-org#6117
slouken added a commit to slouken/SDL that referenced this issue Nov 10, 2023
…rate label

This gives applications and binding systems a clearer view of what the hardware is so they can make intelligent decisions about how to present things to the user.

Fixes libsdl-org#6117
slouken added a commit to slouken/SDL that referenced this issue Nov 10, 2023
…rate label

This gives applications and binding systems a clearer view of what the hardware is so they can make intelligent decisions about how to present things to the user.

Fixes libsdl-org#6117
slouken added a commit to slouken/SDL that referenced this issue Nov 10, 2023
…rate label

This gives applications and binding systems a clearer view of what the hardware is so they can make intelligent decisions about how to present things to the user.

Fixes libsdl-org#6117
slouken added a commit to slouken/SDL that referenced this issue Nov 10, 2023
…rate label

This gives applications and binding systems a clearer view of what the hardware is so they can make intelligent decisions about how to present things to the user.

Fixes libsdl-org#6117
slouken added a commit to slouken/SDL that referenced this issue Nov 10, 2023
…rate label

This gives applications and binding systems a clearer view of what the hardware is so they can make intelligent decisions about how to present things to the user.

Gamepad mappings continue to use abxy for the face buttons for simplicity and compatibility with earlier versions of SDL, however the "SDL_GAMECONTROLLER_USE_BUTTON_LABELS" hint no longer has any effect.

Fixes libsdl-org#6117
slouken added a commit to slouken/SDL that referenced this issue Nov 10, 2023
…rate label

This gives applications and binding systems a clearer view of what the hardware is so they can make intelligent decisions about how to present things to the user.

Gamepad mappings continue to use abxy for the face buttons for simplicity and compatibility with earlier versions of SDL, however the "SDL_GAMECONTROLLER_USE_BUTTON_LABELS" hint no longer has any effect.

Fixes libsdl-org#6117
slouken added a commit to slouken/SDL that referenced this issue Nov 10, 2023
…rate label

This gives applications and binding systems a clearer view of what the hardware is so they can make intelligent decisions about how to present things to the user.

Gamepad mappings continue to use abxy for the face buttons for simplicity and compatibility with earlier versions of SDL, however the "SDL_GAMECONTROLLER_USE_BUTTON_LABELS" hint no longer has any effect.

Fixes libsdl-org#6117
slouken added a commit to slouken/SDL that referenced this issue Nov 10, 2023
…rate label

This gives applications and binding systems a clearer view of what the hardware is so they can make intelligent decisions about how to present things to the user.

Gamepad mappings continue to use abxy for the face buttons for simplicity and compatibility with earlier versions of SDL, however the "SDL_GAMECONTROLLER_USE_BUTTON_LABELS" hint no longer has any effect.

Fixes libsdl-org#6117
@slouken
Copy link
Collaborator

slouken commented Nov 11, 2023

Okay, this is implemented!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants