Smooth MultiPlayer movement

我的梦境 提交于 2019-12-05 09:23:34
ssmir

I'd suggest the idea from another question (see the accepted answer)

Here the client calculates its position itself as if its not a network game. Client regularly sends his current position to the server. And if client cheats or can't continue moving in the chosen direction, server just sends the client his correct position.

The same algorithm was used in Ultima Online (at least when I was playing it 10 years ago)

Read Valve's description of their multiplayer protocol. It should be instructive, and gives a very clear example on how you do the prediction/interpolation.

I solved it by running a ghost entity alongside with my main one.
The ghost will get updated every frame aswell, but whenever a packet comes in, his values are set to the values of the packet.

I then gradually tweak the real entity to where the ghost is.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!