客户端预测和服务器对帐 [英] Client-side prediction & server reconciliation

查看:106
本文介绍了客户端预测和服务器对帐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了一些有关客户端预测和服务器对帐的文章,但是我缺少一些内容,我参与了客户端预测的一部分,但是我不了解对帐的完成方式。我将这两篇著名的文章作为参考:

I’ve read some articles about client-side prediction and server reconciliation but I'm missing some parts, I take the part of client side prediction but I don’t understand how exactly is reconciliation done. I’ll take these two pieces of well-known articles as reference:

http://www.gabrielgambetta.com/fpm2.html


#2。因此,再次应用客户端预测,客户端可以根据服务器发送的最后一个权威状态加上服务器尚未处理的输入来计算游戏的当前状态

#2. So applying client-side prediction again, the client can calculate the "present" state of the game based on the last authoritative state sent by the server, plus the inputs the server hasn’t processed yet

http://gafferongames.com/networking-for-game-programmers/what-every-programmer-needs-to-know-about-game-networking/


实际上,客户端在保持世界其他地方固定的情况下,无形地倒带并重播了本地玩家角色移动的最后n帧

In effect the client invisibly "rewinds and replays" the last n frames of local player character movement while holding the rest of the world fixed

好吧,我认为客户端从服务器收到了确认,但是输入是如何重新应用的呢?我可以用两种方式解释。

Ok, I take that the client receives an acknowledgement from the server, but how exactly are the inputs re-applied? I can interpret this in two ways.

从客户端的角度来看,游戏循环每秒执行 x次(每秒帧)

From the client point of view, where the game loop is executed ‘x’ times per second (frames per second)

首先:未处理的输入会在同一帧中重新应用,因此此处的隐式回放和重播非常适合,因为在

First: The non-processed inputs are re-applied in the same frame, so here the expression "invisibly rewind and replay " fits perfect because in the end what you see in the screen is the result for the last input re-applied.

我看不到这样做的好处,因为我发现重新输入之间没有区别-将服务器更新的最后n个输入应用于当前时间,并保持客户端状态为更新前的状态,我们预先知道结果将是相同的。

I don’t see the benefit of doing this because I see no difference between re-applying the last n inputs from the server update to the present time and keeping the client state as it was before the update, we know in advance that the result will be the same.

第二:在连续的帧中,输入被一一重新应用。人类无法注意到正在重放的几帧,但是我不禁想到,如果客户端遇到显着的延迟,他可能会注意到自己回到过去并重放最后的 n帧。

Second: The inputs are re-applied one by one in the consecutive frames . A human being couldn’t notice a few frames being replayed but I cannot help thinking that if the client were experiencing significant latency he could notice himself going back to the past and replaying the last ‘n’ frames.

有人可以指出我的正确方向吗?谢谢

Can anyone point me in the right direction , please? Thanks

推荐答案

我知道距您发布此问题已经有一段时间了,但是它已经出现在Google的供稿中,所以我

I know it's been quite a while since you've posted this question, but it is on google's feed, so I'll answer.


我看不到这样做的好处,因为我发现重新申请服务器的最后n个输入更新到
当前时间,并保持客户端状态为更新前的状态,
我们事先知道结果将是相同的。

I don’t see the benefit of doing this because I see no difference between re-applying the last n inputs from the server update to the present time and keeping the client state as it was before the update, we know in advance that the result will be the same.

对帐的全部目的是与服务器同步。我们真的不知道我们的行动将会是什么。我们只是预测它。有时结果实际上是不同的,我们仍然想获得服务器上正在发生的情况的图像。

The whole point of reconciliation is to sync with the server. We don't really know what the result of our actions will be. We just predict it. Sometimes the result actually is different and we still want to get an image of what's going on on the server.

第一种方法肯定是正确的方法。

第二种方法实际上没有任何意义。请记住,播放器会定期接收更新。这意味着在200毫秒的等待时间中,他将一直在过去200毫秒内看到自己的角色。

The second way doesn't really make any sense. Remember that the player receives updates on a regular basis. That means that with a latency of 200 ms he will see his character about 200 ms in past all the time.

这篇关于客户端预测和服务器对帐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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