Whats the best way to handle animations in Multiplayer

0 favourites
  • 6 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • Hello!

    What's the best way to:

    start stop

    change

    ...Animations in a multiplayer game?

    I always start from the multiplayer-template and I use the Groups created for you in that template.

    Should I try to do this in the Common-group or should I do it in the Host-group and send "orders" to the Peer-group so that the peer's also do the animation-changes?

    What's the best way to do it?

  • Animations should always be client-sided.

    Depending on what animations you use, send animation-specific info to clients, like "start animation X".

    The client will then, on receiving such string, interpret this and do the appropriate animation.

  • I see...

    Hmm thats ALOT of "orders" to send and lot of programming. I did this a while ago in another game. The bright side is that if It's set it up well and once it's set up it's pretty easy to send such info to the clients.

    These animations I have in mind for this game has to be changed for all the clients at the same time. It is things like when another player move, they need to see the animation for the legs, and so on...

    I guess I'm kind of forced to do this anyway since it does not work for the clients if I mess with animations in the Common-group.

  • Maybe I don't understand you correctly, but wouldn't sending animation details to the peers be a even bigger effort?

    Wouldn't you have to send the exact position of the legs every tick?

    Not only that, but that would consume SO MUCH bandwidth..

    Am I understanding correctly what you are aiming for?

  • Sorry, I'll explain a little better.

    In this particular case I have a situation with several players in a multiplayer game.

    One issue with the animations is for example when a player walk ( or move ). Then the player have a walking animation... So if a player walks and other players see that player they all need to see the animation of the legs.

    ...So, when a player walks, I want to start the walking-animation, and when the player stops, I want to stop the animation. And all the other player's needs to see this. Not only the host - and the Peer (client) that is currently walking.

    In short - all the clients needs to know when a player is moving - and if they do, they need to know to start that players walking animation.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just discovered this thread again and realized I didn't answer yet. Sorry about that.

    Did you solve your problem?

    If not, here is a possible solution:

    (Prerequisite is, that each player sprite has an instance variable with the players Multiplayer ID. You could set this "on connected" or when the sprite is created)

    • If the host gets the info that a player starts walking, he needs to get that player's ID with the message (Multiplayer.FromID).
    • The host then sends out a message with the tag being "walk" for example to all peers with the content being "playerID=[...]".
    • The peers, on receiving a message with the tag "walk", will set the player's sprite to the walk animation. (it picks the correct sprite by evaluating the received PlayerID and picking the corresponding sprite that has the same PlayerID as its instance variable)

    That's it.

    This may sound like much, and I have the feeling that I didn't explain very well (I'm about to go to sleep), so if you need more explaining, just give a shout.

    (And if you already solved it, I'd be interested in how your solution looks like)

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