Why isn't overlay showing current session members up on joning it?

I’m using Session and have implemented this simple scenario:

  1. A creates session and invites B
  2. B joins the session

I know that A should register B after it’s joined to update the backend and I do it and it’s ok. So after registering when A brings overlay it sees itself and B in the party.

But when B brings overlay up after it’s accepted the invite, it sees a part with itself (B) being in it. This looks odd to me. I can imagine two possible view for B only:

  1. It sees a party with A and itself (B) in it
  2. It sees a party with only A in it

I know B should also register/unregister players to keep it’s local session up to date. And I expect doing that would keep overlay with the correct info.

Is there anything needed for B to do after accepting the invite? When the B accepts the invite the session already has A in and by accepting the invite I expect the local version of session for B to be automatically update with B. So my natural expectation is to see both A and B in the overlay after accepting the invite.

Another possibility is that when B accepts the invite it only receives the server info about the session which is only A (because B has not been registered yet). In this case I expect overlay to show a party with A in it.

But right now the actual behavior of is none of the above two. B sees a party with only itself in it in the overlay.

Can you help clarify what’s needed to be done?

Thanks

You need to call RegisterPlayer on all clients for the overlay to properly show the session members. You can find this info herein our docs. Here’s a screenshot of showing what this looks like with 2 players in the session:

Thanks Seb, I think I still don’t quite understand the meaning of join. Le’ts say a session has 5 members already in it. Then X is invited to the session. When X accepts the invite and joins the session, shouldn’t the session already include all the current members in it? And X only needs to register any *new* member who joins after himslef. But seems that X needs to call register for everyone even himslef up on joining the session?

JoinSessiononly creates a local session with the name of the session “joined” if the session is joinable (for example, if it’s not full, etc…). The game is responsible for updating the local session state; calling RegisterPlayer adds the players to the local session info. You can think of the EOS backend for sessions as a bookkeeper of session data, where the data needs to be updated by the host and polled by the members.

Lobbies are quite different as they are managed by our backend. They support notifications when members join/leave, and other notifications. This removes a lot of the work the game needs to do, at the cost of a very small performance hit AND with the restriction that lobbies require a logged in player to host (sessions work on dedicated server).

If your game is P2P or Listen Server, you could use a lobby instead of a session.

Thanks Seb, here my thoughts:

> JoinSessiononly creates a local session with the name of the session “joined” …

So this tells me that everyone (including self) need to be registered in order to get the the overlay right.

  1. Player A creates the session > Registers itself > sends invite to B
  2. B joins the sessioin > Registers itself > Registeres A > notifies A that he’s joined
  3. A receives the notification > Registers B

So are the above flows proper then?

> where the data needs to be updated by the host and polled by the members.

This caused a re-confusion for me. So far we’ve said it’s the members responsibility to keep the session updated as it’s state changes. But this says the members should poll the info instead of themselves updating their local sessions. And by the way how can I poll for the info of a session? I don’t see any api for that

I want to support all the three: server, p2p and listen server. So I’ll want to implement lobby as well. But right now my focus is on Session.

Yes, the flow is correct. For (2) and (3), if you’re using UE, the host would know (B) has joined when (B) travels to the session. You wouldn’t need to implement a notification on top of that.

Sorry for the confusion, I wasn’t very descriptive in my previous message, and only gave you a partial answer that was misleading! Each member is responsible for keeping their local session updated. They can periodically call FindSession using the SessionId to update their local sessions state (polling). This assumes the session owner is updating the session data on the backend (registering players, updating session attributes,…). Alternatively, the session owner can notify members when session data changes (like new players joining, updating session attributes, …) and members can update their local state.

Let me know if you have any follow-up questions!

Thanks Seb, I think it’s clear now. Regarding the point about UE. Can you point me which notification is triggered? and we should do register/unregister in that notification right?

It’s not a notification that is triggered when the player joins the server. As part of the incoming player joining the server, AGameModeBase::Login will be called, which will call AGameModeBase::InitNewPlayer, which will, in turn, calls GameSession->RegisterPlayer. If you override the RegisterPlayer function in your GameSession class to call the OSS RegisterPlayer function, it will get called automatically.

Thanks!