Properly Interpolating Between Server State Updates | Unity Multiplayer Game Devlog #24
Multiplayer Pirate Game Devlogs EP 8 01/26/20In this Unity multiplayer game devlog, I decide to come back to the subject …
Show MoreIn this Unity multiplayer game devlog, I decide to come back to the subject of interpolation and implement it properly.
Next devlog: https://youtu.be/ha1H8rsgbk8
Pirate game playlist: https://www.youtube.com/playlist?list=PLXkn83W0QkfmQI9lUzi--TxJaOFYIN7Q4
⎯⎯⎯⎯⎯⎯
Discord server: https://tomweiland.net/discord
Support me on GitHub Sponsors: https://github.com/sponsors/tom-weiland
Support me on Ko-fi: https://tomweiland.net/kofi
GitHub: https://tomweiland.net/github
Project's Trello board: https://trello.com/b/vJwk0iwS/pirate-game
Website: https://tomweiland.net/
⎯⎯⎯⎯⎯⎯
Properly interpolating between server state updates can get surprisingly messy. Since clients can't always accurately predict the movement of objects, many games actually display the state of the world from a short time ago. This allows clients to show the game almost as if it were a movie—the client already knows what will happen before it does, and therefore can display it to the player with much better accuracy.
The first time I tackled interpolation, all I did was make the client lerp between the state updates it received from the server—no timing involved. This works fine when I connect on from the same computer which the server is running on since there's almost no latency in that case, but if packets are delayed, the client ends up simply extrapolating the previous movement because it doesn't know what else to do. That's not the end of the world in many cases, but especially when it comes to players in fast-paced games, showing movement precisely is pretty important, so I finally decided to take care of interpolation the proper way.
#Devlog #GameDev #IndieDev #Multiplayer #Unity3D
"Interplanetary Forest" by Meydän is licensed under a Creative Commons Attribution license (https://creativecommons.org/licenses/by/4.0/)
Artist: https://soundcloud.com/meydansound