Armory Gamepad calling in Haxe

Good day guys. I have seen the Tanker example and noticed that gamepads are sensed by the function gamepad.down(“key”) function. I tried applying the same code to my game using 0810-0001-Twin USB Gamepad controller but they don’t seem to be working. Using Xbox/PS gamepads to play the Tanker example seem to work but not generic gamepads. My question is does Amory only support Xbox and PS gamepads only and not the generic USB PC gamepads?

This is the report I got from Gamepad Tester site. Does this mean instead of calling gamepad.down(“right”), I should call gamepad.down(“Axis 0”). Would be happy if anyone has a solution for this. Generic USB PC gamepads are the most common among players and I hope there is a way to support them.

2 Likes

@ArmoredDP Hi, Armory3D uses Kha implementation to detect input events from hardwares interfaces. Check if Kha supports the gamepad you use.

Also, have you already tried with gamepad.down(“Axis 0”)?

How do I check if Kha supports the gamepad? As in the procedure I follow and the expected results.

I have tried gamepad.down(“Axis 0”). The result was as follows, on Gamepad Tester site, Axis 0 is my left movement gamepad button, when Armory now senses my gamepad, the button number 1 which I can equivalent to yellow or Y button on the Xbox gamepad is the one being sensed as Axis 0. All the other buttons are not working, whether I call gamepad.down(“Axis 1”) and so forth, they are not working. Only Axis 0 is working but being sensed on the wrong key.

The gamepad buttons are not nammed as the Xbox ones, i would prefer Xbox nomenclature because they are shorter, but the PS buttons names are used instead, see Gamepad class here https://github.com/armory3d/iron/blob/master/Sources/iron/system/Input.hx

There is an array with xbox buttons, but they are not used currently. Probably even with Ps names it will works with any other gamepad.

Alright I understand the class now, Will see if I can tweak something from it. I believe these generic USB Gamepads must be accommodated somehow because they are very common. If Armory fails to accommodate them, that will be a big bomb to our future game sales. I hope there will be a way to map them to the recognized Xbox ones in future.

You would be surprised if you knew how many games don’t actually support generic controllers… or at least the ones I’ve encountered in many years, which I always resorted to x360ce to make my controller work…

Anyway, I would recommend opening an issue in the kha repo to clear things out about support of generic gamepads, since armory relies on kha for it support on gamepads.

Thanks very much, I believe there is a way to sort this because running the code below for these generic USB gamepads seems to show that buttons are being sensed.

 var gamepads =  iron.system.Input.getGamepad(0);
 trace(gamepads);

Each time I press the keys they are sensed successfully, will find a way to map them to Armory. If I fail then players can resort to Xbox and PS gamepad emulators.

1 Like