geckosio / snapshot-interpolation

A Snapshot Interpolation library for Real-Time Multiplayer Games.
BSD 3-Clause "New" or "Revised" License
277 stars 25 forks source link

The sync object shakes slightly at the end of the movement #16

Open wyattzheng opened 2 years ago

wyattzheng commented 2 years ago

thanks for creating this project which guide me to learn about client-side prediction & server reconciliation & snapshot-interpolation. I read the source code and know that it is a time-based sync system.

when I run the example the object player controlled shakes slightly at the end of the movement. it behave not that perfect. is there any way to solve this problem?

j4n7 commented 2 years ago

Hi, as far as I now, that behaviour is expected and is not cosidered a "problem". In the example, that happens during server reconciliation, the client moves slightly till it matches the server position. Probably there is another way of handling server reconcilitation, but I don't know how. Depending on the game you are working on, this slight movement can be a problem.

I'm working on an Open Source Game with Phaser, trying to implmente Geckos and Snapshot Interpolation, but I'm struggling with this and collisions. You can check the code (a little bit messy) here:

Source code

wyattzheng commented 2 years ago

Thanks for that! after I created the issue, I found the solution.

re-apply inputs and try to interpolate the movement to the final state the inputs re-applied. it behave very well.

I am also working on a multi-player HTML5 game, you can check my code of this part. https://github.com/uni-js/universe.

Thanks for sharing your experience, hope my experience helps.