[MP] How to sync animation in multiplayer games

Index

Attached Files

The following files have been attached to this tutorial:

.capx

dfnanimateiv.capx

Download now 188 KB
.capx

dfnanimateiv2.capx

Download now 188 KB

Stats

2,117 visits, 5,119 views

Translations

This tutorial hasn't been translated.

Tools

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

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