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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Server side enemies?

Discussion in 'Multiplayer' started by Royall, Apr 7, 2014.

  1. Royall

    Royall

    Joined:
    Jun 15, 2013
    Posts:
    118
    Hi there,

    I hope someone can help me out with this. I am making a little multiplayer rpg with a dedicated server. Players move along with a navmesh agent and a point and click system. I only want to use Unity networking.

    Problem is I want to make server side enemies, but how does my server know where enemies can walk and where not?
    Is it possible to share the navmesh of every scene with the server so the server can use it for navigation? Any other possibilities?

    Thanks in advance!
     
  2. DWORD

    DWORD

    Joined:
    Jun 22, 2010
    Posts:
    38
    If you are using Unity Networking the server knows everything (since it's running within the engine), so you only need to send their information to the clients.

    PS. If I remember correctly, authoritative servers are not possible with Unity's built-in network system. You may have to build your own server/client stuff using sockets or use a third party library.
     
    Last edited: Apr 7, 2014
  3. Royall

    Royall

    Joined:
    Jun 15, 2013
    Posts:
    118
    I don't use the networking sync functions... Only RPC calls since it's better to keep the network load low...
     
  4. DWORD

    DWORD

    Joined:
    Jun 22, 2010
    Posts:
    38
    Even using RPCs it's does not work (unless they fixed it, which I would be surprised). The clients can still send RPCs to other clients. But I need confirmation on that, since I haven't used the built-in networking in a long time.

    The uLink follows the same paradigm and syntax as Unity's built-in system, but works properly and it's way more capable (it's paid, but only after you ship the game).
     
  5. Royall

    Royall

    Joined:
    Jun 15, 2013
    Posts:
    118
    What do you mean it does not work? Whats wrong with RPC?

    And do you know if it is possible to share 1 navmesh between 2 projects? client/server
     
  6. DWORD

    DWORD

    Joined:
    Jun 22, 2010
    Posts:
    38
    There is no "sharing" if you are creating a authoritative server. The pathfinder only needs to run on the server or you will see some serious desync (without proper treatment, which can be troublesome).

    If you want to have navmesh on both (client and server), just create two scenes with the same geometry, occlusion data and navmesh but one scene with objects/scripts specific to the client and the other one with objects/scripts specific to the server. But if you don't want two scenes, then everything must be handled by a object/script that will instantiate/setup the necessary stuff during runtime.

    RPCs on the unity built-in system are (or were) not "safe" to create authoritative servers.
     
    Last edited: Apr 8, 2014