多人游戏子弹计算
问题描述:
通过某种网络运行的多人游戏,游戏中很少有玩家互相射击,子弹的飞行速度不是即时的,慢到你可以看到它们。
问题:
谁应该计算飞行子弹的位置和击中目标(对手玩家)的服务器或客户端?
到目前为止我想到的最佳解决方案:
客户端向服务器发送子弹初始位置和方向向量。然后服务器计算子弹的位置和命中率。
还考虑了与精确的服务器时间同步并将数字发送到客户端(子弹初始位置、方向矢量和时间),然后客户端计算命中。但问题存在 - 服务器和客户端时间不匹配。
请解释或直接阅读一些相关文章/书籍。
Problem Description:
Multi-player Game that works over the some kind of network, in game few players shoot each other, bullets are are flying with not instant speed, slowly enough that you can see them.
Question:
Who should calculate the flying bullet position and hits on target (opponent player) Server or Client?
Best Solution i thought of so far:
Client sends to Server bullet initial location and direction vector. Then Server calculates the bullet positioning and hits.
Also had some thought about synchronising with exact server time and send figures to client(bullet init position, direction vector and time) then client calculates the hits. But problem exists - what is server and client time doesn't match.
Please Explain or Direct to some relevant article/book.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您要寻找的内容有点模糊,但希望我能为您指出正确的方向。
这些文章对在游戏中创建网络多人游戏的许多方面进行了非常不错的描述。
看来您主要陷入了在权威服务器模型或非权威服务器模型之间做出决定的困境。我不确定您使用的是什么语言或开发环境,但是 Unity 3D 提供了非常好的 每种模型的概述,以及它们可能有哪些优点/缺点。
希望这有帮助:)
What you're looking for is a little vague, but hopefully I can point you in the right direction.
These articles give a very decent description of the many aspects of creating networked multiplayer in games.
It seems that you're primarily stuck with a decision between an Authoritative or a Non-Authoritative Server model. I'm not sure what language or development environment you're using, but Unity 3D gives a very good overview of each model, and what benefits/drawbacks they might have.
Hope this helps :)