Passing client-side username to server on join

For our game, the client first opens a map locally, and executes a REST call to our company’s servers to log in. It obtains a user id in this manner. It then joins a server by using the console command open ip.ad.dr.ess.

We want our server to be able to see these user ids. Our server can currently pull the player names, but this just ends up being the machine name for PC, or another random number for Gear VR.

How can I keep the user id obtained locally when joining a map on the server? I’ve tried creating a save game, but this just tries to load a save from the server rather than from the client. Our player state also gets re-created when joining the server, so I’m not able to keep variables in the player state.

Best way to do what you trying to os is to create your own OnlineSubsystem for you online service, it a common interface for online social services like Xbox live, PSN, Steamworks etc., there no documentation for it so you would need to learn form looking at source code of existing subsystem

https://github.com/EpicGames/UnrealEngine/tree/dff3c48be101bb9f84633a733ef79c91c38d9542/Engine/Source/Runtime/Online

OnlineSubsystemNull is a base implementation and it’c consider a good base for your own implementation

Alternatively you can make replicabale property with proof of login (remember about security!) in PlayerController or PlayerState classes so it will replicate to server and it can recognize user. But i really recommend OnlineSubsystem implementation if you got C++ programmer in disposal.

Ok, thanks. No C++ programmer yet but when we get one, this looks like it may be a priority.

We were also thinking of potentially using the OnlineSubsystemOculus for our GearVR app down the line, but we also want to retain our own login. As far as you know, is there a way to use two online subsytems?

As i remember right yes you can use 2 or more systems, but you need to activate 2nd via C++, blueprint control of onliesubsystems is quite limited

add variables to game instance, and read them after delay