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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Snapshot Interpolation with client side prediction

Discussion in 'Multiplayer' started by tommohawkaction, Sep 3, 2018.

  1. tommohawkaction

    tommohawkaction

    Joined:
    May 20, 2017
    Posts:
    27
    Hello, I have been studying Networked physics for my game and have stumbled upon multiple ways of handling it, one being Snapshot Interpolation as describe in this article https://gafferongames.com/post/snapshot_interpolation/

    For the most part I can get it working

    However it is all good if your not controlling the player but if you are then there is latency issues. One way I've heard about solving this is client side prediction which is sweet, but it comes with another problem which is making the interpolated entities mingle with the player controlled entities during its update step, as entities are not being simulated on both machines only the server and is interpolated on the clients machine, only the player is being simulated on both because of client side prediction.

    How would I solve this, or is there another solution to this sort is thing?

    I did find this but I wasn't sure what the user was on able :/
    https://gamedev.stackexchange.com/q...on-responsiveness-due-to-client-interpolation

    As a side note: I'm trying to make something similar to this


    Thanks :)
     
  2. Driiade

    Driiade

    Joined:
    Nov 21, 2017
    Posts:
    80
    Hey, I have this for client side prediction : https://forum.unity.com/threads/unet-hlapi-ext.508607/ Look all component "Sycnhronizer" (like TransformSynchronizer.

    But it's not cheat proof. I only play client locally, client send position/rotation to server, and server update these data to others clients. For cheat proof method you need to send relevant data for your game to the server. The server simulate the next client position. Then Server send back the new client position and state only if there is a big difference between the 2 computers.

    Client store input state, receive server correction and replay state. The easier input data to send are position/rotation/velocity, but hey it's not cheat proof again ! You need to check if these data are possibles in your game.

    Because it's HARD and can't be done generic for every game (imagine one have teleportation, other have dash etc..). I did not implemented this.
     
  3. tommohawkaction

    tommohawkaction

    Joined:
    May 20, 2017
    Posts:
    27
    Hello, thanks for responding.
    I'm not sure I understand, does this work for pushing rididbodies around?
     
  4. tommohawkaction

    tommohawkaction

    Joined:
    May 20, 2017
    Posts:
    27
    Just been trying to simulate it using State Synchronization which is a bit jittery at the moment but once I put in a jitter buffer as well as a input buffer it should be basically there. The only thing is, its not cheat proof
     
  5. saltyJeff

    saltyJeff

    Joined:
    Mar 29, 2014
    Posts:
    7
  6. Driiade

    Driiade

    Joined:
    Nov 21, 2017
    Posts:
    80
    Hello, my solution doesn't work very well for pushing rigidbody.

    You need a more sophisticated approach for that, like prediction/correction.
    Mine is good for character controled by an user (which can't be predited by physics or whatever).