Wsoukkachang's Recent Forum Activity

  • mzo I tried that but get NaN as the value... do you know what that means?

  • I am trying to sync a global variable in multiplayer where when the global variable changes from the host, it shows this to every other peer. Any help is grateful.

  • Oh wow! That was the solution! Thank you again Ashley. I am really learning so much from you. Also the new beta release was really helpful, in that it kept telling me which objects I haven't yet synced up. Cheers!

  • Hmm I tried it that way but now my players are having the same peerIDs. Can you check out what is wrong with my project please. I can't get them to be their own player.

    https://www.dropbox.com/s/cxt2auw8tv1stpx/NewThockThay.capx

  • 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.

  • Since this is my first fourm, I was wondering how do I make this forum status "solved" ? Or is there no button for that. Thanks guys. Scirra is the best!

  • I came across a problem when I was setting up my multiplayer card game. The game involves 4 players joining a room to play at once and I wanted to distribute cards to each one of them, but I found out that you could only set up one person to have the Multiplayer.PeerID. Is that correct? Or am I doing something wrong? What would be a good way to store their unique ID (peerID) and tell the computer to store it in a global or instance variable? Thanks.

  • Ashley I am not sending it every tick. I finally got it working now. Thank you so much for your help!

  • Ashley I tried doing it like this, but it still isn't working. Am I getting close?

  • No, not websockets, just the multiplayer object's 'send message' or 'broadcast message' actions. A bit like chat messages from the chat example but with array data instead of a textbox's text.

    Oh ok, I guess that makes sense. I have the idea of the process in my head, but I don't know how to execute it yet. I'm going to analyze the multiplayer chat and try to figure out from there. But nonetheless, thanks for the quick reply Ashley. I shall try to fiddle with it more. Cheers!

  • Support is not built in, but it should be easy to achieve using normal messages. If the array is small, you can just send it as JSON text (using the AsJSON expression). If it's large then that method will waste bandwidth, so you could instead have a message that is sent when individual indices change.

    Thanks for the reply Ashely. Could you give me a step by step example of the method like how you would do it in construct. Would I use websocket?

    1. The host has array.

    2.Set as JSON text (using websocket?).

    3.Sends to peers.

    4.Peers update game with that JSON text?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I am trying to make a multiplayer card game using construct 2 and I came into a roadblock in the development. I was wondering if anyone knows how to sync arrays using the multiplayer feature. For example, the host shuffles the cards and put the result into an array. How do I update the values of that array to the rest of the peers. Any information would be grateful.

Wsoukkachang's avatar

Wsoukkachang

Member since 20 Mar, 2014

None one is following Wsoukkachang yet!

Connect with Wsoukkachang

Trophy Case

  • 10-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

12/44
How to earn trophies