• 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.

Windows Joystick support?

creagan

Member
I am a newbie trying out Gamemaker vs. Unity. I want to use an old-school joystick in GM 2.3 running Windows 10. Is that possible? I see where Joystick commands were deprecated in GM2.x. Ouch. I hope Gamemaker is not just incompatible with all joysticks on the p.c.

If this is impossible, I am looking for what brand of gamepad I can buy to run on my Win10 machine and have GM recognize it.
 

kburkhart84

Firehammer Games
I am a newbie trying out Gamemaker vs. Unity. I want to use an old-school joystick in GM 2.3 running Windows 10. Is that possible? I see where Joystick commands were deprecated in GM2.x. Ouch. I hope Gamemaker is not just incompatible with all joysticks on the p.c.

If this is impossible, I am looking for what brand of gamepad I can buy to run on my Win10 machine and have GM recognize it.
The "joystick" commands were deprecated way back when...but the actual support for joysticks/gamepads is 100% still there. Gamemaker supports both XInput XBOX gamepads, and almost any other gamepad/joystick device out there as well(as long as Windows loads a driver for it and you can see it in the Windows Control Panel). On Windows, gamepad IDs 0 to 3 or the 4 XBOX gamepads, while 4 - 11 are the other gamepads. You can't count on IDs being the same all the time though, and so the manual recommends you using the async functions to detect gamepads as they are connected. On Windows however, you don't actually have to because the IDs are always 0-11 currently(as documented as well), although missing from the docs is information about how on Linux, gamepad IDs start on 20(so I've been told).
 

creagan

Member
The "joystick" commands were deprecated way back when...but the actual support for joysticks/gamepads is 100% still there. Gamemaker supports both XInput XBOX gamepads, and almost any other gamepad/joystick device out there as well(as long as Windows loads a driver for it and you can see it in the Windows Control Panel). On Windows, gamepad IDs 0 to 3 or the 4 XBOX gamepads, while 4 - 11 are the other gamepads. You can't count on IDs being the same all the time though, and so the manual recommends you using the async functions to detect gamepads as they are connected. On Windows however, you don't actually have to because the IDs are always 0-11 currently(as documented as well), although missing from the docs is information about how on Linux, gamepad IDs start on 20(so I've been told).
Thanks for the reply; that's good to know. I can see it just fine in Windows and Windows recognizes the buttons and joystick movement. However, the gamepad_is_connected(0-11) command sees nothing nor does the gamepad_get_mapping (0-11). 0-11 are the ports/slots that it says are available. Where can I find the Async functions you reference?
 

kburkhart84

Firehammer Games
Yes, the old Flight-Simulator kind.
That should work fine under IDs 4 - 11. It may actually take up more than one if it reads as multiple devices(some have multiple parts and I don't know what you have). I have no idea why you aren't picking it up. Maybe show us the code? And make sure the you are in the right room and that the object that has the code actually has an instance placed in the room. One difference is that you will need to handle the POV stick(s) using a different function, as those don't work like buttons and regular axes do.

The async events are also in the manual. The gamepad section should link there, or you can find it directly here. Note that the parts referring to the gamepads are in the "System" category of that section.
 

creagan

Member
That should work fine under IDs 4 - 11. It may actually take up more than one if it reads as multiple devices(some have multiple parts and I don't know what you have). I have no idea why you aren't picking it up. Maybe show us the code? And make sure the you are in the right room and that the object that has the code actually has an instance placed in the room. One difference is that you will need to handle the POV stick(s) using a different function, as those don't work like buttons and regular axes do.

The async events are also in the manual. The gamepad section should link there, or you can find it directly here. Note that the parts referring to the gamepads are in the "System" category of that section.
Here is the code I am using. It shows 12 available slots but nothing connected in any of them.

var gp_num = gamepad_get_device_count();
show_debug_message(gp_num);

for (var i = 0; i < gp_num; i++) {
if (gamepad_is_connected(i)){
show_debug_message("connected");
}
else {
show_debug_message("not connected")
};
}

Again, I am a newbie so I may be missing something very obvious.
 

creagan

Member
OK, I think I got it based upon what you told me in earlier posts. Although the gamepad_is_connected command did not recognize that anything was plugged in, the gamepad_get_guid command found something and a direct read of the corresponding guid (joystick) x-axis returns the value!

THANK YOU!
 

kburkhart84

Firehammer Games
OK, I think I got it based upon what you told me in earlier posts. Although the gamepad_is_connected command did not recognize that anything was plugged in, the gamepad_get_guid command found something and a direct read of the corresponding guid (joystick) x-axis returns the value!

THANK YOU!
So you say you are able to read the gamepad's x-axis with the ID, but when you use gamepad_is_connected() it comes back as false? Is that on the first frame of the game or at any time later on(I think there is a slight delay).
 

creagan

Member
I am using this command to report the value: show_debug_message(gamepad_axis_value(5,gp_axislh)); It's in a step event.
The "gamepad_is_connected" command was in a create event, but it didn't return anything in a step event if I recall correctly.
 
Last edited:

kburkhart84

Firehammer Games
I am using this command to report the value: show_debug_message(gamepad_axis_value(5,gp_axislh)); It's in a step event.
The "gamepad_is_connected" command was in a create event, but it didn't return anything in a step event if I recall correctly.
OK, so it is gamepad ID '5' that seems to be working. I think you should try it in a step event, right there with the axis checking function. If it still returns false there, you have a bug and it might be worth mentioning to Yoyogames. I personally have never noticed this issue(and in fact in my input system I don't even check inputs on a gamepad unless the gamepad_is_connected() function returns true.
 
Top