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

Authoritative Server Handling VS Client Handling

Discussion in 'Game Design' started by FL4W, Dec 14, 2019.

  1. FL4W

    FL4W

    Joined:
    Apr 17, 2016
    Posts:
    3
    I know that you do not want to trust client calculations/input so are physics, collisions, etc all generally server end and will it be costly on the server? Assuming I can properly validate player provided data (unreachable speeds are thrown out, teleport players out of unreachable locations, etc), are there any downsides to calculating player position and collision detection on the client's end?
     
  2. Steve_Stevens

    Steve_Stevens

    Joined:
    May 3, 2016
    Posts:
    35
    My thought on it is no. I feel when your client sends it's location data, it's asking for permission to move to that location. Since you are going to provide a sanity check on any data sent to the server, I don't think it's unreasonable to ask the client to do the calculations and the server just verify that from the last time the client provided data to this time, it's within an acceptable range. I like to track how many times one client provides false data and just disconnect them.
     
    Ohilo and Socrates like this.
  3. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,531
    Gaffer On Games' What Every Programmer Needs To Know About Game Networking is an older article but still one of the best. You'll eventually need to do physics validation on the server; there's no getting around it for something that's server-authoritative. But you can offload some initial work on the client and get smoother performance with things like client-side prediction.
     
    Joe-Censored likes this.
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    The biggest downside is the possibility of cheating. You can add validation, but if your game is popular enough there will still be cheating which escapes your validation. If your game is popular enough, you're likely to have money rolling in where you can address these problems though. So I wouldn't worry too much about it.
     
    Socrates likes this.