[MP] How to sync animation in multiplayer games

3

Index

Attached Files

The following files have been attached to this tutorial:

.capx

dfnanimateiv.capx

Download now 188.71 KB
.capx

dfnanimateiv2.capx

Download now 188.38 KB

Stats

7,320 visits, 14,624 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 10 Oct, 2014. Last updated 19 Feb, 2019

Process Flow

On Start of Layout

Line2

Similarly to the official example, add a client value with "AnimationState" tag. This will allow synchronization of instance variable possible between the host and peers. Then, sync your object's instance variable with the tag that we have created before.

Host

Line10-Line19

Insert setbit action for the host's character's instance variable [AnimationState]. This is exactly similar in how you recorded the movement input for real-time multiplayer. This part can be unnecessary because this only record the setbit for host's character only, depends on case by case.

However, in this tutorial, this is done so that the Character object will have a synchronized state amongst all peer in the host session for consistency.

Line20

The host will get updated with the instance variable, so in this event, the host will overwrite the current instance variable's values for each Character.

Peer

Line28-Line37

Very similar to setbit for movement, setbit for AnimationState is setup according to the input state. These setbit will be used to control local animation.

Common

Line46-Line51

We're almost finished here, so the last thing you have to setup to make your animations are synchronized throughout the multiplayer session is obviously to animate each of the character. In this event, since we have updated all the character's AnimationState instance variable, we can safely use the getbit from the instance variable as the condition for the animation. The animations were named according to key control.

  • 0 Comments

Want to leave a comment? Login or Register an account!