Author Topic: Brick Count Simplifier  (Read 2119 times)

For a while I've been thinking if I wanted to build really detailed terrain with small bricks, I'd have to take a lot of time making sure the bricks are big enough to reduce brick count.

This problem could be solved with the brick count simplifier.
What I mean by a brick count simplifier is a script that can take multiple small bricks of the same color and replace them with the biggest brick available. For an example, in trench wars, the trench dirt has similar mechanics. If there are 8 small cubes making one bigger cube, they all become one brick. This can really help save a lot of time when building detailed terrain with even just 1x1 bricks.
I request this because I haven't been able to find anything that does something like this, but for all bricks.

Also, maybe this script can run with a command to execute it such as /simplifybricks.



This has been made many, many times but has never been publicly released because nobody got it working perfectly.

Doing this perfectly is an extremely hard problem to solve.  The only way to find the best solution every single time is to run through every possible permutation until you find the one with the lowest brickcount.  If I placed 400 1x1 bricks in a row, the number of permutations would number in the quadrillions, at least.  Intuitively, we know that the lowest brickcount (with default bricks) would be to replace the 400 1x1 bricks with 25 1x16 bricks - but it's easy to wind up with scenarios that are far less trivial to solve.

The Trench Digging add-on doesn't actually solve this problem; it's very susceptible to imperfect combinations if you dig dirt a bunch of dirt out of the ground, and then try to put it back.  If you've ever been on a Trench Warfare server and tried to fill in holes in the ground only to get messy unorganized cubes, you'll know what I mean.

I don't think you have a chance to do this with torkscript because it's so slow. You'd have to send the brick positions over to a program and run the optimizer in native code, otherwise you'll wait days for it to calculate things. And you still wouldn't get the absolute lowest brick count possible.

basically you combine bricks to make a smaller brickcount like trench wars
would be p cool

This is not very difficult to do with just a few brick types.  See trench wars code for reference.

Trench warfare has the advantage that every brick is a cube and can easily and predictably combine together. It's not nearly as straightforward for any other scenario.

could this conceivably be an external program? one that you just run on a given save file outside of blockland? not in real time?

could this conceivably be an external program? one that you just run on a given save file outside of blockland? not in real time?

A save file alone is not enough, you also need to have all the datablocks to figure out the size of custom (cubic) bricks used in the build