流畅的MultiPlayer运动 [英] Smooth MultiPlayer movement

查看:149
本文介绍了流畅的MultiPlayer运动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一款多人角色扮演游戏,(不,它不是mmorpg.)

i am developing a multiplayer roleplaying game, (No, its not a mmorpg. ;)

我当前的设置是这样的.

My current setup is like this.

客户告诉服务器我想向前移动"/我想向后移动",然后服务器更新您的实体,并通知该区域中的所有客户有关更改的信息.服务器还将每20ms更新一次每个实体,并每100ms向客户端发送一次更新,这些更新包含位置,速度,旋转等.

Client tells the server "I want to move forward"/"I want to move backwards", the server then updates your entity, and informs all clients in the area about the change. The server is also updating each entity every 20ms and sending updates every 100ms to the clients, these updates contains position, velocity, rotation etc.

到目前为止,还不错,但是我没有什么可用来平滑客户端上数据包之间的移动的,我必须说,我无法使其正常工作.我一直在阅读预测,内插,死守,但对我来说却是一团糟.

So far so good, however i have nothing in store for smoothing the movement between the packets on the client side, and i must say, i can not get it working. I have been reading up on prediction, interpolation, deadreackoning but its all a big mess for me.

所以现在我只是在做类似"Position = Packet.Position"的动作,这会导致非常不稳定的动作.

So right now i am just doing something like "Position = Packet.Position", which causes a very stuttering movement.

所以,我需要帮助的是,我如何获得更平稳的运动?一直在查看XNA Prediction Sample,但我做对了.

So, what i want help with is, how do i get a more smooth movement? Have been looking at the XNA Prediction Sample, but i could not get it right.

感谢//F

推荐答案

我建议从

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.

Ultima Online中使用了相同的算法(至少在我10年前玩过该算法时)

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

这篇关于流畅的MultiPlayer运动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆