How to restrict rooms by an arbitrary value instead of player count?

Hello, I am working on a game where you can control more than one character, yet games need to have a max number of characters. But it seems like room only can control the max number of players. How can I instead limit the room to only accept players until a resource limit (in this case, characters) is met?

For example... a player who wants to enter a room with two characters should be denied entry to one with one character slot left but accepted to one with at least two character slots left, regardless of how many players are in the room.

Any advice on how to go about this?

Comments

  • hi, @MrVentures

    what you want is not possible to achieve without plugin. You have to write your plugin and handle all this logic in it

    best,
    ilya
  • JohnTube
    JohnTube mod
    edited August 11
    Hi @MrVentures,

    If you can't use plugins, there are some workarounds that are not perfect (clients can abuse):

    1. use matchmaking filter to join rooms you can join based on the character number.
    2. when creating rooms, set MaxPlayers = expected number of players * expected number of characters per player. Example: if you want a game of 4 players and each player can have 2 characters: set MaxPlayers to 8.
    3. when joining rooms, add as many ExpectedUsers as number of allowed characters per player: example if a player has a UserId: "X" and number of characters per player is 3: you can set ExpectedUsers: "X", "X1" "X2". This way you block spots (that will always remain empty).
    3. when the unexpected happens: a client joins a room with a wrong number of characters per player: auto leave the room (remove any Expected Users added on join).
    4. close and hide the room once the number of real players is reached.
  • Thank you both!