Voxel world engine

I spend most of yesterday and this morning working on expanding my minecraft like game.

I got the memory usage back to half of what it was. I somehow was creating data that was not being used. I added a little check to the chunk creation method and the memory usage went back from 600+ mb to 300 mb.

Another thing I did was to add code to not create all new chunks around the player at once. I now do this a bit at the time. This made the framerate more fluent. It even seems to word alright on the lower end laptop.

On the Monkey forums I asked a couple of questions a while ago and they were luckely answered. One question was on how to create a bullet. This I needed to find the block in front of the camera. I implemented this and it seems to work. I can now remove blocks. This did require me to rebuild the current chunk and every possible chunk next to this chunk.

One other question that got answered on the forum was on how to set a different texture on each block. And a different texture for each face of each block. This I also got working. Now I need to expand on this for every different block that is going to be created.

I plan on creating a tutorial or a code example showing how a crude chunk system works. Chunks are a nice way of being able to create larger terrains around the player. You create a list in memory with the active chunks and remove any that are to far away and you put new chunks in the list that get into range. In the voxel world each chunk is a model made up of blocks. They connect to each other.

After I was done this morning I got the idea to add some baddies into the world and add shooting. I thought it would be fun to create a small shooter with the world. Not sure If I will do that next since I also thought on adding more textures and blocks and sprites and working on more generation features.

The video below is the current state. The code is on my github (monkey2 user pakz001) pages.