Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411430 Posts in 69363 Topics- by 58416 Members - Latest Member: JamesAGreen

April 19, 2024, 11:52:00 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Game Maker and PS4 pads
Pages: [1]
Print
Author Topic: Game Maker and PS4 pads  (Read 3397 times)
Peace Soft
Level 0
***


All magic is made from corn


View Profile WWW
« on: July 03, 2016, 03:21:43 PM »

So I want to add controller support to my game, but Game Maker's gamepad functions only support xinput, apparently, which is only used by Xbox pads. I've heard of a couple ways to do this:

-Using the joystick functions instead of the gamepad ones. This works, but it causes a huge problem with Game Maker where if you call any joystick function, even the one that just checks for the existence of a joystick, after a pad has been disconnected, the game slows to a dead crawl. Is there any way around this? I could just plug in a warning screen like "don't disconnect your PS4 controller or you'll have to restart your machine" but this feels clumsy and annoying to the player.

-Using a program to reinterpret the PS4 inputs as xinput. I see that there's an after-market plugin for this (DS4 for windows) but it doesn't appear to be something I can bundle with the game.

I know there's a way to make this work, because Undertale and Hyper Light Drifter both accept PS4 inputs with zero problems. Anyone done this before?

I could also just say "Xbox controllers only, use anything else at your own risk" but I don't like the fact that Microsoft has promulgated this whole new API for seemingly no reason except to make it more of a pain in the ass to support anything else.
Logged
Polly
Level 6
*



View Profile
« Reply #1 on: July 03, 2016, 04:08:01 PM »

This works, but it causes a huge problem with Game Maker where if you call any joystick function, even the one that just checks for the existence of a joystick, after a pad has been disconnected, the game slows to a dead crawl.

Which version of Game Maker? I just tried this using a ( deliberately ) very taxing demo which checks the joystick every frame .. and the framerate remained the exact same after disconnected the controller while the game was running.
Logged
Peace Soft
Level 0
***


All magic is made from corn


View Profile WWW
« Reply #2 on: July 03, 2016, 04:42:37 PM »

Studio. I thought I had the latest update but maybe not? I'll check
Logged
Peace Soft
Level 0
***


All magic is made from corn


View Profile WWW
« Reply #3 on: July 06, 2016, 12:46:22 PM »

I've got the latest Stable version, but maybe it's only fixed in the latest Beta? Which update channel are you on, do you know?
Logged
sajidsarker
Level 0
**


View Profile
« Reply #4 on: September 07, 2016, 02:10:10 AM »

I know I'm digging up kind of an old thread, but it's recent and relevant enough.

Is there a way to optimize joystick code so we don't get the cpu to crawl as it tries to detect controllers at every step? My only solution so far is to run a check on a timer every 10 seconds to detect whether the controller is input which creates a consistent lag spike every 10 seconds.
Logged
Gradius
Level 0
*


View Profile
« Reply #5 on: September 21, 2016, 10:26:19 AM »

So long as you're using Game Maker: Studio, you don't have to detect the gamepad yourself anymore. Instead an asynchronous event is fired when a gamepad is connected that you can catch (the code for it is in the manual in the gamepad section). There shouldn't be any lag either way though if you're using an up to date version.
Logged
Juju
Level 0
**


Grumpy Pug


View Profile WWW
« Reply #6 on: September 26, 2016, 11:36:46 AM »

I've not had problems scanning through connected gamepads. This could indicate some driver problems, or some heavy middleman software. Regardless, as Gradius says, there is an async event for gamepad connection/disconnection nowadays. DInput controllers run through ids 8 -> 11
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic