How do I SYNC PEERS ANIMATION

0 favourites
  • 5 posts
From the Asset Store
Sync animations, animation frames, mirror state, sounds and anything else using these methods.
  • Hi Guys !

    i'm reading the Multiplayer documentation & manual, and i've also tried to find in the forums some answer, but i don't see really any template or .CAPX based on a Multiplayer platformer game. And so actually my problem is :

    my current host & peers Animations are not view by each others.

    this is problably due the fact In my current configuration i have

    1 - a basic box (who have all variable)

    2 - a sprite who contain all animation and where the position is set to the basic box origins.

    so i guess my sprite are not updated, thanks for your help on the topic

  • The animation is just another piece of information to sync, just like the instance variables from the tutorials. In fact instance variables would be a good way to go, and just set animation A if the variable is 0, animation B if 1, etc.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • An alternate way would be simply call the functions simultaneously on each device. This ensures the animation you want is the same becuase both devices call the same function. It works really nice for me.

    [attachment=0:dt756ie8][/attachment:dt756ie8]

    Note: You will need the MoveTo Plugin by Rex for this to work

    I created a small plat-former example where every action is synced by performing function calls. I don't sync any objects or do association. I've found this to be a faster solution to compensate for lag for synced behaviors that already take dt (time dependent events) into account. Its a little complicated to follow and ill see what i can do about putting in some comments but check it out and see if it will work for you.

    Just open the example in 2 browsers. On the screen at the top enter the room name (it should bee the same so they join the same room). Then give each player a name and click connect. (I got little lazy and it only supports 2 players so if you join more than 2 in the room it will break)

    What I do is make everything a function call and simulate actions. When player 1 presses left.. he calls a function to simulate moving left on his screen and at the same time sends a multiplayer message to other players that tells them to call the exact same function for player 1 on their screen.. Everyone sees the same thing and instead of syncing for every X,Y change i send a single message and tell it to persist until i tell it to stop. The move to is just the last piece that fires off to ensure the players are where they are supposed to be on each other screen. (This example is missing some other code i put in to correct for speed differences in the devices but it still works really well and should be a good starting point)

    The trick and complicated part is that using this method i send only 3 packets to move a player all the way across the screen instead of sending lots of x,y updates. Movement is smooth and timely. How this is possible that the sender can tell the receiver to persist the function (continuously call it) so I only send the move left command once and tell it to persist on the receiving device. the receiving device continuously calls the function until i tell it to stop... (Its the same way wireless signals in remote controlled cars work as I have some history in that field this is where i got the concept).

    Ashley I'm curious to get your thoughts on this method as I'm sure its very unconventional but would it be useful to add action to the multiplayer plugin to make function calling cross device easier? Constructive criticism is always welcome.

  • Ashley, thanks for your answer, it's always great to get an answer on a hot topic such as Multiplayer can be directly by a construct team member. So thanks again for your time. The solution you told me, was the one i was thinked about during the afternoon , but lucky for me i finally found another solution which is far more simple and who seems to work perfectly. and now Both my Host & Peer can see each others "animations". i simply changed all my character controls design to match with the network requierement. So let say i send in addition to the input the animations currently playing. I Will bring new information for anyone working on the network if neccessary

  • troublesum thanks for your time and your answer, today i have checked hundred of time the forums and during some search i was falling on your post mentioning this Function Method, i think i will use also Function for some specific action. I will keep you updated as soon as i get move to plugin, but thanks again for your help , i'm eager to be able to open your capx to check what you've have done on this side

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