max-mapper / voxel-engine

3D HTML5 voxel game engine
http://maxogden.github.com/voxel-engine
BSD 3-Clause "New" or "Revised" License
1.29k stars 219 forks source link

Async loading of chunks #123

Open rom1504 opened 8 years ago

rom1504 commented 8 years ago

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 !

rom1504 commented 8 years ago

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