How to include Classes from the Private Branch of the OnlineSubsystemSteam Module

I need to retrieve a list of all entries from a Steam Leaderboard. The default UE4 online subsystem does not support such a feature (it only allows to retrieve scores for a given player, but not the whole list). But the underlying Steam SDK does provide such a method. So I tried to access those underlying objects somehow:

#include "Online.h"
#include "Runtime/Online/OnlineSubsystemSteam/Public/OnlineSubsystemSteam.h"
#include "Runtime/Online/OnlineSubsystem/Public/Interfaces/OnlineLeaderboardInterface.h"

IOnlineSubsystem* ion = IOnlineSubsystem::Get(FName("Steam"));
IOnlineLeaderboardsPtr leaderboards = ion->GetLeaderboardsInterface();
// FOnlineLeaderboardsSteam* lbSteam = reinterpret_cast<FOnlineLeaderboardsSteam*>(leaderboards.Get());
FOnlineLeaderboardsSteam* lbSteam = (FOnlineLeaderboardsSteam*) leaderboards.Get();
lbSteam->FlushLeaderboards("highscores");   // this leads to an error

The last line leads to the following compile error: "use of undefined type ‘FOnlineLeaderboardsSteam’"

So I looked through the engine code base, and the class “FOnlineLeaderboardsSteam” is declared in “OnlineLeaderboardInterfaceSteam.h”. Thus I tried to include that file as well:

#include "Runtime/Online/OnlineSubsystemSteam/Private/OnlineLeaderboardInterfaceSteam.h"

But that in turn leads to a whole bunch of compile errors, I guess I should not include any classes from the private branch directly.
So this leads me to the following questions:

  1. How do I correctly access this (internal?) “FOnlineLeaderboardsSteam” class?
  2. Alternatively, how is one supposed to retrieve a list of all/multople Steam Leaderboard entries?

Thanks in advance for any hint and suggestion!

I assume you’re trying to do this in a way that works with an unmodified launcher engine version? It’s not really possible.
Even if you include the private header files (which it totally not recommended since by definition they could be changed/removed at any time), it won’t help you if the types themselves haven’t been exported, which is the case here.

Short of engine modifications, you would have to request epic to extend the public interface to include the functionality you need.

NOTE: This is a response to accessing private classes. I know nothing about the online subsystem, so it’s possible there is some other way to achieve what you want, I don’t know.

Yes, we are working with the published UE4 version, not a custom build from sources.
I won’t be able to change that anytime soon…

So I am afraid I have to ask Epic for an update then :frowning:

Did you succeed to resolve this issue somehow? I’m facing the problem.

Only practical way is taking a steamworks sdk and building your own plugin around it… If you don’t want to download and modify engine source.

Believe me or not but I actually succeed to retrieve Steam Leaderboard with OnlineSubsystem !

Only problem is :

Retrieved Usernames and Ranks are corrects but scores values are crazy:

My score on Steam is 3# 623 yet UE4 found 646

Sometimes it find good scores for others players (2# 999=999)

Sometimes not really (1# 1008=1010)

And sometimes totally not (6# 369 = 727)

Yet all user names and ranks are correctly retrieved in good order but UE4 is retrieving crazed scores I have absolutely no idea from where it come because such values don’t even exist in the Steam API.

I wonder if this might be related to VariantData where the scores are stored, maybe Steam stores the score in int64 and UE4 get in int32 and during conversions the scores are distorted?

Also the default engine blueprint function **ReadLeaderboardInteger() **is also giving me the same distorted score so that’s quite amazingly bad that even the only default blueprint function for leaderboard is broken.