Amilton Diesel Profile picture
Opposite Colors and Organic Symmetry

Jun 5, 2021, 12 tweets

@OskSta, I always feel inspired by #Townscaper and many of your previous works. Currently, I am working in @PlayWonderbox building procedural structures as well. Would be great to share some of our techniques as a thank you.

It started with the classic marching cubes approach. By optimizing rotations and mirrors we were able to reach a dictionary with ~53 pieces. But since we were planning to develop many blocks, further optimizations were required.

By creating some additional rules to combine concave and convex pieces in runtime, we were able to reduce the dictionary to 43 pieces, without any drawback. And there is still room for improvement.

If we unify the two types of vertical concave pieces (single and double), we can combine pieces even further and get to our final generic dictionary of 34 pieces.

Of course not every block is made out of these simple rules. We had to build other systems on top of the marching cubes to support more complex blocks

For instance, houses are composed by ~115 pieces.

The most challenging part was how to specify these custom rules in a way that other team members feel capable of creating new blocks. This kind of modelling has already a steep learning curve, custom solving algorithms seem impossible to teach rapidly and effectively.

We created an interface to represent custom rules for every additional piece. As a 2D representation of all 26 neighbors. Artists can specify simple or complex rules to distribute support models. Configurations go way beyond that. But this is the basic idea.

We improved the system over the development process making it as generic as possible. At the moment, new blocks, even with new behaviors, don't require code to implement. The main limitation we embraced is that you can only specify rules on the direct neighbor of a block.

This sounds like a huge downside. But it's good for performance reasons and to keep the overall complexity in sane levels. On the other hand, blocks can be tagged and custom behaviors can be added if your neighbor is water, or a decoration, for example.

In many cases, we ditched completely the marching cubes dictionaries and created blocks from simpler rules and fewer pieces

This fence, for example, has only 13 pieces and 13 custom rules. Some blocks don't have many different pieces, but have lots of custom rules depending on the behavior complexity

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling