ZeroSeek 是什么?
ZeroSeek 是专为 Minecraft 服务器打造的一站式底层性能引擎。它通过用原生的零拷贝内存映射替代标准的同步区块 I/O,利用 2D 空间锁并行化地形生成,集成专用的 StarLight 光照引擎,并可选地通过 CUDA 驱动 API 将噪声计算卸载至 NVIDIA GPU,从而解决 Minecraft 世界管线中的核心架构瓶颈。
其目标是在高负荷游戏场景(包括高速鞘翅飞行、多人传送和快速区块生成)下,确保服务器 tick 率稳定在 20.0 TPS。
当前状态
生产就绪 (v1.4.0),适用于 Minecraft 1.21.11 (Fabric)。
包含的功能:
- 模块化子项目架构 (
zeroseek-base, zeroseek-worldgen, zeroseek-cuda, zeroseek-light)。
- 原生 Java 22 FFM 内存映射 I/O (
MemorySegment, Arena.ofShared())。
- 带有 2D Chebyshev 空间锁 ($3 \times 3$) 的并发世界生成管线。
- 集成的 StarLight 延迟光照引擎(零分配的位运算光照传播)。
- 原生 CPU 核心亲和性(Linux 上的
sched_setaffinity / Windows 上的 SetThreadAffinityMask)。
- 非破坏性 TPS 调节器,支持免疫玩家影响的实体 AI 削减。
- 可选的 NVIDIA GPU 加速(CUDA 驱动 API + NVRTC 运行时内核编译)。
- 高级世界生成优化:SIMD 密度插值、3D 生物群系缓存和紧凑内存调色板。
⚠️ 不兼容性与模组冲突
ZeroSeek 深度修改了 Minecraft 的底层子系统(区域 I/O、世界生成区块调度、噪声生成和光照引擎)。安装其他修改这些相同系统的模组会导致服务器启动崩溃、严重死锁或世界损坏。
❌ 严格不兼容(无法启动或导致崩溃/世界损坏)
- C2ME (Concurrent Chunk Management Engine):硬性冲突。两个模组都替换了区块任务分发器、
ChunkStep 调度和区域文件 I/O。同时运行两者会导致服务器启动时立即死锁和文件损坏。
- StarLight / ScalableLux:硬性冲突。ZeroSeek v1.4.0 已在其内部的
zeroseek-light 中包含了自身优化的 StarLight 光照引擎。添加外部的 StarLight 或 ScalableLux 会导致在 LevelLightEngine 和 ThreadedLevelLightEngine 上发生重复 Mixin 注入崩溃。
- Noisium:硬性冲突。两个模组都钩入了密度函数噪声缓存和区块噪声计算循环。
- Krypton / Alternate Network/Chunk Packet Rewriters:可能与 ZeroSeek 的异步区块序列化产生竞争条件。
✅ 完全兼容且经过测试
- 优化类模组:FerriteCore, ModernFix, MemoryLeakFix, FastSuite。
- Lithium:与标准的实体、AI 和方块 Tick 优化兼容。
- 客户端渲染器:Sodium, Iris, Nvidium, Voxy(ZeroSeek 为服务端模组,与客户端模组完全兼容)。
- 地图工具与标记:BlueMap, Dynmap, Pl3xMap。
- 世界生成数据包 / 生物群系模组:Terralith, Biomes O' Plenty, Nullscape。
功能
1. 零拷贝 MMap I/O 引擎 (zeroseek-base)
- 直接内存访问:区域文件 (
.mca) 通过 Java 22 外部函数与内存 (FFM) API 使用原生虚拟内存 (MemorySegment) 直接读取,完全绕过中间 JVM 堆分配。
- 同步混合存储:写入由原版的异步
StorageWorker 线程处理,并在扇区写入时自动使 MmapLruCache 失效,保证 100% 的 Anvil 扇区完整性和零文件损坏。
- MMap LRU 缓存:堆外内存严格受
maxMappedBytes 限制(默认:2 GB),当达到预算的 90% 时会自动淘汰冷区域映射。
- 内核内存提示:在 Windows 上通过
PrefetchVirtualMemory 和在 Linux 上通过 posix_madvise (WILLNEED / DONTNEED) 发出原生页面预取建议。
2. 并发世界生成引擎 (zeroseek-worldgen)
- 2D 空间锁定:用于边界写入生成阶段 (
FEATURES) 的细粒度 Chebyshev $3 \times 3$ 网格锁定,按规范顺序排列以从数学上消除锁排序死锁。
- 专用生成器池:具有
CallerRunsPolicy 背压机制的独立工作池,并将硬件 CPU 亲和性绑定到隔离的处理核心(例如,核心 2–7)。
- 无弹跳分发:在工作线程中直接执行,消除了
fillFromNoise 和 createBiomes 中的线程切换。
- 3D 生物群系与列缓存:多阶气候采样和搜索树遍历按线程缓存 (
Biome3DCache, ClimateColumnCache)。
- SIMD 密度插值:使用向量数学基元 (
DensityInterpolatorSimd, CompactSineLUT) 加速 3D 三线性密度插值。
- 紧凑哈希调色板:高效的调色板实现,减少了
PalettedContainer 中的内存占用。
3. 集成 StarLight 光照引擎 (zeroseek-light)
- StarLight 架构:完全用 StarLight 无锁、位运算 SWMR 传播算法替换原版沉重的递归
LightEngine。
- 延迟光照执行:光照任务被批量处理并独立调度,将光照更新从关键的区块生成路径中移除。
4. GPU 硬件加速 (zeroseek-cuda, 可选)
- NVIDIA CUDA 计算:使用 CUDA 驱动 API (
nvcuda.dll / libcuda.so) 将繁重的 2D 初步表面噪声计算卸载至专用的 NVIDIA GPU(RTX 系列)。
- 异步 2D 网格预取:预取带有 $-48$ 方块偏移的 $24 \times 24$ 列网格,为 Aquifer 水/岩浆层计算提供 100% 的缓存命中。
- 运行时 NVRTC 编译:在服务器启动时动态将 Minecraft 密度函数 AST 转换为优化的 PTX/CUBIN 机器代码。
5. 无损 TPS 限速器
- 原版物理不变:绝不取消
LivingEntity.aiStep(),不丢弃玩家移动数据包,也不冻结玩家区块加载。重力、跌落伤害、状态效果和载具对齐保持 100% 原版效果。
- 远处实体 AI 削减:在
STRESS(压力)或 CRITICAL(危急)TPS 状态下,仅对距离活着的玩家超过 48 格的实体,概率性地大幅削减其 GoalSelector AI 的执行频率。
- 自适应模拟范围缩放:动态收缩和扩展正常状态与降级状态之间的模拟距离。
目标平台
- Minecraft: 1.21.11 (官方 Mojang Mappings)
- Fabric Loader: 0.18.2+
- Fabric API: 0.139.4+1.21.11
- Java 工具链: Java 22(FFM API 需要
release = 22)
- 运行环境: 专用服务器(仅限服务端)
- 操作系统: Windows (x64) 和 Linux (x64)
安装方法
- 确认你的服务器运行时正在使用 Java 22 (
java -version)。
- 移除任何冲突的模组(C2ME、StarLight、ScalableLux、Noisium)。
- 将
zeroseek-1.4.0.jar 放入服务器的 mods/ 目录中。
- 启动服务器以生成
config/zeroseek.json 配置文件。
- 根据 CPU 拓扑结构调整
config/zeroseek.json 中的线程池和 CPU 亲和核心设置。
What is ZeroSeek?
ZeroSeek is an all-in-one low-level performance engine for Minecraft servers. It addresses the core architectural bottlenecks of Minecraft's world pipeline by replacing standard synchronous chunk I/O with native zero-copy memory-mapping, parallelizing terrain generation with 2D spatial locking, integrating a dedicated StarLight lighting engine, and optionally offloading noise evaluation to NVIDIA GPUs via the CUDA Driver API.
The goal is deterministic server tick-rate (20.0 TPS) under demanding gameplay scenarios, including high-speed elytra flight, multi-player teleports, and rapid chunk generation.
Current Status
Production-ready (v1.4.0) for Minecraft 1.21.11 (Fabric).
Features included:
- Modular subproject architecture (
zeroseek-base, zeroseek-worldgen, zeroseek-cuda, zeroseek-light).
- Native Java 22 FFM Memory-Mapped I/O (
MemorySegment, Arena.ofShared()).
- Concurrent World Generation Pipeline with 2D Chebyshev Spatial Locking ($3 \times 3$).
- Integrated StarLight Deferred Lighting Engine (zero-allocation bitwise light propagation).
- Native CPU Core Affinity (
sched_setaffinity on Linux / SetThreadAffinityMask on Windows).
- Non-Destructive TPS Governor with player-immune mob AI decimation.
- Optional NVIDIA GPU Acceleration (CUDA Driver API + NVRTC runtime kernel compilation).
- Advanced WorldGen optimizations: SIMD density interpolation, 3D biome caching, and memory-compact palettes.
⚠️ Incompatibilities & Mod Conflicts
ZeroSeek deeply modifies low-level Minecraft subsystems (Region I/O, WorldGen chunk scheduling, Noise generation, and Light engines). Installing other mods that modify these exact systems will cause server crashes on startup, severe deadlocks, or world corruption.
❌ Strictly Incompatible (Will not launch or will crash/corrupt world)
- C2ME (Concurrent Chunk Management Engine): Hard conflict. Both mods replace the chunk task dispatcher,
ChunkStep scheduling, and region file I/O. Running both causes instant server startup deadlocks and file corruption.
- StarLight / ScalableLux: Hard conflict. ZeroSeek v1.4.0 already includes its own optimized StarLight lighting engine directly inside
zeroseek-light. Adding external StarLight or ScalableLux will cause duplicate Mixin injection crashes on LevelLightEngine and ThreadedLevelLightEngine.
- Noisium: Hard conflict. Both mods hook into density function noise caching and chunk noise evaluation loops.
- Krypton / Alternate Network/Chunk Packet Rewriters: Potential race condition with ZeroSeek's async chunk serialization.
✅ Fully Compatible & Tested
- Optimization Mods: FerriteCore, ModernFix, MemoryLeakFix, FastSuite.
- Lithium: Compatible with standard entity, AI, and block ticking optimizations.
- Client Renderers: Sodium, Iris, Nvidium, Voxy (ZeroSeek is server-side and fully compatible with client mods).
- Map Tools & Markers: BlueMap, Dynmap, Pl3xMap.
- WorldGen Datapacks / Biome Mods: Terralith, Biomes O' Plenty, Nullscape.
Features
1. Zero-Copy MMap I/O Engine (zeroseek-base)
- Direct Memory Access: Region files (
.mca) are read directly through native virtual memory (MemorySegment) via Java 22 Foreign Function & Memory (FFM) API, completely bypassing intermediate JVM Heap allocations.
- Synchronized Hybrid Storage: Writes are handled by vanilla asynchronous
StorageWorker threads with automatic MmapLruCache invalidation on sector writes, guaranteeing 100% Anvil sector integrity and zero file corruption.
- MMap LRU Cache: Off-heap memory is strictly bounded by
maxMappedBytes (default: 2 GB), automatically evicting cold region mappings down to 90% budget.
- Kernel Memory Hints: Issues native page prefetch advisories via
PrefetchVirtualMemory on Windows and posix_madvise (WILLNEED / DONTNEED) on Linux.
2. Concurrent World Generation Engine (zeroseek-worldgen)
- 2D Spatial Locking: Fine-grained Chebyshev $3 \times 3$ grid locking for boundary-writing generation stages (
FEATURES), ordered canonically to mathematically eliminate lock-ordering deadlocks.
- Dedicated Generator Pool: Independent worker pool with
CallerRunsPolicy backpressure and hardware CPU affinity bound to isolated processor cores (e.g., Cores 2–7).
- Zero-Bouncing Dispatch: Direct execution in worker threads eliminates thread hopping in
fillFromNoise and createBiomes.
- 3D Biome & Column Caching: Multi-octave climate sampling and search tree traversals are cached per-thread (
Biome3DCache, ClimateColumnCache).
- SIMD Density Interpolation: Accelerates 3D trilinear density interpolation using vector math primitives (
DensityInterpolatorSimd, CompactSineLUT).
- Compact Hash Palette: High-efficiency palette implementation reducing memory footprint in
PalettedContainer.
3. Integrated StarLight Lighting Engine (zeroseek-light)
- StarLight Architecture: Fully replaces vanilla's heavy, recursive
LightEngine with StarLight's lock-free, bitwise SWMR propagation algorithm.
- Deferred Lighting Execution: Light tasks are batched and scheduled independently, removing light updates from the critical chunk generation path.
4. GPU Hardware Acceleration (zeroseek-cuda, Optional)
- NVIDIA CUDA Compute: Offloads heavy 2D preliminary surface noise calculation to dedicated NVIDIA GPUs (RTX series) using the CUDA Driver API (
nvcuda.dll / libcuda.so).
- Async 2D Grid Prefetching: Prefetches a $24 \times 24$ column grid with a $-48$ block offset to provide 100% cache hits for Aquifer water/lava level calculations.
- Runtime NVRTC Compilation: Dynamically translates Minecraft density function ASTs into optimized PTX/CUBIN machine code at server startup.
5. Non-Destructive TPS Governor
- Vanilla Physics Invariant: Never cancels
LivingEntity.aiStep(), never drops player movement packets, and never freezes player chunk tickets. Gravity, fall damage, status effects, and vehicle alignment remain 100% vanilla.
- Distant Mob AI Decimation: Probabilistically decimates
GoalSelector AI execution only for mobs farther than 48 blocks away from living players during STRESS or CRITICAL TPS states.
- Adaptive Simulation Scaling: Dynamically contracts and expands simulation distance between normal and degraded states.
Target Platform
- Minecraft: 1.21.11 (Official Mojang Mappings)
- Fabric Loader: 0.18.2+
- Fabric API: 0.139.4+1.21.11
- Java Toolchain: Java 22 (
release = 22 required for FFM API)
- Environment: Dedicated Server (Server-side only)
- Operating System: Windows (x64) and Linux (x64)
Installation
- Verify that your server runtime is running Java 22 (
java -version).
- Remove any conflicting mods (C2ME, StarLight, ScalableLux, Noisium).
- Place
zeroseek-1.4.0.jar into your server's mods/ directory.
- Start the server to generate
config/zeroseek.json.
- Adjust thread pools and CPU affinity cores in
config/zeroseek.json to match your CPU topology.
评论 0
登录后参与评分
还没有评论,来抢沙发吧