Syncing third-person walking animations for remote players with Ready Player Me & Photon

Hi everyone,

I’m building a third-person multiplayer demo in PlayCanvas using the Ready Player Me avatar template and Photon for networking. I have basic movement working—when a player moves I send their world position/rotation to all clients, and the remote models update accordingly. The problem is, remote avatars just “float” between positions; they never play their walk/run animations.

I’m trying to figure out the best way to trigger those animations on remote clients. A couple of ideas I’ve had:

  1. Send input events (e.g. key presses) to Photon, relay them to clients, and drive the animation state exactly the same way each client would locally.
  2. Recreate animations client-side by detecting the remote player’s movement vector or velocity in script, then switching their animation based on that.

Is one approach considered best practice in PlayCanvas/Photon? Or is there an easier built-in method to sync animation state across clients? Any pointers or code examples would be hugely appreciated!

Thanks in advance,
—Korie

Often you drive the animations by some events, like ‘play run’, ‘play shoot’ … Typically you’d sync those events across network and play them on all clients.

1 Like

Hi @mvaligursky — thanks a lot for jumping in!

Quick follow-up: I currently broadcast a single event with the player’s position (x, y, z). When I add the new animation event, should I include the avatar’s rotation in that same packet, or is it fine to keep rotation bundled with the position update and only send animation as a separate event? I’m trying to keep bandwidth tidy and wondered what you’d consider best practice.

Typically, the data is bit-streamed to a small number of bytes, often with a single bit indicating if the data is there. So you can easily define your format that contains all the data, but if there is no change, the bit would be 0 and no data sent.

1 Like

Thanks again! Now, I’ve run into a strange issue and would appreciate any insight:

Everything works perfectly with 2 players. But when a third player joins, things break in a weird way:

  1. When the first joined player moves, the second and third players don’t see the movement.
  2. When the second player moves, the first player doesn’t see it, but the third player does.
  3. When the third player moves, the movement is visible to both the first and third players.

It seems like something goes wrong once the third player joins. Could this be related to the order of joining, actor numbers, or how I’m referencing entities in onEvent()? Any idea what might be causing this kind of sync issue?

For reference, here’s my test project:
:link: PlayCanvas 3D HTML5 Game Engine

Many thanks!