Search Unity

My doubts about Unity Networking. Please Help!

Discussion in 'Multiplayer' started by Red_Kay, Feb 28, 2016.

  1. Red_Kay

    Red_Kay

    Joined:
    Aug 14, 2015
    Posts:
    94
    Yo!

    So I have already made 2 games with Photon networking and know some UNET HLAPI, but hate the way you implement stuffs in HLAPI (photon feels practical). And that's why I started with UNET's LLAPI I learned if stuff from here and there and was able to send a string to the server. I feel UNET's LLAPI is more practical and easy to understand for me (at least till now) and would like to learn it more. So I made this thread for doubts about LLAPI and a good source to learn it from.

    Note: Please don't give links to unity's manual I have already tried it and I didn't understand any of the stuff. I learned all stuff that I know about LLAPI from here :

    1) http://forum.unity3d.com/threads/llapi-how-to-send-data-to-clients.382908/
    2) http://www.robotmonkeybrain.com/good-enough-guide-to-unitys-unet-transport-layer-llapi/

    *Problem*
    I have client which sends some data to the server I want that data to be sent to other clients. How should I do that ? Please help!

    I'll post more doubts down below!

    Please help me to learn it!
     
    Last edited: Feb 28, 2016
  2. DRRosen3

    DRRosen3

    Joined:
    Jan 30, 2014
    Posts:
    683
    To answer your problem... Commands and ClientRpcs.
    For the client to send data to the server, call a Command.
    Then for the server to send data to clients call a ClientRpc (or you can use SyncVars or SyncLists depending on the data).
     
  3. Red_Kay

    Red_Kay

    Joined:
    Aug 14, 2015
    Posts:
    94
    I suppose that's only in Unity's HLAPI? I want to do with LLAPI. Can just show me a simple code, please?

    Like how do I call that RPC then on server (and for client too)?
     
  4. Red_Kay

    Red_Kay

    Joined:
    Aug 14, 2015
    Posts:
    94
    My new doubt.

    Code (CSharp):
    1. clientPort = 1111;
    2.  
    3. NetworkTransport.StartBroadcastDiscovery(hostId, clientPort, key, version, subVersion, buffer, bufferSize, timeout, out error);
    That code just broadcasts the message just to the clientPort (which is to only one client, as 2 clients on the same server with same port does not seem to work). I want to broadcast my message to al the clients from the server. How do I do that?