I am in the process of programming a Minecraft like game in Unity. I am currently implementing the block mechanics.

My goal is that when a block is placed, it has an effect on its neighboring blocks and merges with them.

My previous implementation was: I cut a block into 8 parts. Each of these parts reacts to its neighboring parts and decides what part it is.

Block subdivided into coloured parts (Please ignore the area above ...there is still a bug) The different colors represent a part of the block. I didn't paint them all, but I think you can understand.

However, following this logic, I have a lot to do for this style in 3D. To catch all cases, I have 8 * 9 (Corner, Corner X, Corner Y, Corner Z, Single Cube, Transition X, Transition Y, Transition Z) 3D models. Now if I want to apply a different style. One, where e.g. the corners are even rounder, I would have to model 8 * 9 blocks again and enter them. Even if it is possible to work with a symmetry I don't want to do that.

There are already games like Portal Knights that have done it. Notice the bevels in this screenshot, or the trim added only on the outside corners in the next one.

Bevels in Portal Knights

Trim in Portal Knights

Unfortunately I can't find anything about this on the internet... or I'm searching wrong. Does anyone have a concept or an idea that can save me work here? Whether 3D or 2D, Paper or Git I would be very grateful.

  • \$\begingroup\$ Do you really have 8*9 unique shapes? Or can you exploit symmetries to reduce that number? A bevel on the top-left edge looks a lot like a bevel on the top-right edge, just rotated or flipped. I think you can get the number of variations way down this way. It looks like you're implementing a 3D version of a mechanic called "autotiling" in 2D, so searching for "autotile" and "bitmasking" (a technique used to help select the right tiles based on adjacency patterns) might lead you to some insights you can adapt to 3D. You may also be interested in Marching Cubes / Dual Contouring. \$\endgroup\$
    – DMGregory
    Aug 29, 2021 at 22:29
  • \$\begingroup\$ Also, looking at the Portal Knights examples I've found so far, I don't think they're using distinct block models for the different terrain types. I think it's all the same block shape (silhouette) with the same amount of bevel, and the normal maps are doing the heavy lifting of making the materials look different/sharper/rounder/etc. \$\endgroup\$
    – DMGregory
    Aug 29, 2021 at 22:37


You must log in to answer this question.

Browse other questions tagged .