playMaker

Author Topic: Animations do not always sync in Photon  (Read 7844 times)

Krillan87

  • Beta Group
  • Full Member
  • *
  • Posts: 185
Animations do not always sync in Photon
« on: October 11, 2017, 07:51:56 AM »
Hi,

I have a simple multiplayer game with 2 characters that are controlled with mechanim and the animations are synced with photon. I have a small issue with the movement not being a bit jerky, but it's not critical.

One thing that is more critical is that some animations do not always play. Watch this video  when the "shooting animation" on the left screen only trigger like 3 out of 10 times:
http://sendvid.com/ulr6oziu

Here are my settings for the "Photon view" and the "Photon Animator View":
https://imgur.com/a/0u4vl

Some things to note:
The shooting is using a animator trigger and the Photon Animator View is last in the stack (I guess "stack" is referring to the last component on the game object, right?)

There seems to be some kind of priority when syncing the animations. If the character is in the running state, the fireball-attack do not trigger.

Regarding the jerky movement I tried to change the lerp to "late update" but that just made the players stand still in the middle of the scene.

I also changed the lerp-value to around 20, instead of 5. This seems to have a positive effect on the movement, making it smoother. I do not know what oteh effect that might have. I also see that the rotation of the characters are the most jerky one, but i do not know why.

Anyhow, is there a generall better way when synchronizing animations with Photon, making them smoother and better?

Thanks,
Christian

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Animations do not always sync in Photon
« Reply #1 on: October 12, 2017, 02:38:44 AM »
Hi,

 Animator Triggers do not work well for network syn unfortunatly.

 the problem is the following:

 when a script raises an animator Trigger, the trigger flag only leaves for a fraction of the frame life time and so other scripts may query for the trigger value and get a false result because it did not ask at the right time.

Unfortunatly, I found no ways around that as of yet. so I suggest you don't use triggers but regular boolean animator values that you turn off the next frame then you are sure to catch it.

 Bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Animations do not always sync in Photon
« Reply #2 on: October 12, 2017, 02:40:45 AM »
Hi,

 as for smoothness, it's always a matter of middle ground, too much lerping and it will catch up too slowly, while more direct sybch will results in jittering.

 I don't have a definite solution for this and it depends on each gameplay and animations. sometimes synching the input commands make more sense as you can recompute what animations to do given user inputs as opposed to passivly rely on animation synch.

Bye,

 Jean

Krillan87

  • Beta Group
  • Full Member
  • *
  • Posts: 185
Re: Animations do not always sync in Photon
« Reply #3 on: October 12, 2017, 05:20:06 AM »
Hi,

 Animator Triggers do not work well for network syn unfortunatly.

 the problem is the following:

 when a script raises an animator Trigger, the trigger flag only leaves for a fraction of the frame life time and so other scripts may query for the trigger value and get a false result because it did not ask at the right time.

Unfortunatly, I found no ways around that as of yet. so I suggest you don't use triggers but regular boolean animator values that you turn off the next frame then you are sure to catch it.

 Bye,

 Jean

Alright I see, that was how i did it before but then I found of the triggers and it seems like such a easy way of doing it, not have to do the extra boolean. But well well, thank you for your help. I just gonna go back to the boolean.

Krillan87

  • Beta Group
  • Full Member
  • *
  • Posts: 185
Re: Animations do not always sync in Photon
« Reply #4 on: October 12, 2017, 05:25:36 AM »
Hi,

 as for smoothness, it's always a matter of middle ground, too much lerping and it will catch up too slowly, while more direct sybch will results in jittering.

 I don't have a definite solution for this and it depends on each gameplay and animations. sometimes synching the input commands make more sense as you can recompute what animations to do given user inputs as opposed to passivly rely on animation synch.

Bye,

 Jean

Alright. Just to be clear, do you mean that I should send the inputs commands (like the animation states?) into a RPC call and then compute the animation locally? Or what/how did you mean?

Thank you for your help, once again Jean! You are a star!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Animations do not always sync in Photon
« Reply #5 on: October 17, 2017, 03:01:25 AM »
Hi,

 no you should send the user inputs and deduced the animations control based on these inputs,

if you send the animation states you will be missing the transitions effect and blending.

Bye,

 Jean

Krillan87

  • Beta Group
  • Full Member
  • *
  • Posts: 185
Re: Animations do not always sync in Photon
« Reply #6 on: October 17, 2017, 05:34:23 AM »
Hi,

 no you should send the user inputs and deduced the animations control based on these inputs,

if you send the animation states you will be missing the transitions effect and blending.

Bye,

 Jean

Hi,

Yeah I was a bit unclear, that was what i meant. for instance, i send the boolean för "shoot" via RPC and the compute the animation logically. Instead of using the photon animation view

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Animations do not always sync in Photon
« Reply #7 on: October 18, 2017, 07:02:25 AM »
Hi,

 well, using PhotonAnimatorView works for all parameters excepts triggers, so if you have a boolean to synch, PhotonAnimatorView should work, is that not what you experience?

bye,

 Jean