Making a player 'time out' if they don't load into the round quickly enough?

So I’m currently working on the round system for my game, and I’m not entirely sure on how to approach handling laggy players.

My round system used to iterate through every player entering the round, pinging the client via remote event, then just waiting for the client to respond. In the event of laggy players or a crashed player client, the server would just hang forever.

How would I kick the player out of a round after n seconds if their client doesn’t respond during the round loading screen? Would I simply wait n seconds on the server, and if the client hasn’t responded by then remove them from the round?

I know “Flood Escape 2” by @Crazyblox does this. I was playing FE2 on a bad internet connection, and I got a “Sorry, you timed out while entering the round” screen.

Any insight/thoughts on how to do this? Is my method of just waiting n seconds on the server and checking if the client responded the best way to go about this?

1 Like

Or something of a similar concept should work, if you want to disconnect them if their ping is too high, on a loop, get the player’s tick() client-side, have a remote event send their tick() to the server, have the server do a tick() and compare them (serverTick - clientTick) will give you the delay in seconds, if it’s too high you can kick the player.

1 Like

So basically just wait n amount of time on the server, and if the client hasn’t responded remove the client from the round.

2 Likes

Now I’ve re-read that, you could just use your current system; in the case of crashed clients, if you’re not already, just adding a limit to stop the server hanging forever surely?, or using my method, have is so the the server has not recieved a ping from the client within the last 5 seconds and you get a ping update from the client every 3, boot them off the server.

1 Like

Alright. Thanks for the input. :slight_smile:

1 Like

As written in here,

This means tick() from server and client could be in different time zones. So your method could be innacurate.

Your method would only work if you have previously calculated the relative time from the server and client (of course, excluding the latency involved).

2 Likes

I don’t know much about this but couldn’t you keep a constant record of their ping and just check it when loading the round ? not sure how thatd affect performance though