Yureka LogoDocs

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.

  1. Booting: Initial state. The system initializes, displaying the UBootSplashWidget, and checks for the OSSIM_UserProfile save file via DoesProfileExist().
  2. Profile Discovery:
    • If no save exists, the system moves to SetupNeeded.
    • If save exists but no user is logged in, it moves to Locked.
  3. Authentication:
    • SetupNeeded triggers the Onboarding flow (UOnboardingWidget) to create the first user via InitializeNewProfile().
    • Locked triggers the Login flow (ULoginWidget) for existing users via Login().
  4. Active Session: Upon successful authentication, the state moves to LoggedIn, and the UOSOrchestratorWidget activates the UDesktopRootWidget shell.
  5. Idle: Triggered by AFK(), 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 the UserFileSystems map within the UOSSIMSaveGame.

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:

  1. Close the Unreal Editor (or stop the PIE session).
  2. Delete the OSSIM_UserProfile.sav file from your project's Saved/SaveGames folder.
  3. 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/username to 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 UOSSIMValidator class. UOSSIMValidator provides a comprehensive set of validation and edge-case checking utilities for all OSSIM system functionality.