Online Subsystem Support for Hiro #

Hiro works with Unreal Engine’s Online Subsystem, providing a familiar interface for Unreal developers experienced in multiplayer game development. This allows you to use Hiro as your backend service along with other online providers like Epic Online Services (EOS), Steam, or PlayStation Network.

What is Unreal’s Online Subsystem? #

Unreal Engine’s Online Subsystem is a modular framework that abstracts platform-specific online services through unified interfaces. It enables developers to write platform-agnostic code that works across multiple gaming platforms and services.

The Online Subsystem provides a consistent API for common multiplayer features like user authentication, achievements, leaderboards, and social interaction. Instead of learning different APIs for Hiro, Steam, EOS, or other backends, you write your code once using Unreal’s standardized interfaces.

Using Hiro with Online Subsystems #

To use Hiro with Unreal’s Online Subsystem:

  1. Install and enable the Hiro Unreal Plugin: Install and enable the Hiro plugin (version 1.24.0 or greater) in your Unreal Engine project. For more instructions, read our Installation guide.

  2. Initialize Hiro: The most common and recommended place to initialize Hiro is in your Game Instance’s initialization function. This ensures Hiro is set up before any other online subsystem calls are made. For example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
void UMyGameInstance::Init()
{
    Super::Init();

    // Initialize Hiro
    IOnlineSubsystem* OSS = Online::GetSubsystem(nullptr, HIRO_SUBSYSTEM);
    FOnlineSubsystemHiro* HOSS = static_cast<FOnlineSubsystemHiro*>(OSS);

    if (HOSS)
    {
        FString ServerKey = TEXT("your_server_key_here");
        FString Host = TEXT("your_host_here");
        bool hiroInitResult = HOSS->InitHiro(
            ServerKey,  // Your server key
            Host,       // Server host address
            7350,       // Port (default Nakama port)
            false,      // Use SSL (true for production)
            true        // Enable debug logging
        );
    }
}
  1. Access Standard Interfaces: Use Online Subsystem interfaces like IOnlineIdentity, IOnlineAchievements, and others through the standard Unreal APIs.

Supported Online Subsystem Interfaces #

Hiro currently supports the following standard Online Subsystem interfaces:

  • Identity Interface (IOnlineIdentity): User authentication and session management
  • Achievements Interface (IOnlineAchievements): Player achievement tracking and unlocking
  • Leaderboards Interface (IOnlineLeaderboards): Currently only works with reading and writing to a leaderboard tied to the user.

More support for additional Online Subsystems will come in the future.

Accessing Extended Hiro Features #

While the Online Subsystem provides standardized functionality, you can access Hiro’s complete feature set by retrieving the underlying Nakama and Hiro clients:

1
2
3
4
5
6
7
// Get the Hiro subsystem instance
IOnlineSubsystem* OSS = Online::GetSubsystem(nullptr, HIRO_SUBSYSTEM);
FOnlineSubsystemHiro* HiroOSS = static_cast<FOnlineSubsystemHiro*>(OSS);

// Access the full Nakama and Hiro clients for extended functionality
FOnlineNakamaClientPtr NakamaClient = HiroOSS->GetNakamaClient();
FOnlineHiroClientPtr HiroClient = HiroOSS->GetHiroClient();

This hybrid approach allows you to use standard Online Subsystem interfaces for common operations while accessing Hiro’s specialized features when needed.

Additional Information #