Does the sequence of chat message the same for all peers?

Discussion and feedback on Construct 2

Post » Wed Mar 19, 2014 4:26 am

Hi, I am reading the official Multiplayer chat example capx.

Assume there are two players (peers) send their message at the same time.
1. The message first show at local text area, then send it to host.
2. host will broadcast received message to all peers
3. Peers will show the received message to local text area.

For example player1 send "P1 say hi", player2 send "P2 say hi". After these 3 steps,
The text area of player1 will be
P1 say hi
P2 say hi


But the the text area of player2 will be
P2 say hi
P1 say hi


Other peers might be the same as player1, or player2 .


The sequence of chat message is different between player1 an player2 .
Is it right or do I miss something?
B
109
S
27
G
276
Posts: 4,479
Reputation: 154,418

Post » Wed Mar 19, 2014 6:08 am

With reliable ordered, you're going to have it so that:

P1: Sends message at 11:25:32.500 (first)
P2: Sends Message at 11:25:32.550 (second)

Peer1 wrote:P1: MESSAGE
P2: MESSAGE

Peer2 wrote:P2: MESSAGE
P1: MESSAGE


However, since it's reliable ordered, Peer 3 will see what Peer 1 sees(Assuming it reaches the host at the same order and time difference). IRC works the same way and there's no way to prevent what Peer 2 sees, but he's the only one to see it. If there is enough time between, Peer 2 would receive the message before sending his and wouldn't have a difference

I am curious though if Reliable Ordered applies to the tag or the message system as a whole.
B
21
S
8
G
6
Posts: 346
Reputation: 4,891

Post » Wed Mar 19, 2014 6:20 am

@Thndr

Thanks, I just want to confirm that the sequence will be all the same or not.
B
109
S
27
G
276
Posts: 4,479
Reputation: 154,418

Post » Wed Mar 19, 2014 2:17 pm

I would assume it's the same for all peers except the one in that case if you use Reliable Ordered

Multiplayer Tutorial pg.10

@Ashley describes it as holding other messages back until it can complete the communication on that one message and says it's perfect for chat. If there are intricacies with it that we need to know -like how the ordered method of 1 message affects another message with a different ordering, if it's a different tag or same tag- hopefully he can enlighten us.
B
21
S
8
G
6
Posts: 346
Reputation: 4,891

Post » Wed Mar 19, 2014 3:57 pm

@Thndr

There are some prediction methods used in ghost shooter example which is a real-time game. How about predicting the chat message. (Just kidding~)
B
109
S
27
G
276
Posts: 4,479
Reputation: 154,418

Post » Wed Mar 19, 2014 4:33 pm

It's possible messages could appear in a different order for different peers, but only because you add your own chat message locally instantly. If you send a message while another peer's message is in-transit to you, then you will both have added your own message instantly and then receive the other peer's message after a delay, so both peers see themselves going first. If the host sent back your own chat message to you, firstly there'd be a delay before your own messages appear, and secondly there's still a race as to who's message will reach the host first, so someone on a faster connection could still beat you. However everyone would see the same message sequence. I don't think any real chat clients do that though. If you send a message while another message is in-transit to you, it's impossible that your message could be a response to that, so the ordering is not important.

Basically network stuff happens in-order using "reliable ordered" mode, but the chat example does not use the network for adding your own messages, so exceptions can occur.
Scirra Founder
B
399
S
236
G
89
Posts: 24,519
Reputation: 195,361

Post » Thu Mar 20, 2014 2:40 am

The chat message and ghost shooter might be similar, they response the input immediately.

The different is -
Peer of ghost shooter will do correction (reset position) when received sync-data (synced object).
Peer of chat does not do any correction. So if the correction added , the sequence of message of all peers will all be the same as host.
B
109
S
27
G
276
Posts: 4,479
Reputation: 154,418


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 7 guests