Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Authoritative server (SFS): how to handle physics/collision?

Discussion in 'Multiplayer' started by thecreatrix, Apr 10, 2009.

  1. thecreatrix

    thecreatrix

    Joined:
    Dec 19, 2008
    Posts:
    94
    I want to start experimenting with SmartFox Server and Unity for a very small test to get my multiplayer feet wet. I've done some server coding in the past (with SFS), but it was with a Flash client, and my world representation was a 2d tilemap on the server.

    So my biggest brain hurdle at the moment is how do you handle world representation/interaction on the server when the world is 3d geometry? Who does collision testing? What about triggers? What about gravity?

    If it's client side, how can the server verify that it's correct? If it's server side, how should it be implemented? Will I have to use a Java version of PhysX or is there something really obvious and simple that I'm missing? :)

    I really only want simple gravity and collision testing. I don't need full networked physics.

    Any thoughts on these matters will be humbly and gratefully received.
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    gravitity / triggers: both is simple math that can be replicated within an extension without problem. the gravitation thought mainly would be applied for verification, general gravitation / movement should be handled by the client with corrections only beeing enforced if the data are not correct within given error bounds.

    for real collision you will thought have do invest a significant larger amount of work (including asset exportation from unity editor to a suitable format for the server).
    One way are connected server based unity clients that do the collision, or using the clients for some basic checking and verification.
    another way is connecting the server to collision nodes written in C++ that do nothing else than that collision and are running on the server. Lets call that physics layer.

    using physx for that purpose might reduce the amount of work for you to a very small number.

    the server side collision is a mid to long term requirement as AI is near impossible without the low lantency collision, as you need the data for path finding and decision making.
     
  3. thecreatrix

    thecreatrix

    Joined:
    Dec 19, 2008
    Posts:
    94
    Cool, thanks for the info, dreamora.

    There is a Java port of PhysX, so maybe I will look into getting that running alongside SmartFox.

    If anyone has solved this problem in a working demo/game using Unity, I'd love to hear from you. :)