Voxel Engine in Unity: Part 1
Minecraft has not only been a source of fun for me but inspiration in terms of game development, technology stack and feel. I’m happy to say that it has re-fired the spark I’ve had for game development.
Recently I came across a formal definition of the cube-based design that Minecraft uses - a Voxel.
Definitely something I want to implement - a voxel engine.
The idea behind a voxel engine is simple - use blocks for terrains but with the added complexity of needing to be intelligent about loading and unloading voxels around the player.
I put this together in a few hours last night as what I called training for Ludum Dare. I also wanted to try out streaming development on Twitch.tv which I think went well. There were a ton of people (9).
Features:
- Control player square with WASD
- 3d world with max voxel dimensions of 100x100x100
- Extremely preliminary version of chunk loading (loads up voxels within 10x10x10 of player)
- Floor fully implemented (up until 100x100 grid)
- Sexy camera following (that I took from http://unity3d.com/learn/tutorials/projects/stealth/camera-movement)
- Hovering over blocks reduces its color down to black given enough time
#6 may not seem like that big of a deal but I wanted to be sure any properties attached to the world remains after being unloaded and loaded again. You can test this yourself by hovering your mouse cursor over a block for a while until it gets dark, walk (waddle?) far enough away to unload it, then go back.
What I’m really looking forward to doing is implementing a procedurally generated terrain using the Diamond-Sqaure Algorithm.