How do I make an array track all multiplayer peer names?

0 favourites
  • 6 posts
From the Asset Store
Simple and easily editable template for a dynamic camera that zooms in and out based on how far apart the players are.
  • Hi!

    I was trying to make a mass multiplayer game, a game with no limits on player count.

    There is no object sync, it just sends a X and Y message to all players and then they spawn an object at that position. I have done this in a two player game before, and I

    was very succsesful. I used the tween behavior to make the motion appear smooth. But in

    that game, if you got a message, the only other player it could be from is the one you

    were in a room with becuase it was capped at 2 players. I figured in my new game, I can just have a object named OtherPlayer with a instance variable tracking who was in

    control of it. But I need it to constantly create and destroy these players when they

    leave and join. I thought, I will just have a array track the current players, and then

    I could use that. So I used the eye sore of a condition:

    Array.IndexOf(Multiplayer.PeerAliasAt(loopindex("PeerCheck"))) = -1

    Than

    Push Multiplayer.PeerAliasAt(loopindex("PeerCheck")) on the X axis

    But the Array.IndexOf() function differentiates between each peer that uses it.

    Please help!

  • Sorry about the enter key syntax. I did not know it would wrap like that

    Like

    That

  • I might be wrong, because my experience with online mechanics is limited, but I believe unless you send a main list of players from the host to the peers, as the "source" of the info, you won't be able to achieve this, unless you use a server, which becomes the host, so... in other words, treat the host as the server.

  • What event does this? I see events for "Request Room List" and "Request Game Instance List" but nothing of the sort "Request Peer List"

  • Personally I'd make a list myself, as an array, or preferably as a Json (personal taste), and then send it back and forth when something relevant triggers it to be resent to every peer.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have solved it by myself. What I found comfortable was to simply test if the person the message was coming from was already mapped out, and if so than tweened them correctly, but if not than created a player at that position. If you did not get a message matching a character for ~5 seconds, than they were removed.

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