How do I send an array to other players (multiplayer)?

0 favourites
  • 14 posts
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • Hi,

    In my current project I want to send an array from the host to a peer and from that peer to the host. I already added that to my project but for some reason it

    doesn't want to work. <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

    I also added the same AddLog function as from Ashleys multiplayer tutorial to see what it is doing right now but the function doesn't work either (only in that part of my project).

    Somehow the host can actually receive the array from the peer, but the array from the peer never arrives at the host.

    So I have no idea what to do to fix the problem <img src="{SMILIES_PATH}/icon_e_confused.gif" alt=":?" title="Confused"> Does anyone have an idea? I'll upload a screenshot of the event sheet in this post.

    Thanks for any help! <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile"> ... i1rZWUxcjg

  • It looks like it should work. I have not used the official MP plugin though.

    Did you intend to transfer the data from "Array" to "enemy"?

  • Thanks for your reply gumshoe2029,

    Yes that's what I want to do. The Array contains the "blueprint" of the local player and that is supposed to be transferred to the other player, so that he can load it into the enemy array. If that would work, I would be able to load the player models of the enemys on each players computer.

    Thanks again!

  • Are your peers connecting properly? It seems like the error is further up the stream than your screenshot.

  • Thanks gumshoe2029,

    Yes the peers are connected properly. I can already see them moving on each computer (they are synced).

    I don't think the problem has something to do with the connection because the peer is already able to send his array data to the host.

    Thanks again!

  • I am not sure then. Hopefully, someone who has actually worked with the MP plugin finds this.

  • bump!

    Does anyone know how the multiplayer plugin works? And what I've done wrong?

    I still haven't found a solution to this problem. Maybe it even is a bug.

    Any help is appreciated!

  • Can you post a capx? Are you testing locally to rule out any network/routing issues?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This works :

    Edit : after looking at your screenshot, I have several questions :

    • Why do Peers send their array to the Host at the same time Host sends its array to Peers? Looks like there is a conflict here.
    • Are you sure your arrays aren't empty?
    • Do you actually see your "Sending array data to…" notices?
  • Thanks oosyrag , ,

    I can't really post a capx right now because the events that you can see on my screenshot are located in a bigger (a little messy ) project.

    I just wanted the host and peer to send their arrays to their opponent, because the array contains the model of the players. That model is too big and consists of too many different parts so that I can't just use the sync action. After the array is received, every player will have his enemys built up by a program that I already made. The different parts that were created from the array are then pinned to the "core" of each player so that they move with him.

    My arrays aren't empty and I can't see the notices in my log.

    Thanks again!

  • Hi,

    I just got both the peer and the host to send their array and I could I even receive it on both ends. Still I can't see anything from the AddLog function.

    Here is the current state of my events: ... sp=sharing

    Any ideas?

    Thanks! <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

  • Maybe add a "send to peer"

    Otherwise the messages are not being sent out?!

    It's hard to tell if we can't see the entire code.

  • Thanks Everade,

    I actually got the multiplayer part to work. The only problem is, that the "AddLog" function doesn't work, even though it works in the rest of my project.

    I didn't find a solution yet .

    Thanks again!

  • aquadijoib

    I'm using the AddLog for Chat only, as used in the multiplayer example from Ashley.

    It works just fine.

    But i've never tested it to send anything else.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)