voxel / voxel-engine-stackgl

3D HTML5 voxel game engine using stackgl
Other
47 stars 8 forks source link

Improve generateChunks option vs missingChunk event #5

Open deathcap opened 8 years ago

deathcap commented 8 years ago

If generateChunks is true (and it is by default), then the engine will generate chunks itself, synchronously, through opts.generate

The alternative asynchronous chunk generation technique is to listen for missingChunk events, generate asynchronously, then call showChunk when finished. If this technique is used with generateChunks: true, there is a confusing failure case: the initial chunks generate, but then no new chunks as the player explores. Found in https://github.com/voxel/voxel-example/issues/9

The correct configuration is to set generateChunks: false when using missingChunk/showChunk. This is now documented in voxel-flatland and voxel-land but maybe it could be improved further. Perhaps remove generateChunks and always require listening for missingChunk events? Or have the plugins detect and fail if the option is not set. Or/and get synchronous chunk gen to work again (worked in the three.js-based voxel-engine), so the conflicting chunks won't be empty.