Search Unity

How to work with dedicated server

Discussion in 'Multiplayer' started by Night974, May 6, 2017.

  1. Night974

    Night974

    Joined:
    Jun 19, 2016
    Posts:
    1
    Hi guys,
    i'm looking for a way to make a dedicated authoritative server, i already worked with socket.io but i'm not sure about the security..
    I'm actually looking for the UNET and HLAPI, i want to use a totally different code between client and server and i'm not sure it's possible with RPC and COMMAND (or maybe can you help me to use it?), maybe the best way to do it is to use messages ... I'm not enought documented..
    Do you have any link for me guys about the best way to do it or any exemples?

    Thanks
     
  2. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,315
  3. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    This can absolutley be done with Command and RPC. If you want different code base for client and server you could do it in separate projects. But if you want it in one project but hide server code from client and virse versa I would go for Conditional Compiling. Command calls would look like this
    void Cmd_MyCommand()
    {
    #if SERVER
    //Server logic
    #endif
    }
    And #if CLIENT on the client code. Then when compiling you define your compile conditions in Player Settings.
     
    BouncedPhysical likes this.