feat: configurable multi-user session mode#344
Open
kirre-bylund wants to merge 5 commits into
Open
Conversation
- Add ELootLockerMultiUserSessionMode UENUM (Hotseat/SingleSession/ProfileSwitching/NotSet) with full UMETA tooltips in LootLockerConfig.h - Add MultiUserSessionMode UPROPERTY in LootLocker|Multi User category with descriptive tooltip - Add MigrateSettingsIfNeeded() called from PostInitProperties(): checks GConfig for key presence; if absent (pre-migration), sets Hotseat (existing projects) or SingleSession (new installs) and persists to DefaultGame.ini via TryUpdateDefaultConfigFile/UpdateDefaultConfigFile - Add #include Misc/ConfigCacheIni.h to LootLockerConfig.cpp - Modify SavePlayerData() to apply session mode: - SingleSession: calls ClearAllSavedStates() before saving, always sets new player as default - ProfileSwitching: calls SetAllPlayersToInactiveExceptForPlayer(), sets new player as default - Hotseat (default/NotSet): preserves existing behaviour
There was a problem hiding this comment.
Pull request overview
Adds a configurable multi-user session handling mode to the LootLocker Unreal SDK so the “default player” behavior on new authentications is explicit and less surprising across sessions.
Changes:
- Introduces
ELootLockerMultiUserSessionModeand aMultiUserSessionModeconfig property onULootLockerConfig, including a one-time migration path for existing projects. - Implements settings migration logic that selects an initial mode and persists it to config.
- Updates persisted player-state saving to branch behavior based on the configured multi-user mode (wipe-on-auth, profile switching, or legacy hotseat behavior).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| LootLockerSDK/Source/LootLockerSDK/Public/LootLockerConfig.h | Adds the new UENUM + config UPROPERTY and triggers migration from PostInitProperties(). |
| LootLockerSDK/Source/LootLockerSDK/Private/LootLockerConfig.cpp | Implements MigrateSettingsIfNeeded() using ini inspection and config persistence. |
| LootLockerSDK/Source/LootLockerSDK/Private/LootLockerStateData.cpp | Adjusts SavePlayerData() behavior based on the configured multi-user session mode. |
Comment on lines
+143
to
+147
| const ELootLockerMultiUserSessionMode Mode = GetDefault<ULootLockerConfig>()->MultiUserSessionMode; | ||
|
|
||
| if (Mode == ELootLockerMultiUserSessionMode::SingleSession) | ||
| { | ||
| // Wipe all existing player state before saving the new player. |
- SingleSession: save new player first, then wipe others via ClearAllSavedStatesExceptForPlayer to prevent data loss on IO failure - MigrateSettingsIfNeeded: use GetDefaultConfigFilename() so read/write targets always match - MigrateSettingsIfNeeded: gate on-disk persistence to WITH_EDITOR contexts to avoid startup IO on read-only packaged installs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves lootlocker/index#1521
Adds a configurable
ELootLockerMultiUserSessionModeUENUM toULootLockerConfigthat controls how the SDK handles new authentications with respect to the active/default player. This addresses the common developer confusion where requests go to the "wrong player" because a previously-cached default persists across sessions.New setting: Multi User Session Mode
Three modes are available:
The setting appears in Project Settings → Plugins → LootLockerSDK → LootLocker | Multi User.
Backwards compatibility
A
NotSetsentinel value (hidden from the editor dropdown viaUMETA(Hidden)) handles the pre-migration case.PostInitProperties()callsMigrateSettingsIfNeeded()which:GConfig->GetString(...)to check whetherMultiUserSessionModehas ever been written toDefaultGame.iniHotseat; API key absent →SingleSessionTryUpdateDefaultConfigFile()/UpdateDefaultConfigFile()so subsequent loads skip the checkChanges
LootLockerSDK/Source/LootLockerSDK/Public/LootLockerConfig.hELootLockerMultiUserSessionModeUENUM with UMETA tooltips (NotSet hidden)MultiUserSessionModeUPROPERTY in"LootLocker|Multi User"categoryMigrateSettingsIfNeeded()declaration; call added toPostInitProperties()LootLockerSDK/Source/LootLockerSDK/Private/LootLockerConfig.cpp#include "Misc/ConfigCacheIni.h"addedMigrateSettingsIfNeeded()implementationLootLockerSDK/Source/LootLockerSDK/Private/LootLockerStateData.cpp#include "LootLockerConfig.h"addedSavePlayerData()branches on the configured mode:SingleSession: callsClearAllSavedStates()before savingProfileSwitching: callsSetAllPlayersToInactiveExceptForPlayer(), sets new player as defaultHotseat/NotSet: preserves the previous first-auth-is-default behaviour