Photon Cloud & Rigidbody

Options
Recently I create a Networking Ping Pong style game and using both Free Photon Cloud & Local Photon Server to test the game.
During testing on Photon Cloud, the ball (rigidbody) is really lag and sometimes even stuck at certain position

I plan to deploy the game into mobile platform in the future, will it getting worse if I deploy into mobile platform.
Isn't any way to enhance the performance of my game ?

FYI, there are 3 rigidbodies in this game. 2 player object with Kinematic rigidbody which movement is controlled by the script.
1 ball with non - kinematic rigidbody.

Beside, after refer some of the forum post I have done some improvement :
1. Master Client controlled the position & physics update which is other client will send the input to master client and master client update the position. Then other client update position by lerp to the position.
2. I also tried to disable 2 player object rigidbody on non-master client.

So, did I miss something ? Thank if any advise?

Comments

  • dreamora
    Options
    The problem is not the performance but that you likely didn't implement proper client side prediction / lag handling, interpolation and extrapolation.

    I would recommend to download Unity Technology 'Unity Networking Example' from the Asset Store and check the authorative setup as it has a very solid and easy to understand implementation of client side prediction implementation which you can basically use 1 : 1 with PUN :) Especially the NetworkRigidbody is of relevance
  • Sorry , I cant find the Unity Technology 'Unity Networking Example' from Asset Store . Can you give me the link? And what does you mean 1:1 with PUN ?
  • Tobias
    Options
    I think Unity's networking example is not in the Asset Store but can be found on their page for download. It aged a bit but adjusting it to the latest Unity version should be no big hurdle.

    To improve your network lag, check if you can pick a server closer to your location. We list our regions here:
    http://doc.exitgames.com/photon-cloud/Regions
  • dreamora
    Options
    Args
    You are right. For whatever reason, they took this one down while keeping the 0 information ones up...

    Before you go down any of these routes: did you try out one of the photon unity network examples available?

    It seems that this user basically cloned it http://www.unity3dmax.comxa.com/networking.html so that might get you going.
    If not then that would be a case where investing into the M2H network tutorial could make a lot of sense as their 100 page tutorial + example projects is fantastic especially if you are new to networking, it can save you countless hours even if its not targeted at Photon.

    As for the 1 : 1 with PUN: PUN (photon unity networking) acts like Unity Networking so you can widely just reuse the code. Actually if you use the converter that comes with pun it might even work without you requiring to manually port anyhting.
  • I found the code and modify the NetworkRigidbody.cs to use photon. It works but after i changed m_InterpolationBackTime to 0.25f instead of 0.1f it more smooth than before . But i havent go through the script in details, maybe i know use of m_InterpolationBackTime if anyone willing to explain. :oops:

    Beside, I just found that I can add more than 1 photonview into the same GO
    So, I added 1 more photonview to observed the rigidbody ( 1 is observe NetworkRigidbody script ) , isn't allowed or this is correct method ???

    1. Do i really need to destroy the rigidbody on the non- master client side to make physics worked better ?
    2. For non-kinematic rigidbody isn't no need to attach the NetworkRigidbody.cs?
  • dreamora
    Options
    InterpolationBackTime is basically the 'lag compensation'. Its the timeframe by which each user input is 'pushed back in time' to be applied. This way the other user will have received your input before it is meant to be applied and it can be applied at the correct point in time. Otherwise if it is received later, then he will extrapolate stuff physically and needs to correct them once again which leads to jitter and incorrectness
  • Once again, i testing everything last week all my rigidbody is working fine but not today . Sometimes, the rigidbody does not move at all :cry: . Isn't my internet connection problem or the cloud is doing maintenance ? How I can check the transfer packet or speed?
  • Tobias
    Options
    You can show various client side statistics by adding the PhotonStatsGui to the scene and make it visible.
    http://doc.exitgames.com/photon-cloud/PhotonStatsGui

    The cloud should have changed since last week. Maybe your settings file did and you end up in another region than before?
    Pick the one closest to you. At the moment, you have to edit the settings file yourself to do so, though.
    http://doc.exitgames.com/photon-cloud/Regions