Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics

Steamworks.gml example

Sample project for Steam-based networking for GameMaker. · By YellowAfterlife

Handling Timeouts

A topic by Ben Allen created May 29, 2018 Views: 266 Replies: 3
Viewing posts 1 to 2

First of all, thank you for making this extension available. I don't think I'd ever get anything working online without this extension. 

I'm developing a turn based tactics game for two players. The game is fully functional at this point, but timeouts are making the game unplayable for some players. Is there a good method for preventing players from frequently disconnecting (or a method for reconnecting players after they've lost connection)?


Developer (1 edit)

Steam networking is state-less so you can continuously send a packet until the player confirms that they have received it.

Also see if you are calling update function at least every few frames and how are you detecting the timeouts (as, again, Steam API itself has no concept of a timeout).

Thanks for the response!

In your documentation, it says that steam_net_packet_send returns whether the packet was sent successfully or not. So could I just convert your packet_send_all script into a loop that sends the packet until it returns true (or until it fails X number of times)? 

I also noticed in your documentation that steam_net_packet_type_unreliable parameter says it "will not be resent automatically". Does that imply that the other three types are already re-sending automatically until they return true?

I am calling steam_net_update in a step event which doesn't have any exits or breaks, so it's definitely getting called. The only way I'm detecting timeouts is through your chat system (I'm still very new at networking stuff).


The packet being sent successfully is not an indication of it being received, as it returns instantly. Rather it indicates that you have the ID right and can send as such.

The best source for expected behaviour would be the official documentation. I think as of writing my doc, that version was not yet live, so my doc notes are based on whatever was mentioned in the source code for the example/headers.

"Reliable" packet types should be resent automatically and delivered in order they are sent in.

You should send a "ping" packet now and then and detect timeout if the player doesn't respond for X seconds.