Module |
|
Header |
/Engine/Source/Runtime/Engine/Classes/GameFramework/GameModeBase.h |
Include |
#include "GameFramework/GameModeBase.h" |
class AGameModeBase : public AInfo
The GameModeBase defines the game being played. It governs the game rules, scoring, what actors are allowed to exist in this game type, and who may enter the game.
It is only instanced on the server and will never exist on the client.
A GameModeBase actor is instantiated when the level is initialized for gameplay in C++ UGameEngine::LoadMap().
The class of this GameMode actor is determined by (in order) either the URL ?game=xxx, the GameMode Override value set in the World Settings, or the DefaultGameMode entry set in the game's Project Settings.
Name | Description | ||
---|---|---|---|
|
uint32: 1 |
bPauseable |
Whether the game is pauseable. |
|
uint32: 1 |
bStartPlayersAsSpectators |
Whether players should immediately spawn when logging in, or stay as spectators until they manually spawn |
|
uint32: 1 |
bUseSeamlessTravel |
Whether the game perform map travels using SeamlessTravel() which loads in the background and doesn't disconnect clients |
|
TSubclassOf< AP... |
DefaultPawnClass |
The default pawn class used by players. |
|
DefaultPlayerName |
The default player name assigned to players that join with no name specified. |
|
|
TObjectPtr< AGa... |
GameSession |
Game Session handles login approval, arbitration, online game interface |
|
TSubclassOf< AG... |
GameSessionClass |
Class of GameSession, which handles login approval and online game interface |
|
TObjectPtr< AGa... |
GameState |
GameState is used to replicate game state relevant properties to all clients. |
|
TSubclassOf< AG... |
GameStateClass |
Class of GameState associated with this GameMode. |
|
TSubclassOf< AH... |
HUDClass |
HUD class this game uses. |
|
OptionsString |
Save options string and parse it when needed |
|
|
TArray< FCanUnp... |
Pausers |
The list of delegates to check before unpausing a game |
|
TSubclassOf< AP... |
PlayerControllerClass |
The class of PlayerController to spawn for players logging in. |
|
TSubclassOf< AP... |
PlayerStateClass |
A PlayerState of this class will be associated with every player to replicate relevant player information to all clients. |
|
TSubclassOf< AP... |
ReplaySpectatorPlayerControllerClass |
The PlayerController class used when spectating a network replay. |
|
TObjectPtr< ASe... |
ServerStatReplicator |
|
|
TSubclassOf< AS... |
ServerStatReplicatorClass |
|
|
TSubclassOf< AS... |
SpectatorClass |
The pawn class used by the PlayerController for players when spectating. |
Name | Description | |
---|---|---|
|
AGameModeBase ( |
Name | Description | ||
---|---|---|---|
|
bool |
AllowCheats ( |
Return true if player should be allowed to use cheats by default |
|
bool |
AllowPausing ( |
Returns true if the player is allowed to pause the game |
|
bool |
CanServerTravel ( |
Returns true if allowed to server travel |
|
bool |
CanSpectate ( |
Return whether Viewer is allowed to spectate from the point of view of ViewTarget. |
|
void |
ChangeName ( |
Sets the name for a controller |
|
AActor * |
ChoosePlayerStart ( |
Return the 'best' player start for this player to spawn from Default implementation looks for a random unoccupied spot |
|
bool |
ClearPause() |
Checks the list of delegates to determine if the pausing can be cleared. |
|
void |
DispatchPostLogin ( |
Called as part of the PostLogin process. This is the last step before we spawn a new player. |
|
void |
FailedToRestartPlayer ( |
Called in the event that we fail to spawn a controller's pawn, which maybe it didn't have one or maybe it tried to spawn and was destroyed due to collision. |
|
AActor * |
FindPlayerStart ( |
Return the specific player start actor that should be used for the next spawn This will either use a previously saved startactor, or calls ChoosePlayerStart |
|
void |
FinishRestartPlayer ( |
Handles second half of RestartPlayer |
|
void |
ForceClearUnpauseDelegates ( |
Forcibly removes an object's CanUnpause delegates from the list of pausers. |
|
void |
GameWelcomePlayer ( |
Allows game to send network messages to provide more information to the client joining the game via NMT_GameSpecific (for example required DLC) the out string RedirectURL is built in and send automatically if only a simple URL is needed |
|
void |
GenericPlayerInitialization ( |
Handles all player initialization that is shared between the travel methods (i.e. called from both PostLogin() and HandleSeamlessTravelPlayer()) |
|
UClass * |
GetDefaultPawnClassForController ( |
Returns default pawn class for given controller |
|
TSubclassOf<... |
GetGameSessionClass() |
Return GameSession class to use for this game |
|
T * |
GetGameState() |
Helper template to returns the current GameState casted to the desired type. |
|
int32 |
GetNumPlayers() |
Returns number of active human players, excluding spectators |
|
int32 |
GetNumSpectators() |
Returns number of human players currently spectating |
|
TSubclassOf<... |
GetPlayerControllerClassToSpawnForSeamlessTravel ( |
Gets the class that should be used for spawning a player controller during seamless travel |
|
void |
GetSeamlessTravelActorList |
Called on server during seamless level transitions to get the list of Actors that should be moved into the new level PlayerControllers, Role < ROLE_Authority Actors, and any non-Actors that are inside an Actor that is in the list (i.e. Object.Outer == Actor in the list) are all automatically moved regardless of whether they're included here only dynamic actors in the PersistentLevel may be moved (this includes all actors spawned during gameplay) this is called for both parts of the transition because actors might change while in the middle (e.g. players might join or leave the game) |
|
void |
HandleSeamlessTravelPlayer ( |
Handles reinitializing players that remained through a seamless level transition called from C++ for players that finished loading after the server |
|
void |
HandleStartingNewPlayer ( |
Signals that a player is ready to enter the game, which may start it up |
|
bool |
HasMatchEnded() |
Returns true if the match can be considered ended |
|
bool |
HasMatchStarted() |
Returns true if the match start callbacks have been called |
|
void |
InitGame |
Initialize the game. |
|
void |
InitGameState() |
Initialize the GameState actor with default settings called during PreInitializeComponents() of the GameMode after a GameState has been spawned as well as during Reset() |
|
void |
InitializeHUDForPlayer ( |
Initialize the AHUD object for a player. |
|
InitNewPlayer ( |
Customize incoming player based on URL options |
|
|
void |
InitSeamlessTravelPlayer ( |
Handles initializing a seamless travel player, handles logic similar to InitNewPlayer |
|
void |
InitStartSpot ( |
Called from RestartPlayerAtPlayerStart, can be used to initialize the start spawn actor |
|
bool |
IsHandlingReplays() |
Returns true if replays will start/stop during gameplay starting/stopping |
|
bool |
IsPaused() |
Returns true if the game is paused |
|
AActor * |
K2_FindPlayerStart ( |
Return the specific player start actor that should be used for the next spawn This will either use a previously saved startactor, or calls ChoosePlayerStart |
|
void |
K2_OnChangeName ( |
Overridable event for GameMode blueprint to respond to a change name call |
|
void |
K2_OnLogout ( |
Implementable event when a Controller with a PlayerState leaves the game. |
|
void |
K2_OnRestartPlayer ( |
Implementable event called at the end of RestartPlayer |
|
void |
K2_OnSwapPlayerControllers ( |
Called when a PlayerController is swapped to a new one during seamless travel |
|
void |
K2_PostLogin ( |
Notification that a player has successfully logged in, and has been given a player controller |
|
APlayerContr... |
Login ( |
Called to login new players by creating a player controller, overridable by the game |
|
void |
Logout ( |
Called when a Controller with a PlayerState leaves the game or is destroyed |
|
bool |
MustSpectate ( |
Returns true if NewPlayerController may only join the server as a spectator. |
|
void |
OnPostLogin ( |
Called as part of DispatchPostLogin |
|
bool |
PlayerCanRestart ( |
Returns true if it's valid to call RestartPlayer. |
|
void |
PostLogin ( |
Called after a successful login. |
|
void |
PostSeamlessTravel() |
Called after a seamless level transition has been completed on the new GameMode. |
|
void |
PreLogin ( |
Accept or reject a player attempting to join the server. |
|
void |
PreLoginAsync ( |
Async version of PreLogin that MUST call OnComplete when done, otherwise incoming client connections will hang or timeout. |
|
APlayerContr... |
ProcessClientTravel ( |
Notifies all clients to travel to the specified URL. |
|
void |
ProcessServerTravel ( |
Handles request for server to travel to a new URL, with all players |
|
void |
ReplicateStreamingStatus ( |
Replicates the current level streaming status to the given PlayerController |
|
void |
ResetLevel() |
Overridable function called when resetting level. |
|
void |
RestartPlayer ( |
Tries to spawn the player's pawn, at the location returned by FindPlayerStart |
|
void |
RestartPlayerAtPlayerStart ( |
Tries to spawn the player's pawn at the specified actor's location |
|
void |
RestartPlayerAtTransform ( |
Tries to spawn the player's pawn at a specific location |
|
void |
ReturnToMainMenuHost() |
Return to main menu, and disconnect any players |
|
bool |
SetPause ( |
Adds the delegate to the list if the player Controller has the right to pause the game. |
|
void |
SetPlayerDefaults ( |
Initializes player pawn back to starting values, called from RestartPlayer |
|
bool |
ShouldReset ( |
Overridable function to determine whether an Actor should have Reset called when the game has Reset called on it. |
|
bool |
ShouldSpawnAtStartSpot ( |
Return true if FindPlayerStart should use the StartSpot stored on Player instead of calling ChoosePlayerStart |
|
bool |
ShouldStartInCinematicMode ( |
Check to see if we should start in cinematic mode |
|
APawn * |
SpawnDefaultPawnAtTransform ( |
Called during RestartPlayer to actually spawn the player's pawn, when using a transform |
|
APawn * |
SpawnDefaultPawnFor ( |
Called during RestartPlayer to actually spawn the player's pawn, when using a start spot |
|
APlayerContr... |
SpawnPlayerController ( |
Spawns the appropriate PlayerController for the given options; split out from Login() for easier overriding. |
|
APlayerContr... |
SpawnPlayerControllerCommon ( |
Does the work of spawning a player controller of the given class at the given transform. |
|
bool |
SpawnPlayerFromSimulate ( |
Used in the editor to spawn a PIE player after the game has already started |
|
void |
StartPlay() |
Transitions to calls BeginPlay on actors. |
|
void |
StartToLeaveMap() |
Start the transition out of the current map. |
|
void |
SwapPlayerControllers ( |
Used to swap a viewport/connection's PlayerControllers when seamless traveling and the new GameMode's controller class is different than the previous includes network handling |
|
void |
UpdateGameplayMuteList ( |
Used to notify the game type that it is ok to update a player's gameplay specific muting information now. |
|
bool |
UpdatePlayerStartSpot ( |
Attempts to initialize the 'StartSpot' of the Player. |
Name | Description | ||
---|---|---|---|
|
void |
PreInitializeComponents() |
Called right before components are initialized, only called during gameplay |
|
void |
Reset() |
Reset actor to initial state - used when restarting level without reloading. |
Name |
Description |
---|---|
FOnPreLoginCompleteDelegate |
Name | Description | ||
---|---|---|---|
|
APlayerContr... |
SpawnPlayerController ( |
SpawnPlayerController with Location and Rotation is deprecated, call or override the version that takes an Option string instead |
|
APlayerContr... |
SpawnReplayPlayerController ( |
SpawnReplayPlayerController is deprecated, replay controller spawning is handled inside the new version of the SpawnPlayerController function |