Language:
Discover
By Skill Level
By Category

AGameSession

Choose your OS:

Inheritance Hierarchy

Syntax

class AGameSession : public AInfo

Remarks

Acts as a game-specific wrapper around the session interface. The game code makes calls to this when it needs to interact with the session interface. A game session exists only the server, while running an online game.

Variables

Name Description

Public variable

bool

 

bRequiresPushToTalk

Is voice enabled always or via a push to talk keybinding

Public variable

int32

 

MaxPartySize

Restrictions on the largest party that can join together

Public variable

int32

 

MaxPlayers

Maximum number of players allowed by this server.

Public variable

int32

 

MaxSpectators

Maximum number of spectators allowed by this server.

Public variable

uint8

 

MaxSplitscreensPerConnection

Maximum number of splitscreen players to allow from one connection

Public variable

FName

 

SessionName

SessionName local copy from PlayerState class.

Constructors

Name Description

Public function

AGameSession

(
    const FObjectInitializer & ObjectIn...
)

Functions

Name Description

Public function Virtual

void

 

AddAdmin

(
    APlayerController * AdminPlayer
)

Add a player to the admin list of this session

Public function Virtual

FString

 

ApproveLogin

(
    const FString & Options
)

Called from GameMode.PreLogin() and Login().

Non-empty Error String if player not approved

Public function Virtual

bool

 

AtCapacity

(
    bool bSpectator
)

True if there is no room on the server for an additional player

Public function Virtual

bool

 

BanPlayer

(
    APlayerController * BannedPlaye...,
    const FText & BanReason
)

Forcibly remove player from the server and ban them permanently

Public function Virtual

bool

 

CanRestartGame()

Called from GameMode.RestartGame().

Public function Virtual

void

 

DumpSessionState()

Dump session info to log for debugging.

Public function

int32

 

GetNextPlayerID()

A new unique player ID

Public function Virtual

bool

 

GetSessionJoinability

(
    FName InSessionName,
    FJoinabilitySettings & OutSettings
)

Get the current joinability settings for a given session

Public function Virtual

void

 

HandleMatchHasEnded()

Handle when the match has completed

Public function Virtual

void

 

HandleMatchHasStarted()

Handle when the match has started

Public function Virtual

void

 

HandleMatchIsWaitingToStart()

Handle when the match enters waiting to start

Public function Virtual

bool

 

HandleStartMatchRequest()

================================================================================= MATCH INTERFACE true if GameSession handled the request, in case it wants to stall for some reason.

Public function Virtual

void

 

InitOptions

(
    const FString & Options
)

Initialize options based on passed in options string

Public function Virtual

bool

 

KickPlayer

(
    APlayerController * KickedPlaye...,
    const FText & KickReason
)

Forcibly remove player from the server

true if player was able to be kicked, false otherwise

Public function Virtual

void

 

NotifyLogout

(
    FName InSessionName,
    const FUniqueNetIdRepl & UniqueId
)

Called when a player logs out of game.

Public function Virtual

void

 

NotifyLogout

(
    const APlayerController * PC
)

================================================================================= LOGOUT Called when a PlayerController logs out of game.

Public function Virtual

void

 

OnAutoLoginComplete

(
    int32 LocalUserNum,
    bool bWasSuccessful,
    const FString & Error
)

Delegate triggered on auto login completion

Public function Virtual

void

 

PostLogin

(
    APlayerController * NewPlayer
)

Called by GameMode::PostLogin to give session code chance to do work after PostLogin

Public function Virtual

void

 

PostSeamlessTravel()

Called after a seamless level transition has been completed on the new GameMode used to reinitialize players already in the game as they won't have *Login() called on them

Public function Virtual

bool

 

ProcessAutoLogin()

================================================================================= LOGIN Allow an online service to process a login if specified on the commandline with -auth_login/-auth_password

Public function Virtual

void

 

RegisterPlayer

(
    APlayerController * NewPlayer,
    const TSharedPtr < const FUniqueNetI ...,
    bool bWasFromInvite
)

Register a player with the online service session

Public function Virtual

void

 

RegisterServer()

Allow a dedicated server a chance to register itself with an online service

Public function Virtual

void

 

RegisterServerFailed()

Callback when autologin was expected but failed

Public function Virtual

void

 

RemoveAdmin

(
    APlayerController * AdminPlayer
)

Remove a player from the admin list of this session

Public function Virtual

bool

 

RequiresPushToTalk()

Does the session require push to talk

Public function Virtual

void

 

Restart()

================================================================================= SESSION INFORMATION Restart the session

Public function Virtual

void

 

ReturnToMainMenuHost()

Gracefully tell all clients then local players to return to lobby

Public function Virtual

void

 

UnregisterPlayer

(
    const APlayerController * Exiti...
)

Unregister a player from the online service session

Public function Virtual

void

 

UnregisterPlayer

(
    FName InSessionName,
    const FUniqueNetIdRepl & UniqueId
)

Unregister a player from the online service session

Public function Virtual

void

 

UnregisterPlayers

(
    FName InSessionName,
    const TArray < TSharedRef < const FUn ...
)

Public function Virtual

void

 

UpdateSessionJoinability

(
    FName InSessionName,
    bool bPublicSearchable,
    bool bAllowInvites,
    bool bJoinViaPresence,
    bool bJoinViaPresenceFriendsOnly
)

Update session join parameters

References

Module

Engine

Header

Runtime/Engine/Classes/GameFramework/GameSession.h