On sessions page https://dev.epicgames.com/docs/game-services/lobbies-and-sessions/sessions/sessions-intro\#usage-limitations
I see limitations about “Add or remove players” but I’m unsure if it means joining/leaving session or un/registering a player.
Currently I am using EOSSessions::RegisterPlayers() with single user at a time. It seems fine but in a scenario of 100 players joining at the same time, could it go over the limit that I don’t see in the limit section of Sessions page ?
Thank you!
Hello, players are only added/removed to a session on our backend when a client/server calls EOS_Sessions_RegisterPlayers/EOS_Sessions_UnregisterPlayers. To reduce the amount of time you call these APIs, is it possible to batch players into a single request? Both APIs take in an array of PUIDs. Thanks!
Hello,
So Un/Register players counts as adding/removing a player from/to a session. So the limits I found for adding/removing players is meant for un/registering player to a session and not joining/leaving a session (client side)?
You mentioned client or server calling EOS_Sessions_RegisterPlayers/EOS_Sessions_UnregisterPlayers, this does not sit well wit my understanding. Only server should call these as on client side they do only local changes but nothing to session state in the backend so what did you mean by that ?
Yes, we should be able to batch them and should do that every second? or so. Just to avoid adding over 100 per minute players and hitting limits. (currently 1 player = 1 request)
Hello,
So the limits I found for adding/removing players is meant for un/registering player to a session and not joining/leaving a session (client side)?
Yes that is correct. Joining/Leaving the session does not alter the session state on the backend (player count increase/decrease). Register/Unregister players is what will update the backend.
Only server should call these as on client side they do only local changes but nothing to session state in the backend so what did you mean by that ?
For a client-server game, only the server can update the backend. Clients must also call register/unregister to update their local state (the backend is not updated).
In a P2P game, you can configure a client policy to have a game client create a session. In that case, that specific client can update the backend, other clients need to call the API to update their local state.
In other words, whoever called create session (server, or client) is responsible for updating the backend with register/unregister players. Other members of the session should call register/unregister so their local state is up to date.
There is a really good talk from one of my colleagues from Unreal Fest on sessions here: https://www.youtube.com/watch?v=h2Tr8Lk8hXI. If you start at around the 14:00 minute, the speaker does a really great job of explaining the difference between join and register player, and gives the details I mentioned above.
I think batching them and doing an update every second is fine. You should code defensively to retry if you get rate-limited.
Please let me know if you have additional questions!