Search Unity

Server Authoritative Player via NetworkTransform

Discussion in 'Multiplayer' started by U-GeeN, Jul 27, 2016.

  1. U-GeeN

    U-GeeN

    Joined:
    Mar 22, 2015
    Posts:
    95
    Is it a good idea to make a player with Server authorization via Networktransform? I.e. set “Server Only” bool in Network transform to true?

    The PlayerControl script has a
    [Command] CmdSetMove() - that sets the motion parameters from input and
    [Server] Move() - function which calculates the motion on server.

    The NetworkTransform seems to sync the position just fine but are there some consequences I’m missing?
     
  2. Severos

    Severos

    Joined:
    Oct 2, 2015
    Posts:
    181
    Far as I'm aware, NetworkTransform sync the transform from client with authority to server, and then from server to other clients.
    Your current approach seems good for now, but if NetworkTransform works the way I understand it, then if someone hacked your game he can manipulate the position and server will not be able to detect it since it only synchronize without validation.
     
  3. U-GeeN

    U-GeeN

    Joined:
    Mar 22, 2015
    Posts:
    95
    Ok, thanks for clarifying.
    I noticed that when NetworkIdentitys' Server Only is checked no client functions are executed.
    Is this correct?
    So I'd like to skip that client to server sync that NetworkTransform does and do it manually.
    by sending a Vector3. Server then normalizes it and calculates movement.
    Then NetworkTransform needs to sync it back to Clients.
    So even if someone hacks in he could only control that Vector3 which comes directly from input, right?
    And what would be the difference if nothing on NetworkIdentity is checked?