Voxels in Games and Art

Ever since the explosion of Minecraft on the gaming community I feel as though the term ‘voxel’ has become a hot topic. It’s easy to think this is a new concept or terminology but it isn’t. It goes way back to the early days of computing and graphics processing and is not exclusive to the domains of gaming but are also used in the medical and other fields and really anywhere graphical representations are required (almost everywhere these days). Today I’ll be talking about voxels, but with a focus on my Eden game project as well as voxels as an artistic medium.

Voxels in Games and Eden
The world’s of Eden are composed of voxels. The primary reason for this is that I wanted to represent the game landscapes in three dimensions for game mechanics reasons (it’s simply richer and is a purposeful nod to Dwarf Fortress) and I needed a world that could physically be deformed by play or through an editor. The other and equally important reason is that I wanted to be able to generate unique terrain for each game so the game would have a lot of replay-ability and no two games would be the same. The answer was voxel data, or an array (three dimensional in this case) of information used to represent the world terrain.

However graphically Eden is represented in two dimensions, that is it only makes use of 2D sprites to display the world, it’s characters and everything else. This is different from games like Minecraft and others that are represented in three dimensions. So while Eden makes use of voxels for the physical terrain it’s not formally making use of voxels for their graphical representation, just good ol’ sprites!

In Eden, the terrain is stored in a basic three-dimensional array of class information so that I can size out the world as need in the x, y and z (elevation) directions. It’s really quite akin to Minecraft in that each 3D location in the world is a specific type of terrain or perhaps just empty space. Through the use of the OpenSimplexNoise algorithm described earlier, terrain is generated that turns out fairly organic and realistic, voxel by voxel. One of the key facets of a game like Eden is that the player is naturally going to mine for ore as well as for shelter and exploration purposes. This is where the power of discrete voxel terrain data comes into play. Since the game terrain is already represented in three-dimensions, as the player mines out the earth, I can simply change the type of terrain at a specific world location; a simple and huge benefit of voxels versus say a static world that doesn’t or can’t physically change during play.

Don’t Starve (Example of Pure 2D Terrain)

A decent example of such a game might be Don’t Starve (a great game!), the terrain is really a 2D representation and ‘mining’ is an action done on physical objects in the world. The result is that the player can mine for ore or otherwise harvest other resources from the world, but the physical world itself really doesn’t change, at least not physically. This is in contrast to games like Eden and Dwarf Fortress where the physical world changes as a result of the actions of the player. I believe that having the world physically change in this way is pretty important in a game like Eden where the primary focus is on all the little details that make up the world and it’s game mechanics so that hopefully the player comes away with an interesting story to tell.

For example, “I mined out a section of the mountain for it’s ore but also intended to use that space to store all the items we stole from the nearby settlement only to break into a larger cavern housing a bunch of huge spiders, it was a disaster and I lost three miners.” is a lot more interesting and entertaining to the player than “I mined some resources and crafted a thing.“. There’s nothing wrong with the latter here, it makes sense in a game that is primarily focused on crafting (as in Don’t Starve) but it doesn’t leave the kind of permanent tangible results that I’m looking for out of Eden. Voxels have everything to do with the former however. If the world were not physically changed through the act of mining or other such activities, then stories like the above snippet couldn’t possibly emerge. The player would simply mine the ‘resource node’ and receive their resources, but there was never a chance of something interesting happening unless it was purposefully scripted into the game. Scripted events are awesome until the player has seen them a few times, those games are usually very rich in writing and traditional story-telling (or they should be) but once you’ve seen it, you aren’t usually as inclined to experience it again, sapping the replay-ability of the game. With Eden being a voxel based world, I’m intending to drive as much emergent behavior as possible, I want players to experience situations that I as the developer did not intentionally write into the game; I want to be surprised at the kinds of stories players will tell after playing Eden for an hour or twenty.

With respect to rendering the world in Eden, this is where it sharply cuts away from typical voxel systems. I don’t render traditional voxels as graphical elements, rather I use sprites to render the physical state of the world at the position of the camera. Since I’ve chosen to depict the game in two-dimensions, I’ve taken a cue from Dwarf Fortress and simply render the world as it exists at the elevation of the camera and below; the player is free to move the camera up/down through the various elevations of the world and view it slice-by-slice. I personally liked how this was handled in Dwarf Fortress and simply adapted it into Eden. In the above screenshot, everything that is a little desaturated in color is actually terrain and objects below the current camera elevation, my thought was to depict it as a little hazy in an attempt to visually represent depth while the more obvious saturated colors are at the camera elevation. I guess to a slight extent I am visually trying to display a 3D world in 3D via a 2D canvas.

While it’s quite a bit more work to handle a three dimensional world using 2D graphics, I think the end result speaks for itself and it has a certain style to it all it’s own. Had I more time and money this would be a 3D game (and very voxely!) however I am but a sole developer and so pixels are my chosen medium, so it’s very pixely!

Voxels as an Artistic Medium
Moving away from Eden now, I can talk about voxels a little more generically. Usually when talking about voxels, graphically we’re talking about a 3D cube, but it could really be any shape; cubes are just the more traditional shapes when talking about games specifically. While a cube on it’s own isn’t particularly interesting, when you amass large amounts of them together to form a larger more intricate shape does the power and style of voxels really start to show. The toy Lego is probably the single most well understood voxel building system in existence, out of lots of little small plastic pieces one can create a physical representation of anything they can think of and then take all apart again.

Through my Twittering I’ve come across an outstanding little program called MagicaVoxel; I’ll admit I feel pretty late to the party but program is awesome, I only wish I had more time and was a better artist. Imagine taking the typical painting program (Paint.NET, Windows Paint, Photoshop, etc.) and instead of painting with pixels, your painting with voxels, that’s basically what MagicaVoxel is and unbelievably it’s completely free (so check it out, it’s fun!). I played around with this for a little while last week and challenged myself to re-create my original goblin image out of voxels to see what he might look like and came up with the following little screenshot of the rendering.

Original Goblin Voxel Art Created with MagicaVoxel

I bring up this program not only because of how intuitive and powerful and free it is, but also to better illustrate what voxels really are and how out of something very simple (a cube in this case) incredibly detailed models and scenes can be created. Understandably anything created out of cubes is going to look ‘cubey’, but I think Minecraft and LEGO and so many voxel artists have proven that we humans have a fascination with that style, I know I do.

I encourage anyone interested in voxels and/or pixel art to take a look at this program, many people have done some really incredible work with it to the point where it is clear its become a whole new artistic medium. Early on before Minecraft really took off, there was a community of emerging artists who used Minecraft not to play the formal game but as a kind of modeling program, they were already making large scenes, models and dioramas out of Minecraft creative mode (I believe originally intended as an editor). While it was fun to see a massive model of Mario rising up from a world in Minecraft, I think programs like MagicaVoxel take this art to a new level, particularly with rendering capabilities. Not so long ago the artist had to use a very expensive, sophisticated and complicated application like Maya or 3D Studio Max or Blender (and many others) to craft models in 3D space for games and digital arts. I think a program like MagicaVoxel makes it dead simple for even inexperienced 3D artists to create very stylized models, scenes and art without the need for those professional packages. It’s liberating to say the least, I think a lot more can be done with voxels than even Minecraft, LEGO or other games have shown us yet. Long live the voxel! (and the pixels too!)

The following are a few impressive scenes I wanted to call out to impress upon you the viewer the power and versatility of voxels as a purely artistic medium.