[Multiplayer] Determining peer's index

Get help using Construct 2

Post » Wed May 04, 2016 7:44 pm

Hey, guys. Do you know an effective way for a peer to determine what is his number in a room? PeerIDAt seems to not include the peer himself with the right number.
B
29
S
14
G
6
Posts: 160
Reputation: 5,752

Post » Wed May 04, 2016 9:32 pm

Multiplayer.MyID
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Wed May 04, 2016 9:38 pm

I need number, not ID.
B
29
S
14
G
6
Posts: 160
Reputation: 5,752

Post » Thu May 05, 2016 1:17 am

My mistake. I would have the host send a message with the relevant peer's index. The peer can then store it in a variable locally to access if necessary. Either do it on request by having the peer send a message requesting the number and the host responds with it, or do it on peer joined have the host send the number and the peer save it.

Or if peers need to be constantly updated as people leave and join, the host can just broadcast the relevant information regularly via messages.
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Thu May 05, 2016 11:42 am

Thank you. I should have thought of that. Host actually has the right numbers (Peer N1 at Multiplayer.PeerIDAt(1) and etc).
B
29
S
14
G
6
Posts: 160
Reputation: 5,752


Return to How do I....?

Who is online

Users browsing this forum: R0J0hound, StillSarah and 25 guests