Why should the clients have a AGameSession object as well? It seems like they call register and unregistered just as the server does with the IOnlineSession. Also StartSession is called in the ShooterGame example for all clients. Isn’t this call just used to change the state from pending to playing, used when listing the server? All this sounds like very server related stuffs to me. No documentation exists for the client side and it isn’t even mentioned in the documentation.
It would help me out a lot to understand how the sessions are supposed to be used. There are no documentation about this for the client side at all.
More documentation is for sure needed about this.
Is this the case of listen-server, where the client is also the server and thus he can host a game, i.e ‘StartSession()’?
@undercover have you managed to figure this out? I’m asking myself the same questions right now.
@woookie2na2 My understanding is that some implementations of IOnlineSession (dependent on your platform) uses those events to set the status for the user, e.g. In-lobby, In-Game, In-menu, etc.
Dear valued Unreal Engine users,
Sessions can be thought of as a way for a host to advertise its status to other clients and a master server. As well as helping navigating any network topology such as NAT. It is not quite a party, lobby or game, as that required establishing a further connection for those specific protocols. It is basically the way to facilitate further connections between clients and a host, sometimes called a “Beacon”.
AGameSession
is basically a gameplay script wrapper around the lower level OnlineSession
. As the user undercover
mentioned it provides methods control the session, store which players are connected, as well as listen for specific events on the session, such as players joining, the session being destroyed or the session starting or ending. As all clients need to know what session they are connected to, as well who is connected to that session for presence, as well as other events, they also need their own AGameSession
.
It should also be noted that StartSession
is not route that creates and registers a session with an online service. This is done via calling CreateSession
first. For example in the case of ShooterGame
, CreateSession
is called from the GameInstance
. As undercover
indicates, StartSession
is usually used for games that either may have a lobby or a ready screen in game. So the game transitions to a “match started” or “in progress” state and after that point clients may not join until the session is ended (e.g. back to the lobby or waiting for more players) unless the session specifically allows joining in progress. A session is fully cleaned up and deregistered by using DestroySession
, and this is usually done outside of AGameSession
as well, such as in the GameInstance
.
Thank you for your continued support,