Structural Integrity in Block Games

David Stark / Zarkonnen
16 Apr 2023, 11:54 a.m.

I've been playing a bunch of Vintage Story (think a more survival-oriented Minecraft). One of the things I keep returning to is how I'd like a structural integrity mechanic for buildings, so that the things you build have to make sense, and so that higher-quality building materials matter more.

So today I coded up a little web-based toy for how I'd handle this.

The way this works is that each block has a structural strength value that's defined by the blocks underneath and next to it. Going from one block to the next, different materials lose different amounts of strength, as they are more or less suited to supporting things horizontally, vertically, or diagonally.

For example, stone blocks can be stacked up very tall, but they're not good at supporting things horizontally or diagonally, so for roofs you want to switch to wood.

Materials also have a maximum amount of structural strength they can transmit, so for example, canvas can't really carry much atop of it.

Finally, there's also a penalty for having both horizontally adjacent blocks be air, which means that double-thickness walls are stronger, especially for the crumblier materials.

This implementation (source) is a naive 2D one, so it's not efficient at all, but with a large 3D world it should be possible to only have to recalculate local effects when a block is added/removed, so the performance would be OK.