One aspect to cover in multiplayer environments is the world synchronization. You can use the event OnChunkChanged to send modifications to the server or other clients (check other events here). Then you can use the following methods to quickly gather the data of a chunk or apply that data on other clients:


public byte[] GetChunkRawBuffer()

Returns a newly allocated byte array to store contents of a chunk. Use with GetChunkRawData() method:


public int GetChunkRawData(VoxelChunk chunk, byte[] contents)

Writes the contents of a chunk (voxels) into the array contents starting at index "baseIndex". The allocation of the byte array should be obtained using GetChunkRawData() method. Contents are packed using RLE compression to reduce memory usage. The method returns the actual data length contained in contents array.

    

public byte[] SetChunkRawData(VoxelChunk chunk, byte[] contents, int length, bool validate = true)

Replaces the contents of a chunk with "contents". Length param determines the length of valid data inside the contents array (because the array can be bigger than the actual data in it; . If validate is set to true, the voxel types will be checked to ensure they correspond to existing voxel definitions. The contents of the byte array should be obtained using GetChunkRawData() method.


The methods above will automatically compress/uncompress the data of the chunk using an RLE algorithm to reduce the bandwidth used when sending chunk data over the network.


Take a look at other methods that let you get or set voxels as well here.