How do I update the screen for both players ( multiplayer )

0 favourites
  • 3 posts
From the Asset Store
Players follower. use it for anything which follows the player
  • Hi!

    I've thrown myself into multiplayer a few days ago and i have to learn a lot.

    Though i think i know the connection basics but i have a struggle with updating the screen for both players.

    I've ended up trying to integrate the functionality from the Multiplayer 3: Pong tutorial.

    As far as i get it to work:

    Player 1 and Player 2 can connect with each other. Both getting a ID and a object will be created for the new joined player.

    Now just to learn i am trying to change the frame of the object if the player clicks it.

    Once changed the screen has to update for both players.

    Changing the frame of the object is working without any problems but i can't get the change visible at the other player.

    I wish i could get some more knowledge about actually updating the game on both ends.

    I will post some screenshots from my current page underneath here. Please any feedback and or tips are welcome.

    I highlighted my problem in red. I wish some one could enlighten me about how to process that change at the other players side. Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok so i was looking in to this a little more and i still didn't figure it out.

    I really am missing the part of updating.

    Can any one try to explain to me how data is transferred?

    For example how could i:

    Show 2 same objects for each player. This object has 2 frames.

    Each player can click on their own object to simply change frame from 1 to frame 2. If a player does this ( host or peer ) it has to update the object to to correct frame on both screens.

    If any one can help me out a little i would appreciate it very much.

    My idea would be:

    Object has 2 values, peerid and framenr ( as in my image above ).

    On touched "object" set framenr to self.framenr+1

    And this is the part i miss, how do i get the frame change aka variable change to both users?

  • Ok i just tried everything i could think of and i just can't get it to work.

    I created a capx that would do the trick as i tried to explain above.

    Could some one with knowledge of the multiplayer object look into this and take a look where i go wrong?

    Thanks in advance.

    The capx:

    https://www.dropbox.com/s/fvi5ndh3gfhks ... .capx?dl=0

    What works:

    This capx will let you connect to a other player. Once connected it creates the "avatar" object for the joined players so both players got the same object.

    The "avatar" object gets the right peerid's ( one for the host, one for the peer ).

    The problem comes into play when i try to update the "avatar" frame. This should show on both ends but it does not.

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