Search Unity

RigidBody and Network + Testing suggestions

Discussion in 'Multiplayer' started by dklompmaker, Sep 21, 2008.

  1. dklompmaker

    dklompmaker

    Joined:
    Sep 12, 2008
    Posts:
    80
    Hello all!

    I have a very simple (And when I say Simple I mean it) networking project in which a blank unity scene initializes a server, and then a second app "client" connects to that server and then Network.Instantiates a player prefab. Now the problem I am having in testing... is that when the app is in focus.. or selected then it runs... but in order to update the scenes the server has to be in focus to process all calls.. so in my question.. I have two clients that the end result of the objects are two very different positions on both screens.

    2 clients both network create a box with rigid body.
    on both separate apps. The end result is different when they collide.
    Shouldn't they be the same?
    How do you test a server/client situation on one computer when the app has to be in focus to see the the realtime results?
     
  2. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    By calling Edit / Project Settings / Player, you get a list of settings in the inspector. There's one item "Run In Background". Make sure this is checked for networked games and servers ;-)
     
  3. shaun

    shaun

    Joined:
    Mar 23, 2007
    Posts:
    728
    One of the guys in our team has done a lot of networked physics dev in Unity, and from what I remember, PhysX in Unity is non-deterministic. This means given the same simulation inputs, the same output is not guaranteed. You probably need to consider synchronizing the simulation state using the server.

    Have a read of this, it's a great article on Networked Physics for Mercenaries 2.
    http://www.gaffer.org/archives/gdc-slides-released#more-83