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.

interacting with multiple users

Discussion in 'Multiplayer' started by MrBodean, Apr 7, 2009.

  1. MrBodean

    MrBodean

    Joined:
    Jan 25, 2008
    Posts:
    103
    Ok guys, maybe someone hear can answer me this?

    In one of our scenes, we have a beach ball. We are trying to figure out how we can have it in the scene, so when one user kicks the ball it reacts using physics to bounce, then another user kicks it , etc.

    With the way it is now, we are getting too much of a delay using unity and smartfox.

    Do you think something like this will be possible to pull off in unity and smartfox, or are we just beating a dead horse?

    Any suggestions?

    Jeff
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    This is something that without smart handling will not work out with anything actually.
    Networked physics is a complex to deadend scenario, depending on how accurate it is meant to be.

    also SFS is TCP, thats 100ms++ latency wise.

    What I would recommend is either write an extension that allows you to communicate through UDP or use SFS as matchmaking and lobby system and use Unity Networking (low latency raknet) for the actual game networking.

    The later is clearly the simpler one.
     
  3. MrBodean

    MrBodean

    Joined:
    Jan 25, 2008
    Posts:
    103
    Yeah, that is what we thought, but just wanted to ask, in case we were missing something obvious...

    Thanks,
    Jeff
     
  4. duke

    duke

    Joined:
    Jan 10, 2007
    Posts:
    763
    Not having done any of this - what's wrong with clientside calculations, and serverside recording of its hitpoints. ie. whenever the ball hits the ground, the position is sent to server->other clients.
     
  5. Tempest

    Tempest

    Joined:
    Dec 10, 2008
    Posts:
    1,286
    The client should (ideally) never do any calculations, because the client is in the hands of the players. If you allow an application to do the calculations and only send results, then there is nothing stopping someone from hacking your application and changing stuff around (how fast their character moves, how hard he hits the ball, etc).

    The client should just be a visual display, like a television. It should record input, and send that input to the server to be interpreted, but the client itself should never do anything aside from that.
     
  6. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Movement input and alike potentially can be processed on the client and verified on the server afterwards (with correction enforcements if required).

    But stuff that affects other players, as Tempest already pointed out, must never be calculated on the client unless you don't care about the problems you will get for sure.
    Or one should say: must never be calculated by one client.
    What you can do is outsource it to the client but have a second and potentially third client verifying the results for the server.

    the main reason to do the calc on the server is that you have far less latency in the verification. Also the server is the central point for all network interpolation and extrapolation and in most games, the hosting party is the "single point of truth".