Search Unity

Can both client and server send?

Discussion in 'Multiplayer' started by Sync1B, Mar 8, 2008.

  1. Sync1B

    Sync1B

    Joined:
    Sep 13, 2005
    Posts:
    561
    I would like both the server and client to send and receive info during OnSerializeNetowrkView. What I want do to is send input from the client, process on the server and send transform back to the client. Can you only write on the owner of the network view? Can the client and server both own a network view?

    If not would I have to use one network view to send Input which is owned by the player and another network view to send transform info back owned by the server?

    Bill
     
  2. larus

    larus

    Unity Technologies

    Joined:
    Oct 12, 2007
    Posts:
    280
    Two parties cannot own the same network view. They would end up overwriting each others values resulting in very choppy and useless synchronization.

    Yes, that what you need to do. You can attach two network views to the same game object. Then attach the network views to the two scripts, one sending user input and one receiving the transform. When you instantiate the object you need to make the client ask the server (through an RPC) to generate a server view ID and send it to him. Then it can be assigned to one of the network views and thus it is owned by the server. Or something like that. This is actually done in the networking example project, in the TPS-Auth scene.
     
  3. Sync1B

    Sync1B

    Joined:
    Sep 13, 2005
    Posts:
    561
    Being some one who has never done networking before the networking examples can be extremly complicated even with comments. This is at least my expience with them. Are there any plans to do some networking tutorial? I think a tutorial would be much more helpful, seeing how things are built up from the very start. I also realize it might be hard to make a tutorial to cover a wide amount of game types, if some thing would be nice.

    Bill