Repository navigation
Online Services
Unified online platform integration with pluggable backends for authentication, matchmaking, leaderboards, achievements, cloud saves, and friends/presence.
Source: SparkEngine/Source/Engine/OnlineServices/OnlineServices.h
The Online Services system provides a single abstract interface (IOnlinePlatform) that encapsulates all platform-specific online functionality. Games code against this interface and never reference Steam, Epic, or console APIs directly. At runtime, the OnlineServiceManager singleton holds one active platform implementation.
The default platform is NullOnlinePlatform, which is fully functional offline -- it stores leaderboards in memory, achievements as a set, and cloud saves to local storage. This means single-player games work out of the box without any SDK dependencies, and developers can test online flows without network connectivity.
Adding a new platform requires implementing the IOnlinePlatform interface and passing it to OnlineServiceManager::SetPlatform(). Stub classes for Steam, Epic, and Console are included with detailed integration guides in their documentation comments.
OnlineServiceManager (singleton)
+-- IOnlinePlatform* (active platform pointer)
|-- NullOnlinePlatform (default -- fully functional offline)
|-- SteamPlatform (stub -- requires Steamworks SDK)
|-- EpicPlatform (stub -- requires EOS SDK)
+-- ConsolePlatform (stub -- requires NDA + dev kits)
| Class | Description |
|---|---|
IOnlinePlatform |
Abstract interface defining all online service methods |
NullOnlinePlatform |
Fully functional offline implementation (default) |
SteamPlatform |
Stub for Steamworks SDK integration |
EpicPlatform |
Stub for Epic Online Services (EOS) SDK integration |
ConsolePlatform |
Stub for PlayStation/Xbox/Switch (NDA-protected SDKs) |
OnlineServiceManager |
Singleton that owns and routes to the active platform |
| Struct | Description |
|---|---|
OnlinePlayerInfo |
Player ID, display name, online status |
SessionInfo |
Multiplayer session metadata (host, map, mode, player count) |
LeaderboardEntry |
Player score with rank |
AchievementInfo |
Achievement ID, progress, unlock state |
CloudSaveInfo |
Save slot name, size, timestamp |
FriendInfo |
Friend ID, display name, online status, presence text |
// Initialize with default offline platform
auto& online = Spark::OnlineServices::OnlineServiceManager::GetInstance();
online.Initialize();
// Use the platform interface
auto* platform = online.GetPlatform();
platform->Login("player1", "");
platform->SubmitScore("HighScores", 9999);
platform->UnlockAchievement("first_kill");
platform->SaveToCloud("save1", saveData);
// Switch to a custom platform at runtime
online.SetPlatform(std::make_unique<MySteamPlatform>());class MySteamPlatform : public Spark::OnlineServices::IOnlinePlatform
{
public:
std::string GetPlatformName() const override { return "Steam"; }
bool Login(const std::string& username, const std::string& token) override
{
// Initialize Steamworks SDK, authenticate user
return SteamAPI_Init();
}
// ... implement all IOnlinePlatform methods
};| Method | Description |
|---|---|
GetInstance() |
Get the singleton instance |
Initialize() |
Initialize with NullOnlinePlatform |
Shutdown() |
Log out and release all platforms |
Update(float dt) |
Per-frame update for async callbacks |
GetPlatform() |
Get the active IOnlinePlatform*
|
SetPlatform(unique_ptr) |
Switch to a custom platform (takes ownership) |
ResetToNullPlatform() |
Revert to the offline platform |
| Method | Description |
|---|---|
Login() / Logout() |
Authentication |
FindSessions() / CreateSession() / JoinSession() |
Matchmaking |
SubmitScore() / QueryScores() |
Leaderboards |
UnlockAchievement() / SetAchievementProgress() |
Achievements |
SaveToCloud() / LoadFromCloud() |
Cloud saves |
GetFriendsList() / SetPresence() / InviteToSession() |
Social features |
| Setting | Description |
|---|---|
-DENABLE_STEAM=ON |
Enable Steam SDK (requires ThirdParty/Steamworks/) |
-DENABLE_EOS=ON |
Enable Epic Online Services SDK (requires ThirdParty/EOS/) |
- Networking -- UDP transport for gameplay networking
- Save System -- Local save/load persistence
- Gameplay Systems -- Inventory, quests, achievements
Published from 2b03dc797148. Edit the canonical source in wiki/.
- Documentation
- Docs route
- Wiki index
- Guides
- Tutorials
- Samples
- Examples
- API Reference
- API route
- Reference
- Build Guide
- Dependencies
- FAQ
- Changelog
- Roadmap
- Contributing
- Code of Conduct
- Home
- FAQ
- Getting Started
- Quick-Start Tutorial
- Making Your First Game
- Making Your First Multiplayer Game
- Artist Workflow Guide
- Editor Walkthrough
- Migration Guide
- How SparkEngine Works
- Architecture Overview
- Engine Architecture Flowchart
- Creating a Game Module
- Game Modules (catalog)
- Entity Component System
- Rendering and Graphics
- Physics
- Cloth Simulation
- Audio
- Input System
- Camera System
- Scripting with AngelScript
- Visual Scripting
- AI and Navigation
- Animation
- 2D Systems
- Networking
- Dedicated Server
- Multiplayer Quick Start
- Area Server Architecture
- Scene Management
- Large World Support
- Collaborative Editing
- Coroutine System
- Event System
- Event Response System
- Job System
- UI System
- UI Layout Extensions
- Localization
- Dialogue System
- Destruction System
- Replay System
- Achievement System
- Loading System
- Mod System
- Content Delivery
- Tween System
- Memory Integrity
- Gameplay Systems
- Terrain and Procedural Generation
- Save System
- Persistence System
- Day Night Cycle and Weather
- Cinematic Sequencer
- Runtime Prefabs
- SparkEditor
- Editor Tutorials
- SparkConsole
- SparkDaemon
- Shader Pipeline
- Asset Pipeline
- Asset Validation
- Asset Migration
- Game Packaging
- Online Services
- DataTable System
- Loot and Crafting System
- CSG System
- Font System
- Timer Manager
- Movie Render Pipeline
- HLOD and World Partition
- Remote Debug System
- Selection Manager
- Asset Dependency Graph
- Editor Automation
- File Watcher
- Project Templates
- System Requirements
- VR Support
- Mobile Platform
- Accessibility
- Platform Input
- Platform Certification
- Cross-Compilation: Wine Testing
- RHI Abstraction Layer
- D3D11 Backend
- D3D12 Backend
- Vulkan Backend
- OpenGL Backend
- Metal Backend
- DXR Raytracing
- Hybrid Ray Tracing
- Upscaling (DLSS/FSR)
- Render Graph
- Shader Graph
- GPU Particles
- GPU-Driven Rendering
- Volumetric Fog
- Volumetric Clouds
- Global Illumination
- Virtual Texturing
- Water Rendering
- Clustered Lighting
- Material System
- Post-Processing
- Shadow System
- Particle System
- Decal System
- Sky and Atmosphere
- Foliage System
- Mesh Shaders
- Neural Rendering
- Configuration Reference
- Performance Tips
- Benchmark Framework
- Threading Model
- Fuzz Policy and Parser Security
- Memory Safety
- Memory Management Patterns
- Build System and CMake Modules
- Profiler and Debugging
- Performance Profiling Guide
- Telemetry System
- Crash Reporting
- Golden Image Testing
- Utilities
- Testing
- Fuzz Policy and Parser Security
- Codebase Statistics
- Codebase Health
- Error Handling Patterns
- Hot Reload Overview
- Troubleshooting
- Contributing
- Workflow Patterns
- Build Optimizations
- CI Reproducible Builds
- GitHub API and PR Checks
- Git Rebase Conflicts
- Clang-Format
- Code Quality Violations
- AI Bloat Pattern
- MinGW + Wine Cross-Compilation
- Live Editor Testing
- Engine & Renderer Landscape
- DuetOS Portability Catalog
- Five-Engine Analysis
- Eleven-Engine Analysis
- ThorVG / Unity Graphics Analysis
- Advanced Techniques Catalog
- Third-Party Library Evaluation
- Engine Viability Evaluation
- Engine Feature Recommendations
- Project Recommendations
- Mac Compatibility Analysis
- Codebase Observations
- Codebase Bloat Audit
- Test Suite Audit
- Documentation Coverage Audit
- ThirdParty Dependencies Audit
- Load Test Baseline
- Gameplay Systems Status
- SparkGame Module Status
- Stub and Abandoned Features
- Memory Integrity System
- Memory Safety Evaluation
- Hardware Acceleration Systems
- Jolt Physics Integration
- GPU/CPU Separation Plan
- Daemon Services Architecture
- Reflection & Polymorphism Refactoring Plan
- SparkBuild In-Tree
- Wine No-JobSystem Breakthrough
- Wine Role and Fallback Tiers