2 player 1 box with rigidbody

Hello everybody,

I'm a newbie at Photon Network. And I'm following and editing Viking example to make my own game.
What I'm trying to do is actually very simple. I want to create a box which includes rigidbody. And two player will be able to move it. To do that, I added PhotonView to my box. I wrote PhotonNetwork.Instantiate code to instantiate it in BoxSpawner script. Whenever a player presses space key, a box is spawned.

But I'm having some problems;

When the first player moves the box, second player sees it very laggy.

Other than adding PhotonView do I have to do something else?

Comments

  • Welcome to Photon, our forum and networked programming in general :)
    grozar wrote:
    What I'm trying to do is actually very simple. I want to create a box which includes rigidbody. And two player will be able to move it.
    Actually, this isn't so easy. You obviously found out why: There is lag.
    The problem is that the interaction is not simultaneous on all connected systems. So in some cases, the different system's physics come to different conclusions. Then you will need to rollback and re-synchronize the scene. This is usually breaking immersion for systems like physics (they are built to behave naturally).

    Sadly, we can't solve this problem of "networked physics" for you. It depends on the game and your needs.
    You can probably save some lag by using a server that's close to all players: http://doc.exitgames.com/photon-cloud/Regions/
    You can also delay input locally (while sending it immediately).
    And in general, read up on that topic: http://gafferongames.com/game-physics/n ... d-physics/