MiSTer-devel / Main_MiSTer

Main MiSTer binary and Wiki
GNU General Public License v3.0
2.99k stars 317 forks source link

Tournament mode - set joystick inputs according to USB slot id instead of PCB id #782

Closed zass30 closed 1 year ago

zass30 commented 1 year ago

Current problem Fighting game tournaments are increasingly run on Mister setups. A common occurrence is when two players with custom sticks that have the same board and different wiring have to play against each other. Because inputs are assigned on PCB id, when each player tries to set their input configs, it overwrites the other player's input. This was an issue at Evolution 2022, Fight Kingdom 2023, and continues to be a problematic. As more and more fighting game tournaments are run on Mister, this problem will cause more problems and more delays.

Assumptions In a tournament setting, the core use case is that many different players, with many different sticks, play each other. We cannot assume that two different sticks will have different PCB ids. In fact, as the brook board is the basis for many custom sticks, it should be considered a common use case that different players will have the same PCB id.

Proposed solution There should be a "tournament mode" setting where input is based on USB id instead of PCB id. In this case, one USB slot can be designated for player 1, and another for player 2. Players plug their sticks into the appropriate pre-designated slots, and button configs are saved on a per slot basis. Ideally, this setting would have a menu shortcut to quickly set and save button mappings, to reduce the time players spend configuring their sticks.

Hyphen-ated commented 1 year ago

I definitely agree that this is a serious problem for fighting game players.

One alternative solution might be: when keybindings have been assigned on a particular controller, the mister could remember those bindings for as long as that controller remains plugged in. When a second controller with an identical usb id has different bindings assigned, those become the new "default" bindings for that usb id, but the first controller continues using its own original bindings. If the first controller is unplugged and replugged, it starts using the new bindings that were established by the second controller.

This seems like it might be appropriate behavior for the mister without needing a setting to enable it. It would solve the tournament problem while having little or no noticeable change in behavior for the "mister at home" use case.

mrex64 commented 1 year ago

This would be a gigantic time saver for tournaments. +1

sorgelig commented 1 year ago

MiSTer is not supposed to be used in tournament. While it looks like a suitable device it may have some issues like mentioned above. Sometimes solving issue for one use case will make issue for another use case. 99% use of MiSTer is home with mostly a single player with occasional dual players. So development path is to make convenience in such use case where it's nonsense that same joystick plugged into other USB port gets different mapping. Input system on MISTer is already over complicated and making it even more complicated will make it even harder to support. I don't remember Playstation or XBox providing such wild mapping like written above.

May be after rewite of input system, such option can be reserved.

birdybro commented 1 year ago

I think this can already be done by port location.

https://github.com/MiSTer-devel/Main_MiSTer/blob/master/MiSTer.ini#L172-L193

player_1_controller=usb-1.2/, etc...

Hyphen-ated commented 1 year ago

I don't remember Playstation or XBox providing such wild mapping like written above.

Fighting games on Playstation and XBox do their button mapping based on controller port, not based on a USB ID. You can plug two identical controllers into an XBox and configure the buttons differently.

@birdybro, editing the INI file separately for each match in a tournament would be a prohibitive amount of effort, we're talking about maybe 50 or 100 matches between different pairs of players. I'm also not sure it would even work? It looks like that section of the INI can assign which stick is P1 or P2 but it doesn't say anything about input bindings

birdybro commented 1 year ago

If you make it so USB port 1.2 (for example) is static to player 1, then the player only needs to setup their keybinds within the core in 99% of cases, since the majority of controllers have automatic mapping anyways via gamecontrollerDB. Setting up keybinds and testing before a match is super common in tournaments, the users just have to learn to use the OSD in that respective core.

But I see what you mean, it's not a real replacement for what you want. The issue is that a lot of controllers use generic ID's and there's no real way to distinguish them reliably, so you will get a lot of unexpected behavior, or your players will get used to it just working and then suddenly not.

I disagree with it being a "serious problem" for fighting game players and tournaments, part of your routine as a professional competitor should always be to do a pre-flight check and tournaments always expect people to take their own responsibility to do this.

If you lose a match due to not confirming your keybinds and testing inputs prior to a match, blaming MiSTer is just scrub behavior ;)

Hyphen-ated commented 1 year ago

I think you're not grasping the problem, birdybro. If two controllers have the same USB ID, the mister does not allow them to have different control bindings. When P2 binds their controls, it overwrites P1's bindings, and vice versa. The players cannot play their match, without some kind of compromise like one or both players using a stick that is not their preferred stick, or using control bindings that are not their preferred bindings. This is a very bad outcome.

The players do detect the problem in their "pre-flight check" (we call them button checks) but that doesn't solve the issue.

In some cases some sticks can work around the problem by having a kind of alternate mode that changes their USB ID, but this isn't always present.

zass30 commented 1 year ago

MiSTer is not supposed to be used in tournament. While it looks like a suitable device it may have some issues like mentioned above. Sometimes solving issue for one use case will make issue for another use case. 99% use of MiSTer is home with mostly a single player with occasional dual players.

Please consider that this problem is not limited to tournaments. This problem can and does occur in the home gaming use case with dual players. There are cases where a user simply cannot play with their friend that has a custom stick with the same board.

So development path is to make convenience in such use case where it's nonsense that same joystick plugged into other USB port gets different mapping.

The incorrect assumption that each player will have a unique id on their stick is the root core of the issue, and affects all use cases with multiple players. This is not a case of simple convenience, the system is fundamentally broken for multiple players.

There are a few approaches that can be taken to fix this.

1) Make the OP proposed config of per usb port id a menu setting. Only players that explicitly choose this new menu setting get this new behavior, so this will never affect the solo player. 2) User @Hyphen-ated 's proposed solution in the first reply to this thread. This doesn't change the mapping when a stick is plugged into another port. 3) Have the button config map to a combined key of usb port id + device id. This then makes the button mapping unique to stick+port, so you will not get a new mapping when you change to a new port.

Input system on MISTer is already over complicated and making it even more complicated will make it even harder to support. I don't remember Playstation or XBox providing such wild mapping like written above.

Both playstation and xbox support identical PCBs having different mapping. On both consoles, two players can have sticks with the same PCB and different mappings.

May be after rewite of input system, such option can be reserved.

Please consider one of the above proposed solutions as a temp fix, until the rewrite of the input system. I would imagine that a system based on an menu toggle would be low risk, since you can keep the existing code path for the current system, and add new path for the setting to fix this problem.

Thank you for considering.

edit: Please see this thread, this has been reported on forums as well: https://misterfpga.org/viewtopic.php?t=5154

Hyphen-ated commented 1 year ago

This problem and and does occur in the home gaming use case with dual players. There are cases where a user simply cannot play with their friend that has a custom stick with the same board.

That's a good point. It doesn't even require custom sticks for there to be a problem in the home use case. If you have two home players who plug in their trusty XBox 360 controllers to the mister and want to play Super Street Fighter 2 Turbo on the CPS2 core, the mister will not allow e.g. one player to have Medium Punch on the Left Bumper and the other player to have it on the Y Button. Gamepad players often have personalized control schemes they use, since virtually every home release of a fighting game allows each player to customize their own controls.

wickerwaka commented 1 year ago

The latest (6e7c20c) unreleased version of main contains a new ini option controller_unique_mapping When enabled, controller mappings are saved based on the usb port being used and the vid/pid of the controller, not just the vid/pid. So the same controller type connected to two different USB ports can have different input mappings. I believe this solves the core issue that has been raised here.

Would be good if someone could confirm that this solves the problem. An unstable version of main that includes this change can be downloaded here: https://github.com/MiSTer-unstable-nightlies/Main_MiSTer/releases/download/unstable-builds/MiSTer_unstable_20230521_085418

sdEclipse commented 1 year ago

@wickerwaka I did a quick test this morning using two Dualshock 4 controllers with identical id's after loading the nightly file and adding lines to the .ini. I did not change the controller mapping, loaded a game and confirmed they were identical. Then changed the controls on one of them, and confirmed that the other still had the original button mapping while the one I changed did in fact have the updated mapping.

Great work, and thanks for the fast response. This is a lifesaver!

Hyphen-ated commented 1 year ago

I tried it out and the feature works for me as well. Thanks!

zass30 commented 1 year ago

Thank you very much for the fix!

sorgelig commented 1 year ago

implemented