Open CapsE opened 10 years ago
By default voxel-engine has no persistence layer; setBlock() only modifies the voxel in a loaded chunk but once chunks are unloaded they are not saved anywhere. You can handle this by persisting the chunks to network/disk/memory as they unload, or just regenerate them again. Try using the missingChunk event on game.voxels, and the game.showChunk() method; this example might be helpful: https://github.com/deathcap/voxel-land
Thanks for the feedback. That explains alot :D
I wrote some code for a free camera movement without a player. The voxel-engine code states that if there is no player voxel.js will take the position of the camera to find chunks that are far away and remove them. So far everything is working fine BUT the chunks won't load when the camera gets close to them again. I tried to force voxel.js to show them but that won't work too. cp = game.camera.position.toArray(); var chunkX = Math.floor(cp[0]/32); var chunkY = Math.floor(cp[1]/32); var chunkZ = Math.floor(cp[2]/32);
I used game.setBlock([msg["x"],1 ,msg["y"]], c) to create the blocks. Is this the right way or will it just display the blocks until the chunk is hidden the first time?