• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

HTML5 Gamepad not detected in HTML5

H

Hector Guerrero

Guest
The function "gamepad_get_device_count()" returns 0 in HTML5 using GMS2, I have a gamepad connected and it is not detected.
Have any one a trick or know how to detect the gamepads in the browser?
Thanks in advance.
 
J

JSON

Guest
I would also like to figure this out. I have the same results "gamepad_get_device_count()" returns 0 in HTML5 export GMS2.... Please help!
 

chmod777

Member
Obviously, this function should return the length of an array (empty by default) but this array is never altered. So it always returns 0.
I can't try but that looks like a bug. @Mike
 
B

Ben Taylor

Guest
I was having a similar problem in GMS 1.4, not sure how much help it'll be for 2.0 but worth a look.

For reference GMS 1.4 HTML5 Export was (and still is) returning gamepad_get_device_count(); = 0 but I'm now playing it with a gamepad.

If you need it for one gamepad then it looks like the HTML5 export will still let you use the gamepad if you use device 0.

So if you're checking gamepad_get_device_count() to start your gamepad code try gamepad_is_connected(0). That worked for me. Could be that checking specific slots works fine? Haven't checked but you could just loop a reasonable number of devices since the number of slots available will never realistically be higher than 20.

Also found that it gets some buttons mixed up? Could just be the controller (DS4) as I only have one to test with but the triggers swap with the right thumbstick.

html5gamepad
.com/ revealed that one for me.

Hopefully that helps, very little information out there about this.
 

Let's Clone

Member
Had the same issue, and could have the same solution for you?
Turns out the browser doesn't recognize a controller until some input has occurred. Felt pretty dumb when I figured this out, but everything works fine after pressing any button on the controller haha.
 
A

Adam Eason

Guest
Had the same issue, and could have the same solution for you?
Turns out the browser doesn't recognize a controller until some input has occurred. Felt pretty dumb when I figured this out, but everything works fine after pressing any button on the controller haha.
THANK YOU. i know this was forever ago, but its good to know.
 
Top