多人游戏同步 [英] Multiplayer Game Synchronization

查看:137
本文介绍了多人游戏同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个客户端/服务器体系结构实现,所有的状态变化发送给函数,验证和广播到连接的所有客户端。这工作相当好,但系统不会维持游戏以现在的客户端实例之间的同步。

I've a server/client architecture implemented, where all state changes are sent to the function, validated and broadcasted to all clients connected. This works rather well, but the system does not maintain synchronization between the client instances of the game as of now.

如果那里恰巧服务器之间5秒的延迟和特定的客户端,然后他会就这样把客户留给他的比赛状态不同步,其余5秒后收到的状态变化。我一直在寻找实现客户端之间的同步系统,但还没有找到多少至今的各种方式。

If there happened to be a 5 second lag between the server and a particular client then he would receive the state change 5 seconds after the rest of the clients thus leaving him with game state out of sync. I've been searching for various ways to implement a synchronization system between the clients but haven't found much so far.

我是新的网络编程,而不是所以天真的以为我可以创造一个工作系统的自己不专的时间严重金额它。我一直有这些想法,但是,是保持某种时间系统,所以每个状态变化将连接到在游戏中特定的时间戳。当客户端收到了状态改变这种方式,它究竟会在游戏中发生改变的哪个时期都知道,并会反过来能为滞后相关。这种方法的问题是,在这些的 N 的秒滞后于游戏会继续在客户端,因此客户端将有及时回滚到更新为状态变化,这肯定会得到凌乱。

I'm new to network programming, and not so naive to think that I can invent a working system myself without dedicating a severe amount of time to it. The ideas I've been having, however, is to keep some kind of time system, so each state change would be connected to a specific timestamp in the game. That way when a client received a state change, it would know exactly in which period of the game the changed happened, and would in turn be able to correlate for the lag. The problem with this method is that in those n seconds lag the game would have had continued on the client side, and thus the client would have to rollback in time to update for the state change which definitely would get messy.

所以我在寻找论文的讨论,解决它的主题或算法。也许我的整体的多人游戏系统是如何工作的设计是有缺陷的,在这个意义上,除非从服务器接收观念客户端的游戏实例不应该更新?眼下只是客户更新自己在他们的游戏循环假设,任何国家都没有改变。

So I'm looking for papers discussion the subjects or algorithms that solves it. Perhaps my whole design of how the multiplayer system works is flawed, in the sense that a client's game instance shouldn't update unless notion is received from the server? Right now the clients just update themselves in their game loop assuming that any states haven't changed.

推荐答案

的基本方法这一些所谓的惯性导航以及关于它的相当不错的文章可以在这里找到。基本上它是哪里的实体位置将在服务器更新之间的时间被猜中的预测算法。

The basic approach to this is something called Dead Reckoning and a quite nice article about it can be found here. Basically it is a predication algorithm for where entities positions will be guessed at for the times between server updates.

有是建立在这个概念更先进的方法,但它是一个很好的起点。

There are more advanced methodologies that build on this concept, but it is a good starting point.

<小时/>

另外的如何在源引擎处理的说明(阀的发动机第一半条命游戏)都可以在这里找到 ,其原理基本上是相同的 - 直到服务器通知你,否则使用预测算法沿着预期的路径移动的实体 - 。但是这篇文章处理这对试图拍摄更深入的东西效果

Also a description of how this is handled in the source engine (Valve's engine for the first Half Life game) can be found here, the principle is basically the same - until the server tells you otherwise use a prediction algorithm to move the entity along an expected path - but this article handles the effect this has on trying to shoot something in more depth.

这篇关于多人游戏同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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