Better Gamepad Support

any pointers about this file? I do remapping for my game but maybe much more complicated than necessary. Without my game would be not playable. But not a clue hos to change it for Lemur. So maybe this file you mentioned could be the missing link.
The button names for in game help is another issue I somehow can’t really solve. But well first thing first.

any pointers about this file?

Paul already posted a link to the default mappings in jme3-core. What more do you need?

1 Like

Oh true, my mobile is not so practical to search through a thread :sweat_smile:
Have it. Will see if this is useful. I wonder how others do this gamepad nightmare? I mean my biggest problem besides all other problems is, that I can’t display the right button names for in-game help (or also in the mapping menu, there I just say defined or undefined). Is it that you just say in the description, please use Xbox controller for this game? Or do paid engines have better DBs for gamepads? I mean it doesn’t seem something that the industry wants to keep standardized.

1 Like

Going to say this for probably the 5,024,243,252nd time.

You will never ever ever ever get away from letting the user remap controls. This is a must have in any game that wants to use gamepads (and most games in general).

Like, they click a button and then provide some input and your game goes “Ahah, now I know what you mean by that.” Like every other AA and up game on the planet has.

Yes, it’s a HUUUUGGGGGGGEEEE deficiency that JME doesn’t already have this.

But if you want folks to play your game, you will have remappable controls. (Everyone read that again.)

Else, I boot up your game, try to move around, look for how to remap the controls, close and delete your game. “Maybe I’ll check out a future update…”

For the record: my game is in the same boat here as well. It’s a big TODO item. The only reason it’s not a higher priority is because Mythruna is really hard to play without a mouse+keyboard anyway.

If someone doesn’t beat me to it, I will eventually add such a thing to Lemur as a standard UI panel thing.

Until then, we have lower level remappings and making the user otherwise twist their fingers around strange controls.

2 Likes

And yes ofc I have a remapping GUI to assign the wished game controller buttons or keys if keyboard.
But for the 999999 time I can’t display proper button names. Remapping works. But what Button 1 …4 really is like is it a triangle, an A, a cricle is out of my control oooor I have not a clue how to circumvent this. So that’s that. And no I don’t beat anybody to provide me code more like a recipe on how I can get those button names? My experience so far is that button 1 to 4 is randomly on the physical layout. Not even on the same spot (that alone would help but well is not).

Without remapping my controller based game is unplayable with certain controllers.

Yes, it’s a real mess since each manufacturer creates their own standard. That’s what it makes buttons positions look random on each gamepad. The issue exists even on controllers made by the same manufacturer (the official PS3 controller has at least 3 different layouts). And that’s what SDL DB tries to solve. Unfortunately there will always be a different controller with a different layout not covered by the database.

I have a remap interface where I ask the player to press the A button using an image to show its position on the controller and the game registers it somewhere. Then I ask them to press B and so on. By doing so, the next time I ask them to “press A to confirm” I know that the requested button will be correctly pressed.

Edit: By using an image you can point to a button and say “hey, press this button and let’s call it the A Button, no matter if it has an A, a B or a cross physically drawn on it.” Or you can say “press the button you want to use for the Jump action”, then in the game you can ask them to press the Jump button to confirm or cancel something.

I do this. So in game help is then more a „press the jump button“ and not „press A“. Many games manage to get the name of the button but well might be pure luck Idk.
So Unity probably just has a bigger DB for controllers (they also have to figure that out) or XNA (Celeste is done with that engine as far I know).

Ok but anyway thank you very much everybody. At least I have certain pointers.

I wonder why jMonkeyEngine does not want to go the SDL way and instead does it with an own property file. The own property file could be the fall back maybe? but I’m sure there are reasons I don’t yet see. Or you need somebody doing it maybe?

First, I think the property file that JME uses is attempting to solve a different problem than you are having. You want accurate names in your UI for the buttons. That’s not what JME’s property file is for.

It’s attempting to map the physical buttons to common arrangements, regardless of what their logical name is painted on the controller. I have a bunch of gamepads here and some of them aren’t even consistent in how they are painted… but the idea was that the left joystick should be specific axes, the right joystick should be specific axes, etc. regardless of gamepad. The button on the bottom should be a specific button number that the app could rely on (regardless of its painted label), and so on.

…and it should work with JInput, whatever lwjgl3/4/5/6/ is using and so on.

The main idea was that the properties file should at least (hopefully) map enough that the user could at least navigate to the control settings screen and remap the values.

Unity is probably tapping directly into the Windows-specific APIs and may have more access than we do using more generic libraries. I wonder if Unity running on Linux can see all of the same button names.

If someone wants to rewrite our joystick code (for both lwjgl2 and lwjgl3) to use SDL then I’m sure that’s a worthy contribution that we’d look forward to reviewing for regressions. Gamepad support has so far been the bastard step child.

1 Like

If you guys think the code I posted at the beginning of this thread is a good start, I’ll volunteer to help.

Looks like Unity has its own database, and I see many posts on the Unity forums with people complaining that they have controllers that do not map correctly, and unity tells them to create a custom mapping. It looks like they only have mappings for major brand controllers. More info on custom mappings here: HID Support | Input System | 1.4.4 (unity3d.com)

5 Likes

That are good news.

I probably would not do it with method names but with a map with named triggers. To me it looks not too bad. What I would do is add a fallback to xbox !xbox if it cant find your specific controller.

1 Like

Sorry if this sounds arrogant, but I do think that if you are serious about gamepad, you should start by looking at my source code, and try the sample app.

Why? Because it’s backed by the aforementionend SDL database mentioned in the OP’s post.

Yes, it’s not perfect, and yes, sadly it requires an incompatible fork of Lemur. But it’s a working start.

5 Likes

I was simply not aware that you are talking about a forked Lemur nor from your sample project. Thanks a lot.

At the moment I try GitHub - electronstudio/sdl2gdx: Java wrapper for SDL and LibGDX controller API for my controller input, as it has correct button mapping for all my different Xbox, PlayStation and Nintendo Controller AND it detects the brand as well, so I can display the right symbols in my tutorial (one of the main pain points with lwjgl)

My question is, did anybody ever try to integrate sdl2gdx in jMonkeyEngine? Is this even possible (I mean do I have the necessary hooks to do that)?

2 Likes