Is there any way of hosting multiplayer not from a peer?

Get help using Construct 2

Post » Wed Jun 28, 2017 4:18 pm

Some people who join the game have a really bad connection. This makes it a trouble for others to join that person. Is there any way I could host the multiplayer game form a certain server?
B
1
Posts: 1
Reputation: 127

Post » Wed Jun 28, 2017 7:11 pm

https://www.scirra.com/blog/142/make-on ... onstruct-2

There are a number of links to tutorials under the "Learn how to make multiplayer games" section. I'm not sure if they specifically explain how to set up a dedicated server, but they do talk about it in at least one of them. Have you already read over them?
B
11
S
4
G
4
Posts: 28
Reputation: 2,831

Post » Sat Jul 22, 2017 3:40 pm

What I have done is prevent the ability of a peer to create a room depending a hash value in the URL. For example, if my game URL is "awesomegame.com", to be a host the peer would need to enter a URL with a "secret" hash similar to "awesomegame.com/#secretHash" or "aweseomgame.com/#host"

Here is how to use it:
After logging in, but before joining a room, add a System condition to compare two values. Compare Browser.Hash to whatever you want the "secret" to be. Compare: Browser.Hash Equal to #mysecret

If the user is allowed to be host, create a new room with a unique name. For testing I simply used the Multiplayer.MyID for the room name.

If the user is not allowed to be host, get a list of rooms. If no rooms are joinable, tell the user that there are no Hosts or servers, or whatever message you want to say... or tell them to send you an angry email :)
B
48
S
19
G
3
Posts: 20
Reputation: 4,400


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests