*MULTIPLAYER* How do I make sure I join first?

Get help using Construct 2

Post » Sat Sep 12, 2015 1:37 pm

Hi,

I've heard it many times that to run C2 multiplayer game on server with multiple browser tabs open you have to make sure you join first as host. But if there's already a host in a room, next player I join with will join as peer to that room. How do I open multiple rooms as host? Do I have to use some special alias, or how do you do it?
B
4
S
1
Posts: 5
Reputation: 265

Post » Sat Sep 12, 2015 3:04 pm

First problem, tell the host to give up host position, and be sure your the first to connect after that. You could do that with commands to all other peers like, leave and wait x seconds before reconnecting, where you connect first.

To use multiple tabs of the same browser instance, use incognito modus in Chrome, you can open these with CTRL + Shift + N
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Sat Sep 12, 2015 3:16 pm

Thanks for the reply, but my problem is that when I create the FIRST room in an instance as host, not somebody else, and after that I want to make another room in the same instance, I cannot join as host, because it will join the FIRST room I created. I was thinking about a special alias for host, and check if host alias doesn't start with that --> disconnect host, because that's not me. Do I really need an external database to keep track of rooms? Come on C2 :D
B
4
S
1
Posts: 5
Reputation: 265

Post » Sat Sep 12, 2015 7:41 pm

It sounds like you want an host to be able to host multiple rooms in the same application/browser instance. That will not work as far as I know.
The construct 2 host only hosts 1 room/session per running application.
You can however, simply open a second window in incognito modus, as many as you like, and have them host rooms.

The incognito modus allows more logins to the socket without confusing the signalling server who its talking too.


You can have the peers/hosts message each other, in those messages they can tell who is host in which/room/instance etc you have and react to that accordingly.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Sun Sep 13, 2015 6:28 am

lennaert wrote:It sounds like you want an host to be able to host multiple rooms in the same application/browser instance. That will not work as far as I know.
The construct 2 host only hosts 1 room/session per running application.
You can however, simply open a second window in incognito modus, as many as you like, and have them host rooms.

The incognito modus allows more logins to the socket without confusing the signalling server who its talking too.


You can have the peers/hosts message each other, in those messages they can tell who is host in which/room/instance etc you have and react to that accordingly.


So, I created a room in Chrome in incognito. It joined as host. Then, I opened a second window, also in incognito. Tried to host a second room, but it joined the first one as peer. Do I need to do something else as well?
B
4
S
1
Posts: 5
Reputation: 265

Post » Sun Sep 13, 2015 9:49 am

If you tried to host a room with the same name, then yes it will join the first room with he same name.

Perhaps post a capx.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Sun Sep 13, 2015 10:47 am

lennaert wrote:If you tried to host a room with the same name, then yes it will join the first room with he same name.

Perhaps post a capx.


Capx doesn't matter, even if I try it with the built-in "Multiplayer game" example, it's still not working. My project is based on that, structured very similarly, esp. the signalling part.

What I was thinking, was a special alias for the host, and room name would be the host name. If the host alias doesn't start with that value ---> kick peer, that's not me. The string value wouldn't be stored in a C2 variable, because it could be seen in the exported Javascript. I would get it from a database, plus keep track of the rooms.

I just though maybe there's a simpler solution?
B
4
S
1
Posts: 5
Reputation: 265


Return to How do I....?

Who is online

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