Sunday, January 6, 2013

Unity Networking is easy? part -2-





For a FPS-like game, a good networking implementation need to have few points:
[It`s a summary of  a article on HalfLife networking]

Client-side
  • Client-predication - user input cause immediate change in the game , but can be fixed later in the server overrides it.
  • Interpolation - always add a delay of ~100ms to all other-users. Even if their ping is really small. Thus when you draw their location you will interpolate real, past positions with the exact positions.
  • Extrapolation - on in the case of severe latency problems, the interpolation delay may not be enough and you simply don`t know where the user is right now.  Here you extrapolate future location from the last known ones, but as with any extrapolation, it`s not accurate.

 Server-side:
  • State calculations and communications.
  • lag compensation - if you trust client shooting-report, no need for this.
    If you don`t and you want to prevent this type of cheating, you will need to get the shooting direction and calculate hits yourself.  As the client is running in old-time, you will need to "re-wind" the players positions and calculate the hit in the old times.







No comments: