Whats the best way to handle animations in Multiplayer

Get help using Construct 2

Post » Wed Nov 02, 2016 6:16 pm

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?
Soulmachine @Soundcloud
B
14
S
2
G
1
Posts: 63
Reputation: 928

Post » Wed Nov 02, 2016 7:27 pm

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.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Wed Nov 02, 2016 8:45 pm

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.
Soulmachine @Soundcloud
B
14
S
2
G
1
Posts: 63
Reputation: 928

Post » Wed Nov 02, 2016 10:04 pm

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?
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Mon Nov 07, 2016 3:57 am

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.
Soulmachine @Soundcloud
B
14
S
2
G
1
Posts: 63
Reputation: 928

Post » Sat Nov 26, 2016 2:11 am

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)
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091


Return to How do I....?

Who is online

Users browsing this forum: Lancifer and 32 guests