max-mapper/voxel-engine

Async loading of chunks

Opened this issue · 1 comments

I have a package that handle operations (getting blocks, setting blocks, loading from files, saving from files) on a minecraft world.
It is designed to be async to handle easily IO backends.
It's currently only used on a minecraft server but it works fairly well so I'm investigating ways to visualize World instance with voxeljs.
The most used interface to get blocks in voxel seems to be the generate(x,y,z) function but that is completely sync hence I can't use it.
I found in a few modules the use of generateVoxelChunk and emitting "missingChunk" event to handle async chunk loading, but that seems a bit hacky and it's a bit hard to make it work, because I can't find any documentation on generateVoxelChunk.

Does anyone have a clue what would be the best way to render the chunk asyncly ?

prismarine-world provide a getColumn async function, and it should be called when voxeljs decide it's time to render such and such chunks.

I'll keep testing things but I'd appreciate any info about this !

oh and I stumbled upon https://github.com/voxel/voxel-engine-stackgl
Is this ready to be used, would it make it easier ?