Multiplayer options

Discussion and feedback on Construct 2

Post » Tue Apr 15, 2014 6:56 pm

Hi there. This is my first actual post in a while and its a sort of direct question for @Ashley ... I've been playing around with the multiplayer pong idea for a while with my co worker and the recent template was great in clearing out some of our doubts.

However I've been thinking... I know at least on this recent version of multiplayer the signaling server is hosted by scirra and manages the information traffic for the host and peers... Is there any possible way to make something similar over bluetooth connection among paired devices?

Any ideas or suggestions are welcome too.

Thank you again for such a great product.
Freefall Bird
B
47
S
9
G
5
Posts: 281
Reputation: 5,803

Post » Tue Apr 15, 2014 7:01 pm

The signalling server needs to be a central point for peers to meet, so everyone knows where to go to find other players. This makes it difficult to run anywhere other than a public web server with a fixed name (in this case multiplayer.scirra.com). However if two peers are on the same LAN, then WebRTC will figure this out and connect them directly to each other for the actual gameplay, so you have near-enough zero latency for the game itself.
Scirra Founder
B
402
S
238
G
89
Posts: 24,617
Reputation: 196,001

Post » Tue Apr 15, 2014 7:34 pm

@Ashley Thank you for the quick reply. So if I wanted my game to have a private yet multiplayer connection w/o adding extra load on scirra's signaling server we would have to make our own solution right?

The game we are developing is for mobiles and we'd like the players to be able to setup their "room" and invite their friends(2-8) for a nice challenging game much like old battle tetris(ours is not tetris tho) used to do.

I'm just asking because I have to rely this to my team in a clear manner and I want to have the best possible explanation I can for them so we can make the adjustments we need to do if any.

Thank you for all the help you've been great.
Freefall Bird
B
47
S
9
G
5
Posts: 281
Reputation: 5,803

Post » Tue Apr 15, 2014 7:45 pm

Our signalling server is running on a high-end server which is currently yet to hit 1% network utilisation... so I wouldn't worry too much about the load on our server!
Scirra Founder
B
402
S
238
G
89
Posts: 24,617
Reputation: 196,001

Post » Tue Apr 15, 2014 7:46 pm

ok cool good to know.
Freefall Bird
B
47
S
9
G
5
Posts: 281
Reputation: 5,803

Post » Tue Apr 15, 2014 11:39 pm

RT
Last edited by CarHazy on Sun Jun 14, 2015 3:10 am, edited 1 time in total.
B
20
S
7
G
5
Posts: 24
Reputation: 4,510

Post » Wed Apr 16, 2014 1:56 am

zlesavich wrote:I also have a question for you, @Ashley. You said it was possible in your chat tutorial to add private messaging. I tried it myself to what I believe should work, but doesn't work. Could you elaborate more on your theory? I've attached my .capx if you need it.

Thanks


** Updated to include who from **

The way i do it might not be the most efficient way.

But i have an array in my project for the peer, 4,1,1.

I insert the ID/alias of the player i want to message into the first element.
Then the "tag" into the second element.
Then the message into the third element.
Then who its from in the fourth element.

I then send a message to the host with the tag "pm" and the message as array.asjson

The host has two arrays.

arrayrecieved 4 by 1 by 1
arraysending 2 by 1 by 1

The host has a call waiting on.message.from.peer.with.tag."pm" >

It then loads arrayrecieved with arrayrecieved.load.from.json multiplayer.message
Then it loads arraysending first element with arrayrecieved.at(3)
Then loads arraysending 2nd element with arrayrecieved.at(4)


Then multiplayer.send.message
To: arrayrecieved.at(1)
Tag: arrayrecieved.at(2)
Message: arraysending.asjson

The recieving peer has 1 array, arrayrecieving, 2 by 1 by 1

multiplayer.on.message.recieved.from.peer with tag "pm" > arrayrecieving.load.from.json multiplayer.message

> textbox.append from & " " & arrayrecieved.at(4) & ":" & " " & arrayrecieved.at(3) & newline

Hopefully this isn't too confusing :)
B
10
S
2
G
1
Posts: 92
Reputation: 926

Post » Fri Apr 18, 2014 2:26 am

RT
Last edited by CarHazy on Sun Jun 14, 2015 3:09 am, edited 1 time in total.
B
20
S
7
G
5
Posts: 24
Reputation: 4,510

Post » Fri Apr 18, 2014 3:37 am

zlesavich wrote:I'm not using an array though, I'm using a text box.


The text box object is used to show the peers what others are saying.

You still need a way to whisper someone.

Since peers cannot talk to each other directly, you have to send a message to the host telling it who to relay to, what the message is, and any tags.

In my previous example, i used an array, after some thought, it might be easier to use the dictionary object for small messages.

Ill make an example for you and upload it after lunch :)
B
10
S
2
G
1
Posts: 92
Reputation: 926


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 5 guests