SDL icon indicating copy to clipboard operation
SDL copied to clipboard

Opinion: SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS should default to 0

Open SuperSamus opened this issue 3 years ago • 7 comments

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.

SuperSamus avatar Aug 23 '22 15:08 SuperSamus

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.

smcv avatar Aug 24 '22 11:08 smcv

You are perfectly right with your paraphrase.

SuperSamus avatar Aug 24 '22 11:08 SuperSamus

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.

slouken avatar Aug 24 '22 18:08 slouken

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).

smcv avatar Aug 24 '22 18:08 smcv

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

slouken avatar Aug 24 '22 23:08 slouken

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.

smcv avatar Aug 25 '22 12:08 smcv

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.

SuperSamus avatar Aug 25 '22 15:08 SuperSamus

This seems to be approximately the same issue as https://github.com/libsdl-org/SDL/issues/6665, which I closed because a majority of the commenters seemed to be against the idea.

Lokathor avatar Mar 08 '23 07:03 Lokathor

Bump, is anything changing with SDL3?

SuperSamus avatar Jul 06 '23 15:07 SuperSamus

Bump, is anything changing with SDL3?

I hope not.

Squall-Leonhart avatar Jul 09 '23 04:07 Squall-Leonhart

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.

SuperSamus avatar Jul 09 '23 08:07 SuperSamus

simply put, you're the only one that cares

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

Squall-Leonhart avatar Jul 09 '23 09:07 Squall-Leonhart

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.

Lokathor avatar Jul 09 '23 09:07 Lokathor

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 9a76bebfbc4984ffd78663e4e0c09e8a90f14958)

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).

SuperSamus avatar Jul 09 '23 09:07 SuperSamus

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?

CaptainCoward avatar Nov 08 '23 13:11 CaptainCoward

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

SuperSamus avatar Nov 10 '23 10:11 SuperSamus

Okay, this is implemented!

slouken avatar Nov 11 '23 02:11 slouken