• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • 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.

Legacy GM Network connection drops when window is minimized

Ronchon

Member
Hi,
I'm having an issue where if the game is minimized, connection become much more unstable for some players, often ending up into an actual disconnection and acting as if some networking events simply stopped being executed ( from logs, an event happening in the step even of an object will seemingly suddenly stop happening ).
I have no idea what's actually going on and if there's any way to prevent this behavior ?
 

Pfap

Member
It sounds like it may be an issue with the game becoming paused? Checkout the os_is_paused() function in the manual.
 

Ronchon

Member
Thanks! But that seems to just allow me to detect if the game is minimized or on focus ?

I've never conditioned anything in my code to this, so my game should run the same whether its minimized or not. But there seems to be _something_ enabled by default that does affect the game, so i'm wandering if there's any way to disable it and ensure the game runs as if it was on focus at all times.
 

Pfap

Member
Thanks! But that seems to just allow me to detect if the game is minimized or on focus ?

I've never conditioned anything in my code to this, so my game should run the same whether its minimized or not. But there seems to be _something_ enabled by default that does affect the game, so i'm wandering if there's any way to disable it and ensure the game runs as if it was on focus at all times.
Hmmm, if your on the windows platform you're right that it would not matter. Maybe, it's with how Windows handles network data... I'm afraid I can't really help much on this one.
 

The-any-Key

Member
When you minimize or let the game be in-active. The game often becomes slow. So the FPS will drop. Windows stop give resources to the game. So if you have a timeout (if you use UDP) in the game that depends on frames the connection will be lost. Use delta time instead. If you use TCP I would suggest you try change the sleep timer In the game.
 

The-any-Key

Member
Sorry. Sleep margin: display_set_sleep_margin (Global Games Settings>Window in GMS1.4)
But it is a long shot. But TCP need all the CPU power it can grab so try set it to 20 or more. Or if that dont work try less like 1.

Note that TCP in GM got a bug when the ping is around 120-200ms. This cause the stream handler to pass half baked buffers. So your game ends up with half a buffer with data. The rest is added in the next + the other stream. As TCP is stream oriented and not packet oriented like UDP. You will notice this if some players get errors like "read outside buffer".
 
Last edited:
Top