一款客户端 Minecraft 模组,可消除由服务器延迟导致的光照循环“橡皮筋”效应!
问题所在
每隔一秒(20 个刻),服务器都会发送一个数据包,用于同步客户端与服务器之间的世界时间。由于客户端无法获知服务器的刻速率,它们会假设服务器以标准的每秒 20 刻运行。因此,当服务器出现延迟时,处理这 20 个刻所需的时间会变长,导致客户端显示的阳光位置超前于服务器上的实际位置。当该同步数据包到达时,原版客户端会将阳光瞬间跳跃至服务器位置,从而产生本模组所要修复的问题。解决方案
采用滚动加权平均数和一些插值算法!首先,我们采集过去 10 秒内服务器每刻经过的刻数的样本。然后,由于 10 秒前的样本不如最近一秒钟内的样本相关性强,我们对每个样本赋予的权重随时间推移呈指数级递减。通过计算这个加权列表的平均值,我们可以有效地预测未来一秒内阳光的移动轨迹。虽然预测导致的阳光位置误差会有所波动,但与原版逻辑中出现的瞬间回跳相比,这种误差几乎不可察觉。未使用 Asahi 时:
使用 Asahi 时:
请注意,此 GIF 来自模组的早期版本,其中的插值算法此后已得到进一步优化!
Circular Sun 是 vanillatweaks.net 提供的资源包的一部分。
配置
{
// 如果从服务器接收到的时间与客户端时间的差值大于或等于 `skipDuration` 秒,
// 则直接跳转到服务器时间,绕过插值处理。
// 如果光照循环速度异常快,请尝试调整此值。
"skipDuration": 60,
// 在滚动平均插值中使用的先前样本数量。
// 如果你注意到阳光在没有稳定下来之前来回弹跳得很厉害,请尝试调整此值。
"interpolateSamples": 10,
// 初始状态下,游戏刻对应的日照循环刻数比率。
// 如果存在加速/减速日照循环的其他模组,请增加/减少此值。
"initialFactor": 1.0,
// 相对于日照循环分辨率的标准刻速率。
// 如果你正在游玩会改变标准刻速率或日照循环(24000 刻)分辨率的模组,请更改此值。
// 据我所知,目前没有模组会这样做。
"standardTickRate": 20
}
Client side Minecraft mod that removes daylight cycle rubber-banding caused by server lag!
The problem
Every second (20 ticks,) the server sends a packet that syncs the world time between the client and the server. Since clients have no reference for the tick rate of the server, they assume that the server is running at the standard 20 ticks per second. As such, when the server is lagging, that 20 ticks takes longer to process, leading the client to display the sun ahead of where it is on the server. When that sync packet comes in the vanilla client snaps the sun to the server position, causing the issue that this mod fixes.The solution
A rolling weighted average, and some interpolation! First, we take samples of the last 10 seconds of the amount of ticks that passed on the server per tick on the client. Then, since the sample from 10 seconds ago isn't as relevant as the sample in the last second, we weigh each of them exponentially less compared to the first. Taking the average of this weighted list, we can effectively predict the movement of the sun over the next second. The margin of error in the suns position caused by the prediction varies, but it is imperceptbile in comparison to the snap-back that happens with the vanilla logic.Without Asahi:
With Asahi:
Please note that this gif is from an earlier version of the mod, the interpolation used has only gotten better since!
Circular Sun is part of a resource pack provided by vanillatweaks.net
Config
{
// If the time received by the server is `skipDuration` or more seconds from the client time,
// skip to the server's time, bypassing interpolation.
// Play around with this value if the daylight cycle is absurdly fast.
"skipDuration": 60,
// Amount of prior factors to use in the rolling average interpolation.
// Play around with this value if you notice the sun bouncing back and forth a lot without settling into position.
"interpolateSamples": 10,
// Initial daylight cycle tick per game tick.
// Increase/decrease this value if another mod is present that speeds up/slows down the daylight cycle
"initialFactor": 1.0,
// The standard tick rate with relation to the resolution of the daylight cycle.
// Change if playing with mods that increase/decrease the standard tick rate OR the resolution of a daylight cycle (24000 ticks).
// Note that to my knowledge there are no mods that do this.
"standardTickRate": 20
}
下载 Asahi
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Asahi
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Asahi
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Asahi
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Asahi
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Asahi
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Asahi
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Asahi
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Asahi
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Asahi
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
- 更新至 26.1
- 移除“白天时间”时钟插值,所有刻进度现在由“游戏时间”刻跟踪器处理。
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
查看物品与配方
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
AE2:一款流行的自动化与存储模组
模组
一个基于构建器的 Minecraft 配置库!
评论 0
登录后参与评分
还没有评论,来抢沙发吧