How to detect server crash (clientside)

On metaconstruct I’ve seen that if the server starts to crash/lag out or crashes it somehow detects it, how is this possible?

Just send a net message every so often and check when you last received it clientside to determine if connection is lost.

-edit- I need to stop opening all threads up at once and responding after each prior…

You can do it with Lua on the Client. Basically the client sends out intermittent “ping” net messages. If the server doesn’t response within x time then open the “crash-detected” window. Keep trying to send net-messages during the time so you can close the window just in case it was just a lag spike ( although it may be better to extend the time so the server doesn’t get tons of messages all at once, or just ensure the server only sends the latest ping back ).

So basically pinging with net messages?

ping tests

Alright cool, what do you guys think is a suitable interval?

The server and client communicate with each other using scripts that exist on both ends. When the client doesn’t receive a pong back from the server, it assumes it lost connection.

If you want it to be 100% clientside, that will be a little more tricky.
One way you can accomplish this is to send a raw udp packet that the server can respond to.

All responds in this thread will be a hacky soloution ( ping pong in lua ), the reason why they are hacky is that the engine already does just that, and even has a function called IsTimedOut in INetChannel.
The best way would be if someone would open a pull request to get vinh to add a lua binding for INetChannel:IsTimedOut.

Vinh the cough cough guy?

You’re special, I hope you know that.