Search Unity

Non rigid-body authoritative unet character controller

Discussion in 'UNet' started by lucasmontec, Jan 15, 2016.

  1. lucasmontec

    lucasmontec

    Joined:
    Apr 7, 2015
    Posts:
    97
    Hi unity folk! How are you today?
    We (Brazilian dev team) are developing a first person, server-authoritative movement script using UNET and the Unity's First Person Character Controller (The standart one). We are using this amazing article as reference, "Fast-Paced Multiplayer" by Gabriel Gambetta: http://www.gabrielgambetta.com/fast_paced_multiplayer.html.

    Basically, what we tried to do is to store the position in the server (authoritative). We apply local movement to the player (prediction) and when the server message comes back we apply the server position and all inputs pressed after that time (reconciliation). After that, the player should be in the same position he was before and the official position is still on the server.

    For dummy players (what we call non local authority players) that are mere displays of the player object on other machines, we just broadcast the server position and apply a local reconciliation (Last time I checked the script this was still planned, we were fixing the reconciliation first).

    Mainly we are trying to achive results like the source engine with eye-twitch movement but still with authoritative positioning. Source engine's positioning also vows for latency solutions, that is why we apply both prediction and reconciliation. Even under some heavy latency this code should work.

    We are having some problems with the results of our code though. There is always some tiny difference between the calculated position of the client and the server after reconciliation. We are looking to get some suggestions about what can we do to make the movement smoother and perfectly precise so we are going to share the script so that you guys can help us achieve this together and the whole community can use this =).
     

    Attached Files:

  2. lucasmontec

    lucasmontec

    Joined:
    Apr 7, 2015
    Posts:
    97
    Also, I know about Gena's controller, but that one is based on a collider controller and we don't want that.
     
    Last edited: Jan 18, 2016
  3. RaRdq

    RaRdq

    Joined:
    Dec 18, 2015
    Posts:
    2
    Im having an issue with rotation... server dont recieve it, only player rotates when moving mouse.I have only WBFPC script and Character Controler. Camera is a child of this object... Am I doing smth wrong?
     
  4. lucasmontec

    lucasmontec

    Joined:
    Apr 7, 2015
    Posts:
    97
    Sorry for the delay answering! I've been working way too much. We moved this part of our project to github. We havent solved all the problems yet but there's been many updates since this version. We added strafing and we keep the character velocity while jumping. The code now has many debug features. There seems to be a problem with different computers that generate more or less errors.


    You can view it at: https://github.com/InVoid-Games/UnetCharacterController
     
  5. imgodot

    imgodot

    Joined:
    Nov 29, 2013
    Posts:
    212
    Lucas,
    Just downloaded your project and, from what little I know about UNET, it looks pretty thorough.
    I have actually been looking for a UNET rigidbody character controller and yours certainly seems to fit the bill.

    The only fly in the ointment is that, when I run the compiled project, the client does not see the server's rotation.
    I tried running the host and LAN client on one PC and on two separate PCs and the results were the same.

    Have you seen this issue before in your testing?
    Is there a solution?

    -- Paul
     
  6. lucasmontec

    lucasmontec

    Joined:
    Apr 7, 2015
    Posts:
    97
    Sorry about this. We eventually had to close source. I haven't read here since. really sorry. Sorry about the dealy answering.