Systems/ Save System
Luna's save system framework provides UI components that work with any save implementation through a clean abstraction layer. Your UI remains unchanged whether you use JSON files, binary data, cloud storage, or encrypted saves.
Key Benefits: UI-agnostic design, pluggable save implementations, fast metadata loading, and seamless integration with Luna's UI components.
Core Concepts
UI Components
Luna provides pre-built UI components like MainMenuView and GameSaveView that handle save/load operations automatically.
GameSaveManager<TData,TMeta>
Abstract interface that connects your save implementation to Luna's UI. You provide the concrete implementation.
Save Data Types
Your game defines the save data structure (TSaveData) and metadata (TSaveMetadata) that the UI will work with.
The beauty of Luna's save system is that your UI code never changes. Whether you implement JSON files, binary data, cloud storage, or encrypted saves, the UI components work identically through the manager interface.
Quick Start
1. Define Your Save Data
Create your save data class that implements IGameSaveData:
2. Create Metadata Class
Define lightweight metadata for UI display:
3. Implement Save Manager
Inherit from GameSaveManager<TSaveData, TSaveMetadata> and implement the required methods:
4. Connect to Luna UI
Wire your manager into Luna UI components by overriding the provider method:
Once connected, UI buttons (Continue, Load, New Game, Delete) automatically work through your manager. No additional UI code needed!
Available UI Components
MainMenuView<TSaveData, TSaveMetadata>
Provides Continue, New Game, and Load Game buttons. Automatically enables Continue when a recent save exists.
GameSaveView<TSaveData, TSaveMetadata>
Displays save slots with metadata previews, handles save/load/delete operations.
For detailed UI implementation examples, see: Main Menu and Save & Load views. Also available is the Autosave Notification utility UI.
Implementation Examples
Your save manager can implement any storage format. For a complete working example with Newtonsoft JSON, see:
Refer to Newtonsoft JSON Sample for a complete working implementation with serializer initialization, converters, and file handling.