Multiplayer: auto join a new room if one is full

0 favourites
  • 3 posts
From the Asset Store
Create your game with this complete pack of images and animations!
  • Hello there,

    Ashley

    I don't know what is the correct way to solve the following problem:

    • A multiplayer game, where 2 players battle against each other taking turns (like in FF) = room peer limit 2
    • 3rd (and so forth) player joins the room, but it's already full
    • a new room is created and the player waits for a next opponent to join
    • next opponent joins the newly created room
    • and so on

    Here how I solved the problem:

    • Room_Name is a global variable (not constant) which holds a number 1 on default
    • The first and the second player joins the room 1
    • Third player tries to join the room 1, but it's full (onErrorMessage "room is full")
    • Third player iterates the variable Room_Name+1 and joins the newly created room
    • Fourth player does the same

    So far it works, but I don't know if it's healthy for a signalling server. May be there's a better way to do it? And what will happen, if like 100 players use this auto join logic?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • This will get slower and slower as more players join the game. Imagine having 1000 active games: a newly joining player must try to join 1000 rooms before they find a free one! This would probably take several seconds and waste time on the signalling server.

    I'll add an 'Auto join room' feature at some point, which will allow the signalling server to quickly identify free rooms and send you to the right one straight away.

  • Cool!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)