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. Dismiss Notice

UNET local client on server, host advantage using client side prediction

Discussion in 'UNet' started by Ralkarin_, Jan 4, 2016.

  1. Ralkarin_

    Ralkarin_

    Joined:
    Nov 15, 2010
    Posts:
    17
    So, this is more of a theory question than an implementation question.

    1 of UNETs big claims is that the local client on the server will function the same as any remote client. I'm having concerns/issues with the local client on an authoritative server related to client side prediction and processing user input for this player.

    In a multiplayer game in Unity, using UNET, if a player is hosting a game, they are both a local client and the server and they shared the objects in the scene.

    Assuming you wanted an authoritative server using client side prediction and server reconciliation for the clients, how do you handle the server's client?

    I was trying to also use a server fixed timestep for updating the game state as discussed in this article (http://www.gabrielgambetta.com/fpm3.html), so remote client input is actually queued up for the server to process at fixed intervals.

    The trouble I have is with the server's local client and client-side prediction. I can't use client-side prediction because the server shares the same game object as the server. Client side prediction would actually update the server object directly because they are the same object. So is it appropriate to simply let the server's local client update the server object directly on input without being buffered for the server to process? Doesn't that give the host a huge advantage?

    The only other option I can think of is to structure the game so that it DEMANDS a dedicated server and the host must connect as a remote client, or give the host a huge advantage.

    Thanks in advance!
     
  2. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,731
    I'm pretty certain this is always going to be the case where you have a combined client/server host, unless you are all playing over a LAN where latency is practically zero, the host will always have zero latency and the remote clients will have whatever latency their connection causes.

    I assume that it should be possible to fake some kind of latency on the host, but I've no idea how this might be implemented and integrated with the client side prediction system.
     
    Last edited: Jan 4, 2016
  3. Ralkarin_

    Ralkarin_

    Joined:
    Nov 15, 2010
    Posts:
    17
    Ok, that helps affirm that it's not uncommon for the mixed client/server environment to be in this situation. If I really want all clients to run on the same input lag processing, I'll run them with a dedicated server.

    I guess I wanted to make sure I was on the right track. Thanks for your input Munchy!