Server join queue using OnlineBeacons

Hello Community,

I am currently facing some difficulties using the OnlineBeacons, which are very sparsely documented.
I am in the process of building a login queue for our unreal server as the server doesnt seem to handle multiple simultaneous login attempts very well. The server rejects (without any ErrorMessage) any login attempts past the first two.

So the goal is instead of letting the users login immediatly they first get put onto a queue using the OnlineBeacons.

The flow of the system i build looks something like this:

Server: Start -> Create Beacon Host -> Create BeaconHostObject -> Wait for connections

Tick -> is another client currently logging in?

*=2]-> No -> give login permission to next client (RPC through beacon) 	*=2]-> Yes -> Do Nothing / Wait

OnClientConnected -> PutClientOnQueue

OClientDisconnected -> RemoveClientFromQueue

Client: Wants to Login -> Create BeaconClient

Has gotten Login permissions -> Open Level / Login

With the system i build the Server Crashes though with 2 Clients trying to connect at the same time. The Crash does not happen though if I add another HostBeaconObject to the BeaconHost.

Am i correctly assuming that each BeaconHostObject can only handle a single connection? And that i need to have a BeconHostObject for each client that would want to connect simulteanously?

If so, is there a limit as to how many simulteanous connections a single server can handle via the Beacons? And can i prevent/reject the connection of new Beacons/Clients if there are no BeaconHostObjects available?

I would really appreciate any insight in the OnlineBeaconSystem and hope to find some answers here.
Thanks in advance!

You only need one beacon host object. Can it handle multiple connection requests coming in at the same time? I don’t really know, never had a situation like this, but I assume it has to be able to? Seems like a trivial thing lol. Unfortunately I’m not familiar with master servers so I can’t give advice on that. Can you go into a bit more detail on how you set up your beacons? Maybe you are missing a function call.

The Beacons are setup like this:

The Beacon Client only has a Start Method wich initializes the Beacon via InitClient(url) using the URL to the server (currently im testing on lokalhost) and the port i configured in the DefaulEngine.ini.
The rest of the Beacon Client are just RPC for when the beacon is actually connected.

The Host also has a *Start() *which initializes the host via InitHost(). I add the HostObjects via a Blueprint exposed Method AddHost() which just calls *RegisterHost() *with the passed in Host Object.

On the HostObject i override SpawnBeaconActor but for now just call Super::SpawnBeaconActor in it with my custom Beacon Client. *OnClientConnected is also override but i also call the Super function with some additional stuff to let the ClientBeacon know that its now connected and can start sending RPCs. In the constructor of the HostObject i set the ClientBeaconActorClass *and BeaconTypeName to match my BeaconClient.

I think thats mostly it for the connection stuff. The rest are just some Multicast Delegates for me to subscribe on in Blueprint.

I don’t see any issues with this setup. Though I assume you are calling PauseBeaconRequests(false); after registering a host?

I actually dont no. Do i need to do that? I thought with settings the Host to EBeaconState::AllowRequests i set it up for connection.

It does stuff to the net driver as well.



/**
* Set Beacon state
*
* @bPause should the beacon stop accepting requests
*/
void PauseBeaconRequests(bool bPause)
{
     if (bPause)
     {
          UE_LOG(LogBeacon, Verbose, TEXT("All Beacon Requests Paused."));
          NetDriver->SetWorld(nullptr);
          NetDriver->Notify = this;
          BeaconState = EBeaconState:DenyRequests;
     }
     else
     {
          UE_LOG(LogBeacon, Verbose, TEXT("All Beacon Requests Resumed."));
          NetDriver->SetWorld(GetWorld());
          NetDriver->Notify = this;
          BeaconState = EBeaconState::AllowRequests;
     }
}