Save And Session
OSSIM ensures every user has a personalized, persistent desktop experience.
The Save Model
OSSIM consolidates all user-specific data into a single, registry-based save slot using the UOSSIMSaveGame class:
- Save Slot Name:
OSSIM_UserProfile
What's Inside UOSSIMSaveGame?
UserRegistry(TMap<FString, FUserProfile>): Stores account credentials, avatar paths, and basic profile settings mapped by username.UserFileSystems(TMap<FString, FVFSFileData>): A map of binary blobs (FVFSFileData::RawData), each representing a compressed Virtual Filesystem (VFS) tree for a specific user.LastLoggedInUser(FString): Tracks which profile was active during the last session for automatic login or pre-filled login screens.
This centralized model ensures that when a user logs in, their entire files and folders are restored exactly as they left it.
Session Lifecycle
The OS transitions through several operational states defined by the EOSSessionState enumeration. This lifecycle is automatic and begins the moment the UOSOrchestratorWidget is constructed.
Booting: Initial state. The system initializes, displaying theUBootSplashWidget, and checks for theOSSIM_UserProfilesave file viaDoesProfileExist().- Profile Discovery:
- If no save exists, the system moves to
SetupNeeded. - If save exists but no user is logged in, it moves to
Locked.
- If no save exists, the system moves to
- Authentication:
SetupNeededtriggers the Onboarding flow (UOnboardingWidget) to create the first user viaInitializeNewProfile().Lockedtriggers the Login flow (ULoginWidget) for existing users viaLogin().
- Active Session: Upon successful authentication, the state moves to
LoggedIn, and theUOSOrchestratorWidgetactivates theUDesktopRootWidgetshell. Idle: Triggered byAFK(), allowing the PC to run without locking, typically when a player roams away from the PC interaction in a 3D environment.
Virtual Filesystem (VFS) Persistence
The VFS is not global; it is per-user.
- When a user is created, a default home directory structure (
/home/username,/home/username/Documents, etc.) is generated. - Any changes made by the user (creating files in Notepad, moving folders in File Explorer) are kept in memory during the session via
UVirtualFilesystemSubsystem. - When the session ends (e.g.
Logout()) or a save is triggered (SaveProfile()), the entire VFS tree is serialized into theUserFileSystemsmap within theUOSSIMSaveGame.
Managing Data During Development
During development, you may need to reset your environment frequently.
Full System Reset
To simulate a "factory reset" and return to the Onboarding screen:
- Close the Unreal Editor (or stop the PIE session).
- Delete the
OSSIM_UserProfile.savfile from your project'sSaved/SaveGamesfolder. - Relaunch the project.
Multi-User Testing
Since OSSIM supports multiple profiles, you can test "Switch User" flows without deleting your primary test account. New users will receive their own isolated VFS snapshot.
Technical Insight
- Syncing: VFS data is automatically synced to the save slot during key events (e.g., app closing, logging out) using
UUserSessionSubsystem::SaveProfile(). - Home Pathing: Always use the
UUserSessionSubsystem::GetHomePath()helper instead of hardcoding/home/usernameto ensure compatibility with future profile name changes. - Data Wiper: You can wipe just the VFS data while retaining the user account via
UUserSessionSubsystem::ResetUserData(). - Validation: Use the
UOSSIMValidatorclass.UOSSIMValidatorprovides a comprehensive set of validation and edge-case checking utilities for all OSSIM system functionality.
