加速区块生成。移动时,优先处理位于玩家移动方向上的区块。服务器线程、自动保存、数据编解码以及区块的网络传输均已优化。
ChunkOpt 将区块工作移出服务器线程,并将其余部分分散到各个刻(tick)中执行。大多数路径都配有配置开关,推测性路径则回退至原版行为。
生成
原版在单线程的世界生成邮箱上运行六个生成步骤。ChunkOpt 将这些步骤发布到工作线程池。FEATURES 是唯一可以写入相邻区块的步骤,因此它采用 3x3 区块锁。
生成任务按距离排序,并为玩家的朝向添加少量奖励权重。这使得视野前方的区块先于后方生成。仅改变发布顺序,不改变地形数据。
在相同的 625 个区块上进行 A/B 配对测试,串行管道耗时 53.5 秒,并行版本耗时 13.2 秒。1,024 个区块的强制加载时间从 64.5 秒降至 17.0-20.5 秒。
加载与保存
区域文件读取时,区块调色板在工作线程上解码。服务器线程接收已完成的容器对象,而非自行解码。如果预解码的数据与精确的 NBT 标签不匹配,则运行原版路径。对于没有区域数据的区块重复读取,直接从内存响应,直到写入使该条目失效。
周期性自动保存每刻限制为 3 毫秒和 64 个区块。NBT 编码在 IO 线程池基于快照运行。/save-all 命令和关机仍会同步清空所有待保存内容,因此不会有异步编码操作遗留。
从磁盘加载 511 个区块时,主线程平均读取时间从 2.48-2.53 毫秒降低至 1.87 毫秒。对 1,024 个脏区块的一次自动保存过程分散在 9.5 秒内完成;最坏情况下额外增加的刻时间为 11.15 毫秒,超出 3 毫秒预算。
刻开销
被同种流体在所有六个侧面包围的流体源无法流动。这些更新将被跳过。在超过 1,024 个区块的处理中,跳过了 1,505,224 次更新中的 1,085,021 次。海岸线、洞穴和结构边缘保留其原版更新。
增量自动保存启用期间,禁用对每个已加载持有者(holder)的逐刻扫描。卸载队列每刻有上限,因此仍被生成任务占用的区块不会拖慢主线程。
网络与客户端
下一个区块批次优先选择距离最近且符合朝向偏好的区块。数据包构建使用测量的毫秒预算,因此大视野跨越不会耗尽整个刻的时间。服务器端按批次分组通道刷新,游戏数据包每刻刷新一次。
当客户端安装此模组时,编译后的区块网格上传每帧有限制。这减少了转身或跨越区块边界时的卡顿。
命令
/chunkopt stats - 查看刻百分位数、自动保存次数、加载与保存计数、跳过的流体更新
/chunkopt autosave - 执行一次增量自动保存
/chunkopt selftest save - 比较快照编码与原版标签
/chunkopt reload - 重新读取配置文件
配置文件:config/chunkopt-server.toml。
已知限制
- 结构放置顺序可能与原版运行不同。原版在此处本就依赖顺序,因此区块哈希值不能作为一致性检查。
- 玩家加入时等待首个完整区块(FULL chunk)的同步等待保持不变。真实日志中看到的一次性 5.2 秒加入刻延迟不属于本模组范畴。
- GPU 渲染批处理不在本模组范围内。小堆内存导致的 GC 暂停并非模组错误。
如果你发现 Bug
🏆 支持作者
🌐 第三方托管与分发
你不得将此模组托管在第三方平台或通过第三方网站分发;下载此模组的唯一授权来源是 Modrinth。
你可以在第三方网站上展示此模组,前提是不重新托管文件。所有下载按钮或链接必须直接指向此 Modrinth 页面 () 或使用官方 Modrinth 下载 URL,以便下载量能在 Modrinth 上正确统计。
Accelerates chunk generation. When moving, priority is given to chunks located in the direction of the player's movement. Server threads, automatic chunk saving, data encoding/decoding, and the network transmission of chunks have been optimized.
ChunkOpt moves chunk work off the server thread and spreads the rest across ticks. Most paths have a config switch, and speculative paths fall back to vanilla.
Generation
Vanilla runs six generation steps on the single-flight worldgen mailbox. ChunkOpt posts them to the worker pool. FEATURES is the only step that can write into neighbouring chunks, so it takes a 3x3 chunk lock.
Generation tasks are sorted by distance with a small bonus for the player's heading. That puts the front of the view ahead of the rear. Only the posting order changes, not the terrain data.
In a paired A/B run over the same 625 chunks, the serial pipeline took 53.5 s and the parallel one 13.2 s. A 1,024-chunk forceload went from 64.5 s to 17.0-20.5 s.
Loading and saving
Section palettes are decoded on a worker while the region file is read. The server thread receives finished containers instead of decoding them. If the pre-decoded data does not match the exact NBT tag, the vanilla path runs. Repeated reads of a chunk with no region data are answered from memory until a write invalidates the entry.
The periodic autosave is drained with a 3 ms and 64-chunk cap per tick. NBT encoding runs on the IO pool from a snapshot. /save-all and shutdown still drain everything synchronously, so no async encode is left in flight.
On 511 chunks loaded from disk, average main-thread read time dropped from 2.48-2.53 ms to 1.87 ms. An autosave pass over 1,024 dirty chunks was spread across 9.5 s; the worst added tick was 11.15 ms against the 3 ms budget.
Tick costs
A fluid source surrounded by the same fluid on all six sides cannot move. Those updates are skipped. Over 1,024 chunks that removed 1,085,021 of 1,505,224 updates. Shorelines, caves and feature edges keep their vanilla updates.
The per-tick scan over every loaded holder is disabled while the incremental autosave is on. The unload queue is capped per tick, so a chunk still claimed by a generation task cannot spin the main thread.
Network and client
The next chunk batch is selected nearest-first with the heading bias. Packet construction uses a measured millisecond budget, so a large view crossing cannot eat the whole tick. Channel flushes are grouped per batch on the server and once per tick for play packets.
With the mod installed on the client, compiled chunk mesh uploads are limited per frame. That reduces the hitch when turning or crossing a chunk border.
Commands
/chunkopt stats - tick percentiles, autosave passes, load and save counts, fluid ticks skipped
/chunkopt autosave - run one incremental autosave pass
/chunkopt selftest save - compare snapshot encoding against the vanilla tag
/chunkopt reload - re-read the config
Config: config/chunkopt-server.toml.
Known limits
- Feature placement order can differ from a vanilla run. Vanilla is already order-dependent here, so chunk hashes are not a parity check.
- The synchronous wait for the first FULL chunk when a player joins is unchanged. A one-off 5.2 s join tick seen in a real log remains outside this mod.
- GPU rendering batching is not part of this mod. GC pauses from a small heap are not mod bugs.
If you find bugs
🏆 Support the Author
🌐 Third-Party Hosting and distribution
You are not permitted to host this mod on third-party platforms or distribute it via third-party websites; the only authorized source for downloading the mod is Modrinth.
You may feature this mod on third-party websites, provided you do not rehost the files. All download buttons or links must point directly to this Modrinth page () or use official Modrinth download URLs so that downloads are properly counted on Modrinth.
评论 0
登录后参与评分
还没有评论,来抢沙发吧