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.
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.
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:
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.
3) In the above screenshot, I used a white stucco texture for everything and was using cubes to mark outer corners.
4) I’ve added new sperical joints for inner corners. My first pass at the block constructor was completed.
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.
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.