[PunRPC] causes movement synchronization lag
Options
Hi, I was wondering if I could get any help. I am making a multiplayer fps game. I sync movement using photon view observing photon transform view - with lerping. However, when ever I send out an RPC call on fire weapon(even if the call does nothing), the movement lags/jerks for a brief moment. The maximum rate of fire is once every 0.5f so it's not like I'm sending out a huge amount of RPC calls (only 2 members in room). I looked at msg/s and I was only maxing out at 50.
The rpc call is:
The rpc call is:
m_PhotonView.RPC("muzzleflashonother", PhotonTargets.Others, m_PhotonView.viewID);the corresponding function is:
[PunRPC] void muzzleflashonother(int viewIDFlasher) { // PhotonView.Find(viewIDFlasher).gameObject.GetComponent<MBShooter>().othermuzflashplay(); }Not that even with the PhotonView.Find line disabled, the lag is still very noticeable. If, during test I move back and forth in front of the player without firing, movement is for the most part fairly smooth. However the moment I start hitting the fire button, when it goes off every 0.5f, the player who is doing the firing lags then jerks to the next position. Is there any reason why a PunRPC call would interfere with the lerping from photon transform view? Thank you for your help.
0
Comments
-
I just want to note this happens with every PunRPC as well, even on my own screen. If I make a call to a PunRPC for targets all, my own screen stutters as well.0
-
Is it possible this has to do with PhotonView.Find()? I have to do more but it seems to be worse stutter in rpc calls with a call to find. Kind of strange, the most this function can be called is once every 0.5f but each time it's called it causes significant stutter -- again I'm not 100% sure this is it but I'm going to code a different solution that accomplishes the same thing without the call to find and see if it is still happening.0
-
Nothing strange in profiler? Maybe something else causes your problem.
0