Concurrent Chunk Management Engine (Fabric)

Concurrent Chunk Management Engine (Fabric)

231k Downloads

Smoother chunk generation

vlad0-0 opened this issue ยท 1 comments

commented

Request Description
Description:
This proposal aims to improve frame rates (FPS) during world exploration in Minecraft by addressing the performance bottleneck caused by chunk generation on the main thread. I think that generating new chunks and updating mobs/players share the same thread, causing significant FPS drops.

Proposed Solutions:
Chunk Generation: Explore the feasibility of offloading chunk generation to a separate thread while maintaining data consistency with the main thread.
Prioritization on Main Thread: Analyze if critical tasks can be prioritized on the main thread while chunk generation happens in the background.
Benefits:
Smoother exploration experience with reduced FPS drops during chunk generation.

I'm not very knowledgeable about this and would like to hear your opinion as a more advanced person on the subject. It's probably quite a complex task. Maybe you already have ideas how to make chunk generation smoother (perhaps by slowing down their generation) without having to do something with the main thread.

commented

I think that generating new chunks and updating mobs/players share the same thread, causing significant FPS drops.

This is simply not true. To the best of my knowledge, on all versions after 1.14, rendering, ticking and world generation are on separate threads.

Chunk Generation: Explore the feasibility of offloading chunk generation to a separate thread while maintaining data consistency with the main thread.

Already implemented in vanilla since 1.14.

Prioritization on Main Thread: Analyze if critical tasks can be prioritized on the main thread while chunk generation happens in the background.

This is something you can tweak with threadtweak. Tweaking thread priorities can help mitigating some stutters when chunk generation is happening in the background.
C2ME intentionally lowers the priority of world generation threads already.
However, this may not actually solve the issue especially for users on Windows.

perhaps by slowing down their generation

This project is about speeding up world generation. Slowing down generation intentionally is considered out of scope.
You can already control the number of threads by passing -Dmax.bg.threads=x as JVM flag in vanilla and globalExecutorParallelism in c2me.toml. Lowering the number of threads gives more breathing room for rendering the game on your screen while slowing down all background tasks, and it is a tradeoff you need to consider.