Someone have idea how to create queue plugin that will support redisbungee and multiple lobbies?

Discussion in 'BungeeCord Plugin Development' started by Msql, Apr 1, 2020.

  1. Someone have idea how to create queue plugin that will support redisbungee and multiple lobbies?
    I was thinking how to do it but without any good effect. My idea was to create task that will execute every ~ time and it will check if server is full. If it is not then it will try to connect player. But how to sync it with multiple bungeecords? Someone have idea for this type of project and want to share?
    Thanks for any help!
     
    #1 Msql, Apr 1, 2020
    Last edited: Apr 2, 2020
  2. Can you give us a little more context on what this is supposed to do? Do you want the players to wait in a seperate waiting lobby like hypixel odes or do you have another idea?
    And do the bungeecord proxies connect to the same servers or has every bungee its own servers?
     
  3. Every bungeecord will have same configuration - same servers. I just want to create plugin that will create global queue that is over all bungees and lobbies.
     
  4. You could have some sort of central storage (database) where you add a row for each queued player. Then every x time you check the server availability, grab the first row, check if the player is on this bungee instance and move them. Using the event api wait for a successful connection and then remove the row.

    MySQL would probably be the easiest because its row based. But there might be a better/faster DB out there. You already have redis running so it would be nice to reuse that existing storage solution. However, redis might be impractical because its a key/value storage solution.

    The most difficult thing to prevent a race condition. Thats why a bungee instance should only move the player if its on that instance. Also make sure to remove the row after a successful transfer. That way you prevent another bungee instance from sending the next player if the current player is still connecting meaning the player slot still looks empty to the other bungees.

    The last thing to watch out for is flooding your DB. Make sure to remove records when a player disconnects. It might also be smart to add a bungeeName column and flush all records that belong to the bungee instance on startup. That way you cleanup when starting your bungee but you won't clear your current queue when starting an extra bungee
     
    #4 SmokingIsBadMkay, Apr 5, 2020
    Last edited: Apr 5, 2020
  5. Yes, I had the same idea but how do you manage to keep the player on the proxy for, lets say 2 minutes, that he needs to wait? The client will timeout the connection after x seconds and then there is no player to connect to a server.
     
    • Like Like x 1
  6. Oh whoopsie, my bad! I was thinking about people being in a minigame queue that they can join from within your lobby.

    I don't think you can and should have a lobby queue. Not only is is pretty much impossible due to the timeout but as a player I wouldn't want to wait to join, I would just join another server. Your network should have the capacity to allow everyone in the lobby. From there you can have small waiting times before you're able to join a game.

    The only way to do this reliably would be to have another server where waiting players are connected to. But unless you have a specific reason to keep them from joining your lobbies you should just connect them to a lobby.
     
  7. You can make a separate server which is dedicated to being a player queue. It can be a void world and show your position in the queue with titles or something. Just an idea which might help you
     
  8. Thanks for you input. I have it just using bungee channels to get server / queue information.
     
  9. That's the best way I can think of doing it
     
  10. Having a Redis server would be better.