Multiplayer & Dedicated Server

Discussion and feedback on Construct 2

Post » Fri Feb 05, 2016 10:22 am

Hi,

I haven't found a good and direct answer to the following question...

How does one associate a C2 multiplayer game with a dedicated server? I understand its been done by using the browser object and opening a tab...but thats all information i could dig up, how is this done and how does the events differ from the peer to peer. I have managed to develop a p2p and even successfully ran it mobile.

Using a server to play host is essential since a peer to peer game play could simply end when the player who host decides to...leave.

The top down multiplayer running on the scirra server is spot on my requirement, would a simple example CAPX be a possibility @Ashley ?

Thanks
B
19
S
7
G
5
Posts: 18
Reputation: 3,937

Post » Fri Feb 05, 2016 10:26 am

* moved. This section is more appropriate for a discussion on how C2 multiplayer works.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
129
S
29
G
77
Posts: 5,192
Reputation: 54,289

Post » Fri Feb 05, 2016 10:49 am

zenox98 wrote:* moved. This section is more appropriate for a discussion on how C2 multiplayer works.


Thanks Zenox
B
19
S
7
G
5
Posts: 18
Reputation: 3,937

Post » Fri Feb 05, 2016 12:18 pm

I'm not sure if I understand your question.

To put host game instance on the server, I believe you can simply export it to NWjs and run it on the server.
Image
B
27
S
16
G
60
Posts: 888
Reputation: 34,390

Post » Fri Feb 05, 2016 2:34 pm

BackendFreak wrote:I'm not sure if I understand your question.

To put host game instance on the server, I believe you can simply export it to NWjs and run it on the server.


Hi thanks for the reply

I simply want to know how to achieve an online multiplayer where the server plays the permanent role as host regardless of any peer disconnecting, the room will continue to be active for the remaining participants even if the first joined has left.

Currently with peer 2 peer the first player becomes host and when disconnected all other players are forced to leave...so even tho i understand how to build a game around p2p, i can't wrap my head around how a server is used through the events.

My knowledge so far is that the browser object are being used to open a new tab on the server and then so the multiplayer object uses that tab to join before any player and becomes host to create a solid foundation for the peers.

But how... :?:
B
19
S
7
G
5
Posts: 18
Reputation: 3,937

Post » Fri Feb 05, 2016 3:11 pm

Host is the first player who connects to the signaling server room/game. So yes - you just have to put it on some server, run it and keep it alive (simply not killing the process). That's how you get a stable game no matter how many players connect or disconnect, because the first one (host) is all the time online.

You said that you know how it works and that you've managed to do a Multiplayer game so I am confused about the part where you say "how a server is used through the events". What exactly is unclear for you here?

Regarding this "My knowledge so far is that the browser object are being used to open a new tab on the server and then so the multiplayer object uses that tab to join". I don't think that browser object has anything to do here. Multiplayer object and signaling server take care about communication via WebRTC.
Image
B
27
S
16
G
60
Posts: 888
Reputation: 34,390

Post » Fri Feb 05, 2016 5:22 pm

BackendFreak wrote:Host is the first player who connects to the signaling server room/game. So yes - you just have to put it on some server, run it and keep it alive (simply not killing the process). That's how you get a stable game no matter how many players connect or disconnect, because the first one (host) is all the time online.

You said that you know how it works and that you've managed to do a Multiplayer game so I am confused about the part where you say "how a server is used through the events". What exactly is unclear for you here?

Regarding this "My knowledge so far is that the browser object are being used to open a new tab on the server and then so the multiplayer object uses that tab to join". I don't think that browser object has anything to do here. Multiplayer object and signaling server take care about communication via WebRTC.


Ah now i understand what you mean, yes according to other posts i probably miss understood when preferred to opening a tab on the browser...i thought it should be done through the events but as you state it makes a lot more sense, thank you for correcting.

Alright so its pretty straightforward and similar to p2p.

Regarding the method of running a active game on the server, how is that accomplished? If i were to close my browser tabs and or disconnect from the uploaded game...wouldn't that have the same result as p2p because i'm unaware of any way to keep a HTML5 game running on its own.

Thanks for the help :-)
B
19
S
7
G
5
Posts: 18
Reputation: 3,937

Post » Fri Feb 05, 2016 6:22 pm

For host I suggest to export the game to NWjs (desktop), and run it directly from the OS on the server. That will give you much better performance rather than opening a browser on the server and run an HTML5 directly from the browser.

As long as the host process will be active on the server you will have an online open world where players (peers) can connect to. You can even have a lot of server instances in order to handle more players as it is usually done with high traffic mmorpgs etc.

Now regarding peers (players), they can join or disconnect from the server. It has no impact on server/game stability (unless you code it to be). When player closes a browser tab then it simply disconnects from the server, and such an event should be handled by you in your host events (for instance you might want to inform the rest of players that the particular one lost connection/quit).
Image
B
27
S
16
G
60
Posts: 888
Reputation: 34,390

Post » Fri Feb 05, 2016 6:38 pm

:-D Cool, i think i'm wrapping my head around it now. Thank you greatly, this is the type of information i was looking for, appreciate.

I will give it some testing :-)

Kind regards.
B
19
S
7
G
5
Posts: 18
Reputation: 3,937


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 7 guests