Bloxel with simple mining prototype

Last weeks I tried to make a better way to describe how a piece of our bloxel world is filled with content.

Why … because bloxel have some memory problems with completely filled chunks (hills, underground) … so there was only a surface … no mining was possible  🙂

In my first version all TerrainElement’s in a chunk stored with a simple ArrayList. So the TerrainLoader (height map based) initialize a chunk with some elements to build a surface. There is no underground information. I tried to fix this by creating ALL elements under the surface and storing them in the chunk … but then the memory usage was very high and the rendering very slow (actually we have no good culling implemented). I guess there is a better solution to describe the elements in a chunk. I tried the Octree.

Imagine a 8x8x8 chunk filled with 8x8x7 dirt (underground) and 8x8x1 grass (surface). Then the chunk has 512 bloxels, most of them are the same material : dirt … so it’s better to merge same 1x1x1 bloxels into a bigger bloxel.

Now I’m using a Octree to pack same elements for a chunk. This reduce memory and It’s faster to get the type of x,y,z bloxel from a chunk. After a change on the chunk (add or remove bloxels) the Octree needs an update.

In the next blog I will go deeper into the technical details … for now 2 new screenshots … with a lot of sand under the surface 😀