Thursday, May 5, 2011

Humble Beginnings

This is the first post in my dev journal for a voxel-based destructible terrain game being created with the free version of Unity.  Since I've already been working on the foundations of the game, this post will briefly outline the progress I've made so far.  After that, I'll lay out a general plan for future progression.  Furthermore, I'll try to include pretty pictures and videos as often as possible :)

What I've Done So Far:
  • Partially implemented Marching Cubes lookup table
  • Loading, surface extraction, and real-time alteration of binary voxel data
  • 256x256x128 voxel world subdivided into smaller sections
  • Support for up to 64 different tileable 128x128 terrain textures that blend at boundaries
What This Means:

When I say that the Marching Cubes lookup table is "partially" implemented, it means that I haven't yet added all the necessary code for converting voxel configurations to triangles.  Therefore, the generated terrain will have "holes" (missing polygons) in it.  I will patch up these holes very soon, but I decided initially that proper texturing was a higher priority since it could potentially influence the way the lookup table functions.  Thus, I delayed lookup table completion to avoid possibly rewriting a lot of code.

The other important point to note is that my voxel data is binary.  This means that each voxel is associated with a simple binary value signifying whether it is a part of solid surface or a part of empty space.  Many Marching Cubes implementations use implicit surfaces (such as the equation of a sphere) or Perlin noise to generate voxel data that is more complex and actually contains the distances from the surface being generated rather than a simple in/out notation.  This approach facilitates the creation of smoother surfaces.  However, I'm deliberately aiming for a very planar/geometric/low-fi look, so I like the results I get with simple binary voxel data.

Where I'm Going From Here:
  • Lighting.  No complex shadows, but lighting that doesn't clip through surfaces should be a difficult enough task.  I have some ideas about how to accomplish this, but it might be painful to implement, so I'm going to get it done as soon as possible.
  • Cleanup.  After world loading and rendering is hooked up to proper texturing and lighting, I'm going to spend a little bit of time cleaning up my code to make sure that everything remains readable and extensible.
  • Netcode.  The game I'm planning is 100% multiplayer, so as soon as I have the world rendering in its most basic playable form, it's time to hook in the networking.
  • Playable demo.  Haven't decided the exact form that this demo is going to take, but I plan on releasing some sort of relatively polished proof of concept.  This should serve a dual purpose -- firstly, it grabs some public feedback so that I can determine what needs to be reevaluated before the project progresses much further.  Secondly, it should be a nice refresher for me on the development side -- getting a destructible voxel world with workable netcode up and running isn't going to be a trivial task.  The satisfaction of being able to show something for my work, even something simple, will hopefully be a nice change of pace.
To Be Continued

It's probably clear at this point that I've discussed a fair amount of technical progress without describing my design concept for the game that's going to be formed out of all this shapeless mass.  I think that a design overview deserves its own post, so that will come soon.

For now, I'll leave off with a short video I captured of my code in its earliest state.  Keep in mind that there are still polygons missing from the terrain, and right now the whole world is just using one block type for simplicity, so there's only one texture.  My next update should include visuals of multiple blending terrain types and fewer missing polygons!


No comments:

Post a Comment