Async Chunk Generation for Minecraft Clone

Greetings everyone,

I’m working on a minecraft clone, to test both my skills and playcanvas. And would like help with something. What would be the best way to optimize chunk generation? When you need to generate new chunks, it takes from 1 to 10 seconds for that to happen. And yes, I’m using custom meshes that don’t render unnecessary faces (almost all unnecessary faces)

Link to latest build: https://playcanv.as/p/gzo1xMQV/

Have you checked the profiler to see where the bottlenecks are and try to look at what optimisations you could do there?

Could you stagger the generation over several frames?

It only says requestAnimationFrame

Can you generate the vertex/triangle data in a Web Worker? You’d still need to create the PlayCanvas mesh structures in the main thread though.

How would I do that? I would have to manually add a worker as a separate file? From what I can see, playcanvas adds the scripts as a whole chunk.