(SOLVED) Can't use "UP" "DOWN" "LEFT" "RIGHT" in gamepad extension

Alright so I need help with this one…
I’m trying for the first time to implement gamepad controls in my game but I can’t seem to use “UP” “DOWN” “LEFT” “RIGHT” … I don’t have PS4 or Xbox controllers … but I’m trying to simulate that by using what I have which is this one… (it should have all the buttons same as consoles)

I think other buttons works fine in engine but I can’t use “UP” “DOWN” “LEFT” “RIGHT” to move the character, how do you think I can fix that? is that an issue with the gamepad it self? because I just tested if all buttons work using “joy.cpl” in windows and they do work just fine.

Try searching in the joystick manufacturer to see if they have any special drivers, if not just check here maybe can helps you
https://windowsreport.com/xbox-360-controller-not-working-windows-10/
In that post there is a link to download

  1. Download DriverFix (verified download file).
1 Like

@UlisesFreitas the gamepad is a usb dual gamepad, you basically plug and play so it doesn’t have a driver online, like I said all buttons work when tested in windows using the run command joy.cpl
But in the engine the buttons for walking don’t work.

I used the PS3, PS4 and an 8Bitdo and only have issues with the ps3 but has a trick I need to install scptoolkit so Windows connect the PS3 as an XBox controller, search in Google is for sure there is a way to make your controller connected as an XBox controller. Or maybe try this solution here the video says Generic USB Controller here is the Driver

1 Like

So I searched and found a driver for the twin USB gamepads, and checked the setting and stuff and it’s there, it’s installed and tested but still the same issue unfortunately…
Other buttons work but “UP” “DOWN” “LEFT” “RIGHT” don’t …

Oh sorry, you know if Aliexpress ships to your country I say so because if so I would like to buy you a pc controller and send it to you.
It is more than anything because I have followed your work for a long time and I want to help you to have that pc controller if you need it.

1 Like

@UlisesFreitas Oh wow :heart:
That’s so sweet of you, thank you so much … I’m having a really hard time to implement gamepad in the game because I don’t have one.

I just searched if Aliexpress ship to Egypt and I think it does…

Is there like a discord or an e-mail or anyway to get in touch with you?

Sure send me a pm here in the forum or direct email to support@gamesigniter.com

1 Like

@UlisesFreitas Awesome, I just sent you a message in the forum.

I can give an update which add an expression for get the keycode related to the pressed button.
With this keycode you will see if the button is detected, and reuse the keycode and create a new layout with it.

Here the steps:

Condition   |     Action
____________________________
            |  Change the text of MyTextObject: = Gamepads::ButtonKeyCode(1)

Gamepads::ButtonKeyCode(1)

1 is the identifier for the gamepad. Player 1

  • Launch the preview and press a button, if the value in undefined or -1, there is no result.
    If the value is another number your input is detected.

  • Note the button, and the keycode related.

  • Go in the extension for edit it (project manager > Function/Behaviors> Gamepads )

  • Seek for “onFirstSceneLoaded” in the list on left side.

  • You will see the current layouts, something like:

"XBOX": {
            0: "A",
            1: "B",
            2: "X",
            3: "Y",
            4: "LB",
            5: "RB",
            6: "LT",
            7: "RT",
            8: "BACK",
            9: "START",
            10: "CLICK_STICK_LEFT",
            11: "CLICK_STICK_RIGHT",
            12: "UP",
            13: "DOWN",
            14: "LEFT",
            15: "RIGHT",
            16: "NONE",
            17: "NONE"
        },
  • Duplicate this part and do yours with the keycode, and the name of the button, test all the buttons.

  • After in the eventsheet, you will not use “Xbox” or “PS4”, but your custom layout name !

I waiting for your feedback, this wasn’t be done before :slight_smile:

1 Like

Hey @Bouh hmm… I like the idea but I’m kind of confused
Is the main point from this is to rearrange the buttons right?
or does it like simulate the keyboard keys and then turn it into the gamepad buttons?
.
For example:
In Puffball you can walk with “WASD”
Now can I make it so that:
W = the code number 12 which is “UP” on the gamepad
S = the code number 13 which is “DOWN” on the gamepad
And so on…
.
Can I simulate the keyboard keys into gamepad buttons with this solution?
Sorry if I sound confused, it’s just because I almost never played on a console (I’m just not a console gamer) so that’s why it’s so confusing for me.
.
Also I’d like to hear your opinion on this gamepad, will it work with this extension?
I want something that will add support for Xbox and PS4 controllers and I can test it out and stuff like that, Here is the controller:

I wouldn’t want you to buy a product and it didn’t work.
I recommend this type of controller, but with the wired version because I have one like that and it’s perfect.

As for the extension, my guide explains how to test any controller.
You plug it in, you follow my guide, you test all the buttons.

If you press the Up button on the controller and you see the number 0 write it down.
If the Down button is equal to 1, write it down.
Do all the buttons, then populate the list with them:

"MyControllerName": {
            0: "UP",
            1: "DOWN",
        },

Change MyControllerName to whatever you want.
Then use the gamepad extension as usual.

If you want to test if your gamepad is detected you have this website.
Otherwise if during the test you don’t get a number but undefined or -1,the button isn’t detected in GDevelop.

1 Like

@Bouh Ah I understand now, yesterday I tried something with the controller I have which is that I used the event that says…

if the “LEFT” stick in the direction “UP” then do whatever

instead of the event that says…

when the button “UP” is pressed then do something (this event doesn’t work with my gamepad and I have no idea why).

And then I managed to make it work for “UP” “DOWN” “LEFT” “RIGHT” using the first event mentioned above but I just can’t trust it you know…
Because I don’t have a decent controller that is similar to the one the player will be using or like close to it even, that’s why I need to get a decent one so I can test with it, something close with what the player will be playing the game with.
.
I also found this one wired but it’s Xbox 360 (do you recommend this one?): https://egypt.souq.com/eg-en/usb-wired-game-pad-controller-joypad-for-xbox-360-slim-pc-windows-7-8-10-black-23364791/i/
.
Can I use this controller to map PS4 buttons too or will it be for Xbox only?
.
And also if you have other controllers that work with the extension let me know about them, it will be much safer to buy something that is tested before.
Waiting for your response…

According this FAQ from Microsoft yes.

.

You miss an important point, even if all controllers have a Start button for example this button can have a different keycode according to the controller.
The association of a button name, like Start and a keycode which is a number is called a layout, and each constructors have can have their own layout.

For now the gamepad extension support XBOX one and PS4 Controller.
I can’t try XBOX 360 controller but i guess it same layout of XBOX one.

Sorry if I wasn’t clear.

1 Like

@Bouh Yeah I get what you’re saying, like it can be any controller but each will have different layout…
sigh… I’m so confused on what I should get really

Alright look I’ll be ordering a controller today, and hopefully it’ll be here in a week or something.
The one I have doesn’t have even any keycodes for “UP” “DOWN” “LEFT” or “RIGHT” … there is a D-PAD on the controller … but I think it’s fake and it works like a left stick and there is this Mod button and it makes the buttons order weird, it’s just messed up that’s why I’m so confused.

I’m going to throw those in the garbage, order a new one that makes sense and test it out and let you know how it went, So confusing, never thought implementing gamepad can be this annoying, anyway I’ll update you here soon…

As a heads up, most modern controllers will map to the exact same backend button locations.

For instance, if I set up controls to use my XBOX Series X Gamepad’s A button (bottom button) in the extension, that same exact events work for my PS4 and PS5 controllers’ X button (bottom button).

I don’t have to set up another event to check for the playstation X button or anything. Bouh just has some labels set up for the most common gamepads, but they all really equate to 1, 2, 3, etc on the backend.

Some more rare controllers can be weird, as mentioned, where the buttons don’t map up. But if you design for the 2 main controllers (Xbox and Dualshock/Dualsense) that are commonly used per steam (something like 80% of gamepads are made up of those 2), you should be fine.

1 Like

@Silver-Streak yeah I get what you mean, the thing is with the one I have, it’s weird…
The D-PAD which has “UP” “DOWN” “LEFT” or “RIGHT” does not register any value in preview, it’s confusing me… the buttons actually work out side of the preview, but in preview they don’t … there is no keycodes for “UP” “DOWN” “LEFT” or “RIGHT” in preview using the expression Gamepads::ButtonKeyCode(1)
I get every code up to 11 and then after that should be “UP” “DOWN” “LEFT” or “RIGHT” but it doesn’t exist in the gamepad … how can that even be a thing?
.
Also is the “UP” “DOWN” “LEFT” or “RIGHT” used for in-game movement or the left stick is used for that? Is there like a common button layout for most games?

Do I use the event that says:
if button “UP” is pressed then go up

Or should I use the event that says:
If the “LEFT” stick is in the direction “UP” then go up

I’m in super confused mood right now …

Alright so I just canceled my order and I order an Xbox one controller instead of 360 controller just to be on the safe side, this way I’m sure that it will work with the extension…
And I’ll have a new decent controller for gaming too if I need to, I’ll make a new update when it arrives and I test it out with the extension, it should be here is 8 - 12 days …
Thanks a lot @Bouh and @Silver-Streak for trying to help me with this and sorry if I seem confused or anything…

Does your dpad get detected as a third stick, maybe? Not sure how to test that, but I’m wondering if it’s getting treated as an axis rather than buttons/crosshatch.

1 Like

@Silver-Streak It’s detected the same as the left stick…

I know yeah, like I’m the one who owns it and it’s just super confusing for me…

Yeah I think that it’s being treated as an axis (the left one) not buttons which is weird but then you click that Mod button in the middle which turns red and then it’s treated as buttons but it doesn’t work in preview at all whether you click the mod button or not, it doesn’t give any value that it’s there in preview.

Also I forgot to mention that It’s an old controller I got from like 10+ years ago that’s why I don’t trust it at all to test with it, and it’s why I ordered Xbox one controller, this way I’m safe and I know that this is the controller the player will be using while playing the game.

It’s a lot better than getting any third-party controller that I know nothing about…

1 Like