If clients join session at the same time, sessions "public connections" can be exceeded, causing issues

When host creates session for 2 public connections and 2 clients join at the same time, they both join this session. Meaning the lobby has 3 current players out of 2 possible.

You can manually check this yourself and kick any exceeding players. But then “Get Current Players” from “Blueprint Session Result Structure” returns 1 out of 2 possible. Meaning the value “Get Current Players” is probably clamped to the maximum public connections and when player got manually kicked (because he isn’t getting automatically kicked after exceeding player limit) this value got lowered, meaning players can once again see this session in their session results because it has 1/2 players. Which is incorrect, because there still are 2 players…

How can I solve this issue?

Easy solution, Override function PreLogin on your game mode, check number of players and send error message that server is full, in case it is. This will kick player and will not allow join to the server.

Much better solution:

If you want to get correct result, you should rely on using Online Beacons.
Setting them up can be intimidating, but trust me, it’s not that hard, and it’s good to have them. Using beacons you can get accurate server state, accurate ping and even do a FPS check and tell clients what is the FPS on the server. You can find good tutorial about how to set them up in this list:

2 Likes

Hi, Bojann, In prelogin, it will not work if many players try to join game at same time. Real player num will exceeded the max numbers . Because GetNumPlayers() function will add new player after post login, but this gap need time.
Do you have any better way ?

Hmm, didn’t know that. I would add additional check in post request then. I’m not aware of any additional way to do it now. Maybe there is a way, but I don’t know it :slight_smile:

Fine,3ks