使用 Juggernaut 同步客户端计时器时处理延迟
我需要为梦幻体育网站实施申请草案。每个用户将有 1 分 30 秒的时间来选择其团队中的一名球员,如果该时间已过,则会自动选择该球员。我们计划的实施将使用 Juggernaut 将回合更改推送给参与选秀的每个用户。但我仍然不确定如何处理延迟。
这里的主要问题是,如果用户的延迟比其他人更高,他将稍后收到回合更改,并且他的计时器将不会同步。假设某人在自己选择一名球员后收到了轮换,而他认为自己还剩 2 秒,我们该如何处理这种情况?尝试测量每个用户的延迟并调整客户端计时器以最大程度地减少该问题是否更好?如果是这样,我们该如何实施呢?
I need to implement a draft application for a fantasy sports website. Each users will have 1m30 to choose a player on its team and if that time has elapsed it will be selected automatically. Our planned implementation will use Juggernaut to push the turn changes to each user participating in the draft. But I'm still not sure about how to handle latency.
The main issue here is if a user got a higher latency than the others, he will receive the turn changes a little bit later and his timer won't be synchronized. Say someone receive a turn change after choosing a player himself while on his side he think he still got 2 seconds left, how can we handle that case? Is it better to try to measure each user latency and adjust the client-side timer to minimize that issue? If so, how could we implement that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个棘手的问题,但有一些很好的解决方案。了解 time.gov 做什么以及如何做;本质上,据我了解,他们使用 Java 对服务器执行多个重复请求,试图了解通信中涉及的延迟,然后生成延迟度量,用于扭曲返回的时间数据。您可以在您的申请中使用相同的流程,甚至更加准确;跟踪延迟是什么以及它如何随时间变化可以让您对延迟数字的可靠性等做出一些统计推断。它可能有点复杂,但它绝对可以让您平滑性能。我的理解是,这也是大多数 MMO 游戏所做的,以管理延迟。
This is a tricky issue, but there are some good solutions out there. Look into what time.gov does, and how it does it; essentially, as I understand it, they use Java to perform multiple repeated requests to the server, to attempt to get an idea of the latency involved in the communication, then they generate a measure of latency that they use to skew the returned time data. You could use the same process for your application, with even more accuracy; keeping track of what the latency is and how it varies over time lets you make some statistical inferences about how reliable your latency numbers are, etc. It can be a bit complex, but it can definitely allow you to smooth out your performance. My understanding is that this is what most MMOs do as well, to manage lag.