Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Steamworks.gml example

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

Show LATENCY

A topic by PeperinoPomulo created Apr 20, 2019 Views: 649 Replies: 5
Viewing posts 1 to 3

Hello! Looking at the menu in the example, is there any way to show the current latency next to the name of the creator of the lobby?

Thank you!

Developer

The only way is to establish a temporary connection with each lobby owner (you can add an extra function to the DLL or just steam_lobby_set_data it so that you can retrieve it later) and exchange a few packets to figure out the latency.

Ooh I understand, I wouldn't mind showing the ping once inside the lobby, I think it would be better that way.. so for doing inside the lobby i need to use "steam_lobby_set_data" right?

Developer

The example already bounces "ping" packets back and forth, but you'll need to measure time since the last one to calculate the actual latency.

In what event would you measure the time since the last packet? I am having an issue where since I'm making that calculation in Step, my ping is always a multiple of room speed.

Developer

Since GameMaker cannot run code “between” frames, that’s kind of what you do yeah.

As the packets will be processed together with “ping” packets, this does not produce any side effects.