Sein Lobby Subsystem
Class · USeinLobbySubsystem : UGameInstanceSubsystem
#include "SeinLobbySubsystem.h"
The server-authoritative lobby: players claim slots, pick factions and teams and mark themselves ready; the host seats AI, opens and closes slots, picks the map and starts. It lives on the game instance, so a roster survives travel to the match map.
The server keeps one replicated ASeinLobbyState per world. A joining controller takes the next free slot (or the slot an admission authority gave it, or its own slot again within the reconnect grace); a leaving one keeps its slot reserved for the grace period. Starting publishes the roster as match settings, which the match world’s Game Mode binds controllers from and the Net subsystem starts the match with.
In a gameplay map played directly, the Game Mode seeds the lobby from the level’s player starts before anyone connects, so a direct start publishes the same roster.
Properties
Section titled “Properties”Gameplay Map
Section titled “Gameplay Map”TSoftObjectPtr<UWorld> GameplayMap
Editable in defaults and on instances · Blueprint read and write · Saved to config
The gameplay map the host travels to when the match starts. It overrides the Default Gameplay Map network setting, and a lobby widget can set it at runtime. If both are empty the match runs in the current map.
C++ members (33)
void ReleaseModuleOwnedStateForModuleUnload();Idempotently detach every callback and release runtime state before the owning module’s code can unload. Deinitialize delegates to this path.void InitializeLobby(int32 SlotCount = 0);Server-only: (re)initialize the lobby with SlotCount Open slots. Idempotent in the sense that re-initializing wipes existing claims — call only on fresh sessions. If SlotCount <= 0, defaults to the active preset’s slot count, then toUSeinMatchSetupSettings::MaxPlayers.void SetSlotCountOverride(int32 N);Server-only: set the slot count EnsureLobbyActor should use when lazy-spawning the lobby actor. Called fromASeinGameMode::InitGame with ResolvedMatchSettings.Slots.Num() so the lobby in a gameplay map reflects the level’s actual slot count (synthesized from the level’s SeinPlayerStarts or imported from the published lobby snapshot), NOT the lobby map’s default (AvailableMaps[0]). Zero (default) means “no override — use AvailableMaps[0] / MaxPlayers fallbacks.” Once set, persists until cleared or overwritten.void SetDirectMatchSettingsDefaults(const FSeinMatchSettings& Settings);Server-only: seed a direct gameplay-map lobby from the level’s match settings. Authored Human slots become claimable Open seats while their faction/team defaults, AI seats, Closed seats, and extensions remain intact, so manual and automatic direct-PIE starts publish the same settings. Lobby-travel snapshots do not use this path.bool ServerHandleSlotClaim(APlayerController* PC, int32 SlotIndex, FSeinFactionID Faction);Server-only: route a client’s claim request from the relay. Validates slot existence + occupancy + faction validity (via FactionService), commits to the actor, then re-replicates. Returns true on accept.bool ServerHandleSetReady(APlayerController* PC, bool bReady);Server-only: toggle the requesting PC’s slot’s bReady flag. Called by anyone with a Human-claimed slot (not host-restricted).bool ServerHandleSetTeam(APlayerController* HostPC, int32 SlotIndex, uint8 TeamID);Server-only: change a slot’s team (host-only). The framework treats TeamID as opaque; designer convention assigns meaning.bool ServerHandleSetSlotState(APlayerController* HostPC, int32 SlotIndex, ESeinSlotState NewState, FGameplayTag AIProfile);Server-only: change a slot’s state — open/close, add/remove AI bot. Host-only. AIProfile only honored when NewState == AI; ignored otherwise. Cannot be used to claim a slot for a Human — that’s ServerHandleSlotClaim’s job.bool ServerHandleLeave(APlayerController* PC);Server-only: voluntarily release the PC’s currently-claimed slot back to Open. Distinguishes “I’m leaving on purpose” from “my connection dropped” — the latter goes through OnLogout which marks the slot disconnected-but-reserved for LobbyReconnectGraceSeconds. Voluntary leaves skip the grace period; the slot becomes immediately claimable again. Returns true iff a slot was actually released.bool ServerHandleKickPlayer(APlayerController* HostPC, int32 SlotIndex);Server-only: kick whoever currently occupies SlotIndex and reset the slot to Open. Host-only. - Human-claimed slot: drops the bound PC’s NetConnection via ClientReturnToMainMenuWithTextReason, removes them from the ControllerToSlot map, and opens the slot. - AI / Closed slot: equivalent to ServerHandleSetSlotState(Open) — no PC to kick, just opens. - Open slot: no-op success. - Cannot kick the host’s own slot (would tear down the listen server). Returns true iff the operation completed (slot is now Open).bool ServerHandleSelectMap(APlayerController* HostPC, TSoftObjectPtr<UWorld> Map);Server-only: change the lobby’s selected gameplay map. Host-only. Validates the map exists inUSeinNetSettings::AvailableMaps, resizes the lobby’s slot array to match the entry’s SlotCount. Reject policy on shrink: if any currently-claimed slot would be lost by the resize (slot index > new count AND bClaimed), the switch is rejected. Host must open those slots first. UI should grey out smaller-map options when a claim would be lost — seeUSeinLobbyViewModel::IsMapShrinkSafe.bool IsHostController(APlayerController* PC) const;True iff PC is the listen-server / dedicated-server / standalone host. Used by the host-only ServerHandle* validators.bool CanAcceptConnection(const FUniqueNetIdRepl& UniqueId) const;Server-only fallback capacity check used when no external connection admission authorizer owns exact-seat assignment. Returns true (accept) if either: - The lobby actor doesn’t exist yet and no roster has committed, OR - There’s at least one free Open slot, OR - There’s a disconnected-reserved slot whose LastClaimantNetID matches UniqueId (reconnecting player). Once the roster commits, anonymous Open-slot admission is closed; exact external admission may still rebind a published Human seat. PreLogin’s ErrorMessage should be set to a human-readable refusal string when this returns false — the connecting client gets a clean “server is full” error rather than connecting and becoming a phantom PC with no slot binding.bool CanAcceptConnectionAtSlot(FSeinPlayerID Slot, const APlayerController* Controller = nullptr) const;Fail-closed availability check for an externally authorized exact slot.bool BuildMatchSettingsSnapshot(FSeinMatchSettings& CapturedSettingsOut) const;Server-only: build a fully-populatedFSeinMatchSettingsfrom the current lobby state. PC names / AI profiles flow through unchanged. CapturedSettingsOut is overwritten with the snapshot. Returns true iff the lobby has at least one Human or AI slot — empty lobby is treated as “fall back to WorldSettings” by callers.void PublishMatchSettingsSnapshot();Server-only: take a snapshot now and store it as the GI-scoped match settings override. Game mode’s ResolveMatchSettingsForWorld picks this up first. Called by Sein.Net.StartMatch.bool ServerStartMatch(bool bTravelToGameplayMap);Server: publish the roster and start the match. With bTravelToGameplayMap the server travels to the gameplay map and the match starts there; otherwise it starts in this world (a standalone world through the Start Standalone Simulation hook). Rejected without a connected Human slot, or when travel has no valid map.bool ServerReturnToLobby();Server: travel everyone back to the lobby map the match started from, after the match ended. The lobby opens again with the match’s players in their seats and its map selected. False when the match did not travel from a lobby. Calling it again while the return is pending changes nothing and returns true.bool HasPublishedSnapshot() const;True iff a snapshot has been published (PublishMatchSettingsSnapshot has been called at least once this GI lifetime).const FSeinMatchSettings& GetPublishedSnapshot() const;Snapshot accessor. Empty (default-constructed) until PublishMatchSettingsSnapshot fires.FSeinMatchSettingsLaunchCommitted& OnMatchSettingsLaunchCommitted();Fired once a published roster’s match start is accepted; the Game Mode binds controllers from it.void ConfirmPublishedMatchSettingsLaunch();Mark the published roster as started and fire the notification.bool DiscardUncommittedPreparedMatchSettingsSnapshot();Forget a published roster whose start was not accepted.bool InstallPreparedMatchSettingsSnapshot(const FSeinMatchSettings& Snapshot);Install a roster as the published snapshot without a lobby actor.void ResetForLocalSessionExit();Forget the current session’s lobby contract and slot bindings. Called when the local process leaves a session (explicit leave, kick) BEFORE it travels to the menu: the GameInstance-scoped subsystem outlives the world, and a stale published snapshot would otherwise present a dead roster in the menu and could drive the menu world’s standalone match start. Does not touch module-lifetime delegate bindings.ASeinLobbyState* GetLobbyState() const;Current replicated lobby actor; null on the client until first replication arrives, null on the server until InitializeLobby spawns it.FSeinPlayerID GetControllerSlot(const APlayerController* Controller) const;Server: the slot a controller holds in the lobby; Neutral when it holds none.void NotifyLobbyStateActorBeginPlay(ASeinLobbyState* Actor);void NotifyLobbyStateActorEndPlay(ASeinLobbyState* Actor);bool RebindSeamlessController(APlayerController* OldController, APlayerController* NewController);Rebinds only the old controller’s existing seat during server seamless travel.USeinFactionService* GetFactionService() const;Resolve the GI’s faction service. Loads the configured class lazily if it differs from the framework default (ShouldCreateSubsystem ensures only one instance exists). Returns null only if the GI is mid-teardown.FSeinMatchSettings ResolveBaseSettings() const;Resolve the snapshot’s baseFSeinMatchSettingsvalue. Returns the plugin-settings MatchSettingsStructure (designer-authored Slots manifest + Extensions array) on which the lobby overlays its replicated slot state during snapshot build.TSoftObjectPtr<UWorld> ResolveGameplayMap() const;Resolve the gameplay map to travel to on StartMatch: 1.USeinLobbySubsystem::GameplayMap (runtime override) 2.USeinNetSettings::DefaultGameplayMap (plugin setting) 3. null (start in-place; no travel)