PS4 controller struggles

TearyLilium

Member
I'm trying to figure out how to use a PS4 controller for my game. There is an extremely weird thing going on... So if I check for gamepad_is_connected(i) stuff it does recognize that my controller is connected and in the slot 0. If I look into the list of connected controllers, it does say that it is connected and the slot is occupied... But then if I try to have any input it doesn't seem to work?
if (gamepad_button_check(0, gp_face1))
show_message("something");

But.... apparently if I start compiling the game and I hold that gp_face1 button before it finished compiling, it will work at the very first second as the game starts and it keeps triggering it all the time afterwards even if I'm not holding the button anymore. That's why i'm very confused because clearly the controller can be read by gms2 and it recognizes it and the inputs... but it doesn't work like it should work?

also if I create an async system event and put this code in there
var type = async_load[? "event_type"];
var index = async_load[? "pad_index"];
if (type == "gamepad discovered")
{ show_message("Controller connected: " + string(index));
} else
{
show_message("Controller disconnected: " + string(index));
}

at the beginning of the game it says "Controller connected: 0" and then immediately "Controller disconnected: undefined" after that...
So it feels like the controller works the very first moment when the game starts and then it immediately disconnects?
 

TailBit

Member
You are not checking for "gamepad lost" .. so any other event that is not "gamepad discovered" would trigger the disconnect message .. the fact that "pad_index" is undefined makes it clear that it wasn't even a pad event
 

TearyLilium

Member
You are not checking for "gamepad lost" .. so any other event that is not "gamepad discovered" would trigger the disconnect message .. the fact that "pad_index" is undefined makes it clear that it wasn't even a pad event
Well that point still remains... It does register the input the moment the game starts and then immediately stops doing anything which is so confusing to me
 

TailBit

Member
Code:
var type = async_load[? "event_type"];
switch(type){
    case "gamepad discovered":
    case "gamepad lost"
        var index = async_load[? "pad_index"];
        show_debug_message(type + string( index ));
    break;
}

Your code:
Code:
if (gamepad_button_check(0, gp_face1))
show_message("something");
..looks just fine .. so I'm really not sure what the problem could be .. I guess it is in a step event?
 

TearyLilium

Member
Code:
var type = async_load[? "event_type"];
switch(type){
    case "gamepad discovered":
    case "gamepad lost"
        var index = async_load[? "pad_index"];
        show_debug_message(type + string( index ));
    break;
}

Your code:
Code:
if (gamepad_button_check(0, gp_face1))
show_message("something");
..looks just fine .. so I'm really not sure what the problem could be .. I guess it is in a step event?
Yeah looks just fine to me too, I actually did try the gamepad lost thing too and yeah the controller doesn't disconnect unless I unplug it from the pc
And yeah it is in a step event, I have no idea what the problem might be
 

TailBit

Member
Try this in the draw event:
Code:
draw_text(x,y,string(gamepad_button_value(0,gp_face1)) + " force of " + string( gamepad_get_button_threshold(0) ) + " needed" )
This is a button pressure test for gp_face1 and it displayes the needed threshold for it to be a press (which should be 0.5 by default)
 

TearyLilium

Member
Try this in the draw event:
Code:
draw_text(x,y,string(gamepad_button_value(0,gp_face1)) + " force of " + string( gamepad_get_button_threshold(0) ) + " needed" )
This is a button pressure test for gp_face1 and it displayes the needed threshold for it to be a press (which should be 0.5 by default)
Yep it does say "0 force of 0.50 needed" but if I press the button, nothing happens at all... no signs of the button being pressed at all sadly
 

TailBit

Member
Do you maybe have a program active in the background that turns gampad button presses into keyboard presses? .. I'm really running out of ideas here.
 

TearyLilium

Member
Do you maybe have a program active in the background that turns gampad button presses into keyboard presses? .. I'm really running out of ideas here.
Not at all..
it feels like it must be a bug with gamemaker studio or something? becuase that's definitely not something that should usually happen...
and so I actually just tried a DS4Windows program so that my windows interprets my PS4 controller as an Xbox one and things started working then!
So it's definitely some weird bug that gms doesn't like PS4 controllers or something, it looks..
 
Top