Identity & Sessions
UCrimsonOnlineIdentityService
Wraps IOnlineIdentity. Manages platform login, logout, and presence status for all local players.
| Function | Description |
|---|---|
| Login(LocalPlayerIndex, Delegate) | Initiates platform login for the given local player |
| Logout(LocalPlayerIndex, Delegate) | Logs out the given local player |
| GetLoginStatus(LocalPlayerIndex) | Returns ECrimsonLoginStatus (NotLoggedIn / LoggingIn / LoggedIn) |
| GetPlayerInfo(LocalPlayerIndex) | Returns FCrimsonOnlinePlayerInfo (UniqueId, DisplayName, AvatarURL) |
| GetUniquePlayerId(LocalPlayerIndex) | Returns TSharedPtr<const FUniqueNetId> |
| IsLoggedIn(LocalPlayerIndex) | Returns bool |
| OnLoginStatusChanged | Delegate broadcast on any local player login state change |
Async node
UCrimsonAsyncAction_Login — Blueprint async action. Pins: LocalPlayerIndex (int), On Success (LocalPlayerIndex, PlayerInfo), On Failure (LocalPlayerIndex, ErrorMessage).UCrimsonOnlineSessionService
Wraps IOnlineSessions. Handles session creation, search, join, and destruction. Session settings are configured via FCrimsonSessionSettings.
FCrimsonSessionSettings
| Field | Type | Description |
|---|---|---|
| MaxPublicConnections | int32 | Max simultaneous players (default 4) |
| bIsLAN | bool | LAN session (disables online matchmaking) |
| bAllowJoinInProgress | bool | Allow join after session has started |
| bUsesPresence | bool | Populate presence with session info |
| bAllowInvites | bool | Allow platform friend invites |
| bUsesStats | bool | Track stats for this session |
| bShouldAdvertise | bool | Advertise in matchmaking search |
| MapName | FName | Map to load on session start |
| CustomSettings | TMap<FName, FString> | Arbitrary key-value pairs for search filters |
Full API
| Function | Description |
|---|---|
| CreateSession(LocalPlayerIndex, SessionName, Settings, Delegate) | Creates and advertises a new session |
| FindSessions(LocalPlayerIndex, MaxResults, bIsLAN, Delegate) | Searches for sessions matching optional custom filters |
| JoinSession(LocalPlayerIndex, SessionName, SearchResult, Delegate) | Joins a session from a FCrimsonSessionSearchResult |
| DestroySession(SessionName, Delegate) | Destroys the named session |
| StartSession(SessionName, Delegate) | Transitions session from pending to in-progress |
| EndSession(SessionName, Delegate) | Transitions session from in-progress to ended |
| UpdateSession(SessionName, Settings, Delegate) | Updates settings of an existing session |
| GetResolvedConnectString(SessionName, PortType) | Returns connection string for travel |
| GetSessionState(SessionName) | Returns ECrimsonSessionState |
| GetSessionSettings(SessionName) | Returns FCrimsonSessionSettings for the named session |
| RegisterPlayer(SessionName, PlayerId, bWasInvited, Delegate) | Registers a player in the session |
| UnregisterPlayer(SessionName, PlayerId, Delegate) | Unregisters a player from the session |
| OnSessionCreated | Delegate: session name + bool success |
| OnSessionStarted | Delegate: session name + bool success |
| OnSessionEnded | Delegate: session name + bool success |
| OnSessionDestroyed | Delegate: session name + bool success |
| OnFindSessionsComplete | Delegate: TArray<FCrimsonSessionSearchResult> + bool success |
| OnJoinSessionComplete | Delegate: session name + ECrimsonSessionState |
Host + client example
// HOSTFCrimsonSessionSettings Settings;Settings.MaxPublicConnections = 4;Settings.bShouldAdvertise = true;Settings.MapName = "Level_Arena";GetSessionService()->CreateSession(0, NAME_GameSession, Settings,FCrimsonSessionCreatedDelegate::CreateLambda([this](FName, bool bOk){if (bOk) GetSessionService()->StartSession(NAME_GameSession, {});}));// CLIENTGetSessionService()->FindSessions(0, 10, false,FCrimsonFindSessionsCompleteDelegate::CreateLambda([this](const TArray<FCrimsonSessionSearchResult>& Results, bool bOk){if (bOk && Results.Num() > 0)GetSessionService()->JoinSession(0, NAME_GameSession, Results[0], {});}));