Skip to content

Unreal Server Create Players

This how-to creates a Player account from the Unreal Server SDK, without involving the game client. This is useful when you want all traffic to LootLocker to run from a secure server and never trust the game client. This example shows the flow for a Steam user, but LootLocker supports the same flow for a variety of platforms.

Prerequisites

  • The Unreal Server SDK installed and configured in your Unreal Server project.
  • Steam configured in the Web Console.
  • Steamworks set up in the game client (not necessary on the server).
  • An Unreal Server Project.
  • An Unreal Game Project.

Server Start Up

Once your game server has started up, it needs to connect to LootLocker so that it can make subsequent requests and make full use of LootLocker's functionality.

To get started with this, follow our documentation on how to start and maintain a Server Session.

Client Start Up

Once the client and the server have both started up, establish the client <-> server connection as you usually would. Make sure the client can replicate information to the server through methods such as replicatable actors and remote procedure calls, or whichever method you prefer.

When the connection is open, it's time to perform platform authentication. For Steam, how to get the Steam Session Ticket and Steam ID is described in our Steam How-To. For this use case, though, you shouldn't make the call to LootLocker to create a Steam session — the server will do that instead.

Then, in your game client, once the player has logged in to Steam, send a request to your server with the Steam ID of the logged-in Steam user.

Create LootLocker Player from the Server

Now, back on your server, when you receive the Steam ID from the game client, send a request to LootLocker with the Steam ID to create a Steam account for this user.

void OnClientPlayerAuthenticated(const FString& SteamID)
{
ULootLockerServerForCpp::CreatePlayer(ELootLockerServerCreatePlayerPlatforms::Steam, SteamID, FLootLockerServerCreatePlayerResponseDelegate::CreateLambda([SteamID](const FLootLockerServerCreatePlayerResponse& Response)
{
if (!Response.Success)
{
UE_LOG(LogWorkingProject, Error, TEXT("Failed to create player for SteamID %s. Error: %s"), *SteamID, *Response.ErrorData.Message);
// Handle error appropriately
return;
}
UE_LOG(LogWorkingProject, Display, TEXT("Successfully created player for SteamID %s with LootLocker Player Ulid %s"), *SteamID, *Response.Player_ulid);
}));
}

Conclusion

You've created a Steam Player from the server without involving the Game API. A LootLocker Player is needed for any continued interaction with LootLocker. Now that you have one, you can make requests on behalf of this Player by using Server Impersonation, keeping the Game API out of your game client and making your game more secure and customizable.