How do I Sync arrays Over Multiplayer?

Get help using Construct 2

Post » Wed Apr 16, 2014 12:21 pm

There is no 'solved' option, I don't see much point in it either (it might discourage someone from checking the thread and posting a better solution).

It would however be useful to post what you did wrong and what you did to fix it, so others who find the thread in future can learn from it.
Scirra Founder
B
395
S
233
G
88
Posts: 24,376
Reputation: 193,842

Post » Wed Apr 16, 2014 8:42 pm

I figured out what I was doing wrong, I was not loading the peer message as Multiplayer.Message but using the array_name.AsJSON instead.

If anyone needs help with sending an array over multiplayer, this is how you do it:

1. First to make the Host broadcast the message.

Make sure you put this in the Host group.
Use the Host "Broadcast Message" (in multiplayer feature).

In the "tag" slot you could use whatever tag you please and in the "message" slot you should use
(the array name you are trying to send).AsJSON

So it should look something like this array_name.AsJSON in the message.

2. Now to make the peer receive the message.

Make sure you put this in the Peer group.
Using the multiplayer feature, click on "On peer message",
when you do, it will ask for a tag. Use the same tag you used with the Host.
Next, you click on the array you would like to sync up and click on "Load".
This will bring up the JSON slot and in this slot input Multiplayer.Messge .

Now it should sync up. That is all there is to it. Hope this helps! Thanks Ashley for the help, could not have done it without you.
B
19
S
3
G
1
Posts: 37
Reputation: 1,433

Previous

Return to How do I....?

Who is online

Users browsing this forum: JDebstup and 11 guests