Well, to be clear on this problem there is a couple of ways to use SteamStats in your own game. In fact, UE4 does have most of the leg work done for you, you just don’t know it.
First off, the acheivements, leaderboards, & stats system is a shared steam system… SteamUserStats()
The problem is that UE4 implements parts of the system mainly for achievements or their leaderboard interface, where actually we could just lump it all into the same interface, but they chose not to. The async steam tasks are written, but just the shell and its hardcoded for use only for leaderboards.
Here are the functions you need to use:
//Async task to retrieve all stats for a single user from the Steam backend
FOnlineAsyncTaskSteamRequestUserStats
//Async task to update a single user's stats on the Steam backend
FOnlineAsyncTaskSteamUpdateStats
//Async task to retrieve a single user's stats from Steam
FOnlineAsyncTaskSteamRetrieveStats
//Async task to store written Stats to the Steam backend, Triggers an OnStatsStored callback
FOnlineAsyncTaskSteamStoreStats
The way that you implement it is up to you. Normally you request a task, and then wait on the steam callback to send the data back to the game. However, they are not doing it that way, they send the request to steam and save the callback handle. Then on every tick, they check the SteamUtilties…
SteamUtilsPtr->IsAPICallCompleted(CallbackHandle, &bFailedCall)
to see if the request is done instead of using a delegated callback. There is nothing wrong with this way.
There are also 3 already bound steam callbacks for stats through the task manager when in turns calls the assoicated event tasks. Make sure to study the flow between the task manager and task and how the data is marshalled back to the game thread and you should be set.
/** Delegate registered with Steam to trigger when the currently logged in user receives their stats from RequestStats() */
STEAM_CALLBACK(FOnlineAsyncTaskManagerSteam, OnUserStatsReceived, UserStatsReceived_t, OnUserStatsReceivedCallback);
/** Delegate registered with Steam to trigger when the currently logged in user has their stats stored */
STEAM_CALLBACK(FOnlineAsyncTaskManagerSteam, OnUserStatsStored, UserStatsStored_t, OnUserStatsStoredCallback);
/** Delegate registered with Steam to trigger when any previously requested user's stat are unloaded by the system */
STEAM_CALLBACK(FOnlineAsyncTaskManagerSteam, OnUserStatsUnloaded, UserStatsUnloaded_t, OnUserStatsUnloadedCallback);
Hope that helps!