GPUmod - 为 Minecraft 提供 GPU 服务器加速
这是一个面向 Minecraft 的服务端 Fabric 模组,利用 OpenCL 将繁重的服务器计算任务卸载至您的 GPU。无需安装客户端模组。
功能说明:
该模组将通常由 CPU 逐个执行的各类服务器任务,改为在 GPU 上并行运行。
地形生成(TERRAIN GENERATION)- 当生成新区块时,GPU 使用多层 Perlin 噪声生成地形高度图。它并行计算出大陆、丘陵、山脉和山谷,随后 CPU 根据高度图填充实际的方块。
光照计算(LIGHTING)- 当需要计算区块光照时,GPU 对方块光(火把、发光石等)和天空光执行迭代式光线传播。它采用双缓冲传播机制,最多经过 15 次迭代即可收敛,同时处理区块内的全部 4096 个方块。
矿物放置(ORE PLACEMENT)- 在区块生成期间,GPU 计算矿石(煤、铁、金、钻石、青金石、红石、绿宝石、铜)的生成位置。它一次性确定所有矿石类型的位置,然后 CPU 在这些位置上放置实际的矿脉。
寻路(PATHFINDING)- 当生物需要导航时,它们的寻路请求会被批量处理。GPU 使用并行 A* 算法一次性解决所有待处理的寻路路径,而非逐个生物求解。结果会被缓存,并在下一个游戏刻(tick)中作为真实路径返回。
爆炸效果(EXPLOSIONS)- TNT 和苦力怕的爆炸使用 GPU 光线投射技术,以球形模式发射 1352 条射线。GPU 同时追踪每条射线穿过防爆网格,从而确定哪些方块被破坏。这完全替代了原版爆炸逻辑。
实体物理(ENTITY PHYSICS)- 当世界中存在 16 个或更多实体时,它们的位置和速度更新会被批量发送并交由 GPU 处理。重力、阻力和速度限制均通过结构体数组(Structure-of-Arrays)内存布局进行并行计算,以实现最佳的 GPU 性能。
随机刻(RANDOM TICKS)- 作物生长、火势蔓延、冰块融化、树苗生长以及其他随机刻事件会在所有已加载区块的部分(section)中进行批量处理。GPU 使用并行随机数生成器一次性处理所有这些事件,随后 CPU 应用相应结果。
碰撞检测(COLLISION DETECTION)- 当存在 16 个或更多实体时,GPU 执行空间哈希粗粒度碰撞检测,以找出重叠的实体对。检测结果会被存储并可供其他系统查询。
红石电路(REDSTONE)(实验性功能,默认关闭)- 在一个游戏刻内收集红石线路更新,并通过并行信号传播在 GPU 上一次性解决整个网络,取代原版顺序更新的逻辑。
工作原理:
该模组使用 JOCL(Java OpenCL 绑定库)与您的 GPU 通信。启动时,它会检测您的 GPU,编译 13 个 OpenCL 内核程序,并为并发执行创建多个命令队列。它使用带有预分配缓冲区的内存池,以避免分配开销。
每个任务都有批处理大小阈值。如果可处理的项目数量不足(例如,少于 16 个实体用于物理计算),则会跳过 GPU 交由原版逻辑处理,因为对于小规模工作负载而言,GPU 调度的开销并不划算。
所有 GPU 任务都设有 CPU 回退机制。如果因任何原因导致 GPU 失败,服务器将继续使用原版逻辑正常运行。
配置说明:
编辑 config/gpumod.properties 文件以启用/禁用单个任务、设置批处理阈值、调整迭代次数上限,以及启用调试/性能日志记录。
据我了解,它并不需要高性能显卡,一块 RTX 4060 就足够了,但如果我说错了请指正。
免责声明!!!
本模组仍处于非常早期的开发阶段,如果发现 Bug,请在 Discord 中报告!!!
GPUmod - GPU Server Acceleration for Minecraft
This is a server-side Fabric mod for Minecraft that offloads heavy server computations to your GPU using OpenCL. No client mod needed.
What it does:
The mod takes different server tasks that normally run on your CPU one at a time and runs them in parallel on your GPU instead.
TERRAIN GENERATION - When new chunks are created, the GPU generates the terrain heightmap using multi-layer Perlin noise. It creates continents, hills, mountains, and valleys all computed in parallel on the GPU. The CPU then fills in the actual blocks based on the heightmap.
LIGHTING - When chunks need lighting calculated, the GPU runs iterative light propagation for both block light (torches, glowstone) and sky light. It uses double-buffered propagation that converges in up to 15 iterations, processing all 4096 blocks in a section simultaneously.
ORE PLACEMENT - During chunk generation, the GPU calculates where ores should spawn (coal, iron, gold, diamond, lapis, redstone, emerald, copper). It determines positions for all ore types at once, then the CPU places the actual ore veins at those positions.
PATHFINDING - When mobs need to navigate, their pathfinding requests are batched together. Instead of solving paths one mob at a time, the GPU solves all pending paths in one batch using parallel A-star. Results are cached and returned as real paths the next tick.
EXPLOSIONS - TNT and creeper explosions use GPU raycasting with 1352 rays cast in a sphere pattern. The GPU traces each ray through the blast resistance grid simultaneously, determining which blocks get destroyed. This fully replaces vanilla explosion logic.
ENTITY PHYSICS - When there are 16 or more entities in the world, their position and velocity updates are batched and sent to the GPU. Gravity, drag, and velocity clamping are all computed in parallel using a Structure-of-Arrays memory layout for optimal GPU performance.
RANDOM TICKS - Crop growth, fire spread, ice melting, sapling growth, and other random tick events are batched across all loaded chunk sections. The GPU processes them all at once using parallel random number generation, then the CPU applies the results.
COLLISION DETECTION - When there are 16 or more entities, the GPU runs spatial hash broad-phase collision detection to find overlapping entity pairs. Results are stored and queryable by other systems.
REDSTONE (experimental, off by default) - Redstone wire updates within a tick are collected and the entire network is solved at once on the GPU using parallel signal propagation instead of vanilla's sequential updates.
How it works:
The mod uses JOCL (Java OpenCL bindings) to talk to your GPU. On startup it detects your GPU, compiles 13 OpenCL kernel programs, and creates multiple command queues for concurrent execution. It uses a memory pool with pre-allocated buffers to avoid allocation overhead.
Each task has batch size thresholds. If there aren't enough items to process (for example, fewer than 16 entities for physics), it skips the GPU and lets vanilla handle it, since GPU dispatch overhead isn't worth it for small workloads.
All GPU tasks have CPU fallback. If the GPU fails for any reason, the server continues running normally using vanilla logic.
Configuration:
Edit config/gpumod.properties to enable/disable individual tasks, set batch thresholds, tune iteration limits, and enable debug/performance logging.
As far as im concerned it does not require a beefy GPU a 4060 will do just fine but please correct me if im wrong
Disclaimer!!!
this is in very early development please report bugs in the discord if found!!!
评论 0
登录后参与评分
还没有评论,来抢沙发吧