Restarting animation on shadow character when re-entering view

salamander7_11

New member
Hi,

I am having an issue with some Multiplayer code. The code I have is based on the PUN package but using TNet instead. I have setup a simple game area with 4 views that the player can be a part of, if they leave a view the shadow object will disappear from other players view. This seems to work. What is not working is if a player keep walking back into a view they just left in one direction without releasing the keyboard key, the animation is not started. Only if I release the keyboard key and press again will the animation kick in again. As you can see the shadow gameobject is removed on exit and created at entry. Is there a function I should call or an event in UCC I should invoke in order for the animation to kick in again?

This video is showing what is happening:

 
It's really hard for me to debug multiplayer code based on a description but I can say how the PUN add-on works which may help your situation.

With PUN the animator is synchronized using the PUNAnimatorMonitor. This sends all of the parameter values to the remote clients and ensures that they are in sync. The movement is separate from that and it's the PunCharacterTransformMonitor responsible for syncing movement. The character locomotion Move method is not called on the remote clients as only the results are synchronized.
 
Thanks for your response. I believe I already have what you are describing working as you can see in the video as long as the shadow character is in the same view/room as the player that is viewing the action at the start of the input. If the other player leaves the area and then comes back continuously pressing the same input key, the shadow/mirror will appear in the players view and transforms are synchronized alright, however the animation is not starting until the remote player lets go of the input key and presses it again. I am guessing whatever is synced when a key is being pressed to start abilities needs to be resend. If I am correct do you have an idea what that might be? Could it be states maybe?
 
I think I got it working, sort of, by calling SynchronizeParametersRPC and SynchronizeItemParametersRFC
in the network CharacterAnimatorMonitor directly, same place I sync transformations. Though there is a slight delay due to the network ping-pong happening before the sync actually takes place, due to the way I seemed to have to do it, i.e. having the shadow in the local players space call the "real" gameobject in the remote players space to distribute this data to Target.Others when the shadow object is created.

https://drive.google.com/file/d/1lF9A8Dgc4CShfD4lPWmN24COtTK4L5rb/view?usp=sharing

I think part of my problem is the order things happen in and the fact when the remote player gets the event when he entered the view of the local player there is a delay before the shadow has been instantiated and can receive data. That's why I had to do it the other way around, have it tell the "real" player it is ready to receive, i.e a pull instead of a push. Don't know if there is a better way.
 
Last edited:
Top