BeamMP-Server icon indicating copy to clipboard operation
BeamMP-Server copied to clipboard

[Feature Request] Player Join Queue

Open lionkor opened this issue 3 years ago • 10 comments

Problem and first solution consideration

When joining a full server, the player gets rejected and has to refresh the server list constantly, if they want to get in. The alternative I propose is a queue, which a player joins as soon as they try to enter a full server.

Implementation Summary

When joining a full server, the server puts the player with all their data (sockets, name, id, etc.) into a queue. On onPlayerDisconnect, the queue is checked and, if not empty, the first player in the queue gets joined into the server like usual.

When the queue gets smaller (thus advancing everyone still in queue), each player gets notified via a reliable message that their position in the queue changed from X to Y.

While the player is waiting in queue, the client-side shows a dialog, allowing the player to see which place in the queue they are. An option exists for the player to cancel the queuing. Queuing is the default behavior.

When the server closes, the people in the queue automatically get kicked back to the server list. They get a normal disconnect packet, or something else, depending on what is specified.

Supported Activities

A1: Player joins a full server, gets put into a queue, gets an ID A2: Player advances in a queue A3: Player cancels the queuing A4: Server closes during queuing, disconnecting all players A5: Server API triggers moving a player in the queue (to the start, position X etc.)

API Events

  • onPlayerEnqueue triggered on A1
  • onPlayerQueueCancel triggered on A3
  • onPlayerMoved triggered on A2, A5

API Functions

Lots of TODO here

  • MP.MovePlayerInQueue(player, newIndex)
  • MP.GetQueueSize()
  • MP.GetQueue()
  • ...

lionkor avatar Jan 20 '22 19:01 lionkor

This sounds perfect. Are there plans to implement this some time?

Luc45 avatar Oct 14 '22 03:10 Luc45

From my side, yes, anytime, but @20dka, @Starystars67, @Anonymous-275 need to also do things for it, so it would be a coordinated effort.

lionkor avatar Oct 14 '22 09:10 lionkor

Hey @lionkor I wonder if this maybe could be adjusted into a server-side mod written in lua, So what would happen is the player cap is set to something higher and then players who join past a configured value in the mod config would be set as spectators and when they try to spawn a vehicle the script cancels the spawn event before sending to other clients.

Just an idea.

Starystars67 avatar Oct 18 '22 15:10 Starystars67

Yeah, we could do that - but it should really be a core feature IMO

lionkor avatar Oct 18 '22 15:10 lionkor

Yeah, we could do that - but it should really be a core feature IMO

Fair enough, was just an idea and a possible option to reduce work but if you are happy for it then I am too :)

Starystars67 avatar Oct 18 '22 15:10 Starystars67

Hey @lionkor I wonder if this maybe could be adjusted into a server-side mod written in lua, So what would happen is the player cap is set to something higher and then players who join past a configured value in the mod config would be set as spectators and when they try to spawn a vehicle the script cancels the spawn event before sending to other clients.

Just an idea.

This has been a feature of Cobalt Essentials for a very very long time

20dka avatar Oct 18 '22 16:10 20dka

Yes, and it's also completely different from the point of the issue, please let's keep it ontopic from now on

lionkor avatar Oct 18 '22 18:10 lionkor

@Anonymous-275 I believe this is something that needs to be handled by the Launcher and then Joining messages can be provided to the game the same way progress for mod download is done.

Assuming the work for this was done in the server side already then this can be ready to be moved on and closed off?

Starystars67 avatar May 23 '23 18:05 Starystars67

No work was done server-side, since a protocol was not agreed upon iirc

lionkor avatar May 23 '23 20:05 lionkor

Okay, Lets see if we can document something here and go from there?

Starystars67 avatar May 24 '23 07:05 Starystars67