Sign In Register

How can we help you today?

Start a new topic

GameSparks freezes UE4 when connection is lost.

Hello everyone,

I am experiencing a weird problem that I was not able to solve for hours. I am using Unreal Engine 4.21 version.

I have an almost empty project, with a single main menu scene that runs only a single UI animation on it. I created the project to test Steam OSS and GameSpark integrations. In the project, I have Steam Subsystem enabled, and it connects to Steam without any problems. I followed the documentation to integrate GameSparks. I use a GameInstance and create GameSpark Object in it, then when the game begins I call Connect, just like in the QuickStart guide. I also have a callback added on the OnGameSparksAvailable delegate. 

I wanted to see the functionality of OnGameSparksAvailable, so I run the game with some logs, at first, when I have internet connection everything is fine and successfully connects. Then to see what is going to happen, I disabled my internet connection(thorough Network Center in Windows) and what happens is that my game freezes for 3-5 seconds, then continues. I narrowed down everything and removed the Steam from the equation, only to find out that GameSparks was causing the game thread to suspend. 

I inspected the logs, what happens is that when I disable the internet connection UGameSparksModule logs these three lines:

[101]UGameSparksModuleLog: Create new connection

[101]UGameSparksModuleLog: Connection stopped, deleting it

[240]UGameSparksModuleLog: Connection not ready in time, deleting it

After logging these, it waits for around half a second then logs:

[240]UGameSparksModuleLog: WebSocket closed

Immediately after it logs "WebSocket closed", my game hangs and freezes for couple of seconds, then it continues exuction by logging:

[241]UGameSparksModuleLog: Create new connection

And it tries to reconnect. This almost happens every single time it logs "WebSocket closed". Sometimes it does not, but usually it does freeze the game. Especially if I open the game without the internet connection, after couple of seconds it gives the same log and freezes for some time.

I have also tried to implement a reconnect functionality to my UI, and I have tried Disconnect + Connect, Reconnect and Reset methods, except Reset which did not seem to try reconnecting, 5 out of 10 times I try to connect while there is not an internet connection or a current connection goes away, the game freezes.

I have not been able to fix the issue, I have tried playing the game from package, from editor, restarting Windows, resetting router settings etc., as well as different ways to implement Connect and Delegate methods, like from a Game Instance or a GameMode, still the issue exists. 

1 Comment

Have also found this issue recently, if we start our game with no connection, we attempt to do a log in request and then the game simply hangs/freezes and the player is then stuck.

Login to post a comment