Multiplayer: auto join a new room if one is full

Get help using Construct 2

Post » Thu Mar 27, 2014 11:25 am

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?
B
45
S
11
G
4
Posts: 515
Reputation: 7,389

Post » Thu Mar 27, 2014 12:03 pm

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.
Scirra Founder
B
387
S
230
G
87
Posts: 24,248
Reputation: 192,238

Post » Thu Mar 27, 2014 12:11 pm

Cool!
B
45
S
11
G
4
Posts: 515
Reputation: 7,389


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 4 guests