Building Blocks

Since the last update, I've been working on several tools that will help speed up the game's production. My most recent tool is something that will help me with art and level design. It's a Minecraft-like block based construction tool. Basically, I can create procedural structures out of a set of textured blocks. This first point wasn't hard. I have experience with procedural generation, as you may know, so it took me all of a day to implement a basic block system. The hard part was adding details to the blocks so that they wouldn't appear flat and boring.

  • This will supplement actual modeled props, and will be used mostly for generic shapes, platforms, and planning.
  • It isn't a feature of gameplay as in Minecraft. This is for internal use.

Here is the result. Keep in mind that the game is still an alpha and the art is not finalized.

Blocks Result

In the above screenshot, we have a cluster of wooden blocks with a thick trim around each block, with small cubes at the inner joints that cover up some gaps. The trim expands to surround the structure as blocks are added to it.

Low Quality Block House

Here, I quickly expanded the cluster from the first image into something that vaguely resembles a shack. Right now the only texture is "wood", and there is only a basic set of trim objects. The next phase is to add some variety so that I have the materials to create complex structures.

Here's what I went through over the last few days:

Building Blocks 1

1) After creating a basic procedural block generator, I started experimenting with automatic decorations on the bricks. At this point, I managed to get the trim (magenta) working on one side of the block's top face. Note: the blue frame in the background is an object that I use for selecting and debugging parts of the game world.

2) It's a bit dark in the above screenshot, but here is where I first have brown borders framing several faces at once.

Building Blocks 3

3) In the above screenshot, I used a white stucco texture for everything and was using cubes to mark outer corners.

Building Blocks 4

4) I've added new sperical joints for inner corners. My first pass at the block constructor was completed.

Building Blocks 5

5) At this point, I realized that I had a problem. The above building has over 20,000 vertices, when my target is about 1,400 for all meshes. The blocks took up little space, but the corners, joints, and trims were pushing the vertex count up exponentially. This would eat up memory and cause the game to slow down when creating the mesh.

Building Blocks 6

6) To solve the performance issue, I created new trim types that end in a triangular point, forming 1/3 of a corner. These special "corner trims" each had the same vertex count as regular edge trims, fewer vertices are needed all over the mesh. There are four trim types that each have a different texture. One with corners at both ends (wood), no corners (white), and corners in one direction (gray and orange).

7) See the first screenshot on this post. It was very tricky generating the code that would assign the various trims but it was worth it. The pictured shape would have 2015 vertices in the older system, whereas in the new system, it has 1176. A good start, but it still needs more optimization. In addition, it looks better without all of those knobby corners everywhere.

The next step is to allow for larger block structures, allow the structures to be saved to the level file, add normal maps/other texture sets, and create "blocks" that are not cube-shaped (for thin walls, gates, etc). Diagonal or curved blocks are also a possibility.

Posted in Uncategorized
2 comments on “Building Blocks
  1. bigedward87 says:

    It looks really cool, I like how it ends up looking like it wasn't JUST made with blocks, more so than say Minecraft.It would be cool to see some slight variance in the scale of the blocks, like you do with wall blocks, so you could build things and then add little details.Thats a lot o' verts!Would you might to post a screenshot in wireframe?If I built a house on the wall, as a citizen of the wall, I would build it on wall blocks; but then you'd have to worry about someone pulling the wall blocks out from under your house. That said, you might be able to have what looked like a modest home on the outside with 5,000 square feet in recessed wall for a nice den or spacious kitchen 😉

  2. Michael says:

    Thanks. It does look rather flat when it is just blocks, the trim goes a long way to alleviating that. Changing the block size would not really be possible based on the way I made this new system. It's 1 block-per-unit really, that's how it's stored in memory. To do half-blocks or double-sized blocks would require a ton of work, given the new variations of the trim that would have to be produced.

    I'll do a wireframe image later on. Really just working out the many kinks now, in addition to redoing the prop system.

Leave a Reply

Your email address will not be published. Required fields are marked *