HTML5 gamepad disconnect freeze
AshumBesher
Member, PRO Posts: 124
I'm working on adding controller support for my game. I'm testing using an Xbox One controller with a USB. It all works fine except for one thing. If I disconnect the USB mid-game, the game screen freezes. Is there a fix for this? Thanks.
Get Screaming Loaf on Steam:
https://store.steampowered.com/app/1813910/Screaming_Loaf/
Comments
Is this happening in browser or in wrapper?
I've never seen the problem in browser, but I only have the PS4 controller and our arcade sticks to play with.
If it's in wrapper, let me know which version of nw.js / electron you're using so we can look at it.
If it's in browser, let me know what browser you're testing with.
It's happening in the wrapper (nw,js 0.63.0), but I also made a quick test project in the online creator and it happens in the online creator preview too.
Get Screaming Loaf on Steam:
https://store.steampowered.com/app/1813910/Screaming_Loaf/
@AshumBesher are you using Chrome or Firefox?
It happens in the online creator in both Chrome and Edge.
Get Screaming Loaf on Steam:
https://store.steampowered.com/app/1813910/Screaming_Loaf/
K, thx. I guess it's time to go grab an Xbox controller!
It's an unusual bug. When it freezes, it seems as though the game is still running as it should but the video just isn't refreshing. I noticed when I reconnect the controller, it resumes the game from after the amount of "frozen" time has passed, so gameplay was still happening in the background while the screen was stuck. I'm not sure if I explained this well, but I hope this helps narrow down the problem.
Get Screaming Loaf on Steam:
https://store.steampowered.com/app/1813910/Screaming_Loaf/
Tonight I tested with a Nintendo Switch pro controller via USB, same thing happens.
Get Screaming Loaf on Steam:
https://store.steampowered.com/app/1813910/Screaming_Loaf/
Has anybody been able to replicate this?
Get Screaming Loaf on Steam:
https://store.steampowered.com/app/1813910/Screaming_Loaf/
@AshumBesher found the source of it. Looking into one other issue and will push an update.
Great, thanks :)
Get Screaming Loaf on Steam:
https://store.steampowered.com/app/1813910/Screaming_Loaf/
This fix has been pushed, let us know if you run into any issues.
The controller disconnects without freezing the game now, thank you. However the game.players.player1.joystick.connected doesn't seem to change back to false after disconnect.
Get Screaming Loaf on Steam:
https://store.steampowered.com/app/1813910/Screaming_Loaf/
Since the game.players.player1.joystick.connected doesn't change back to false on disconnect, any rules I make based on that don't work. Is there a fix for this? Thanks.
Get Screaming Loaf on Steam:
https://store.steampowered.com/app/1813910/Screaming_Loaf/
Never mind, I figured out a fix, I edited a few lines in the "gse-export" JavaScript file. I had pretty much no idea what I was doing, but I got it working with trial and error haha.
Get Screaming Loaf on Steam:
https://store.steampowered.com/app/1813910/Screaming_Loaf/