Author Topic: Brick Efficiency Script  (Read 1087 times)

This has been made before. Basically, it's a script that combines adjacent bricks of the same colour and events to any available larger brick.


Or if DrenDran still has his, he could release it. Or if Red_Guy still has his, he could make it available again.

This has been made before. Basically, it's a script that combines adjacent bricks of the same colour and events to any available larger brick.
seems like raycasts + math + datablocks = this
I thought you could to this ottobro

seems like raycasts + math + datablocks = this
I thought you could to this ottobro
I don't know how exactly to do it an efficient way. If someone wrote out some pseudocode or a thorough explanation I could do it myself.

the dirt/dig/trech or whatever mod that works by placing large brown cubes and cutting out of it and placing it back might be a good reference, because I think I remember it recombined bricks as they were placed back

I'm thinking that control z might have some problems with this if it were made

I don't know how exactly to do it an efficient way. If someone wrote out some pseudocode or a thorough explanation I could do it myself.
on brick plant
parent brick plant
if a brick has a brick on either side
check to see if brick has same properties
if has same properties
get both sizes
take the datablock.bricksizevariableX/Y
find if there is a better one
delete old and put in new
brackets
done
C:

That should do it.
However, the checking on the sides will be difficult.

too much of a pain to make for little results. what if i don't want my bricks combined? what if i want to undo the bricks, what if the combined brick is no longer able to be deleted because it became a support for other bricks? just learn to build better.

What if he created a heightmap-based terrain generator, and wanted it to not spam, and actually prevent spam in that way instead of incorporating it into the script entirely.

too much of a pain to make for little results. what if i don't want my bricks combined? what if i want to undo the bricks, what if the combined brick is no longer able to be deleted because it became a support for other bricks? just learn to build better.
Your helpful

Fob and I were talking about this earlier, anyway. This is a good idea, as far as I'm concerned.
However, here's another problem; trench dirt only merges into larger bricks when they're aligned to the grid. I don't think that is quite what the OP is looking for, although it's a start, because that wouldn't be as efficient as possible. There would be bricks on the edges that are left out.

However, I think I can provide explanation for the trench dirt's reason for doing that, and why it would be difficult to do otherwise.
"If a brick has a brick on either side"
This right here is kind of uncertain. It wouldn't be on either side, it would have to be on two sides, then the new corner between those two, then the other four areas above or below those. The problem is now "Which ways do I check?" With the trench bricks, it knows which ways to check because...
...I have no idea how to explain this concept. However, it has to do with the position of the brick in question in relation to the grid of bricks overall in the trench area.

Hope I was helpful.

The trick to a brick efficiency script is optimizing in as many different ways as possible. So that the optimization runs several times, and then the combination with the least bricks is chosen as the final outcome.

It'd be better if it didn't do it instantly, but you'd have to leave the game and open it up as a 3rd party program instead.

The trick to a brick efficiency script is optimizing in as many different ways as possible. So that the optimization runs several times, and then the combination with the least bricks is chosen as the final outcome.
You're smart.

It'd be better if it didn't do it instantly, but you'd have to leave the game and open it up as a 3rd party program instead.

I might actually just make this. It would take a .bls file and output a new, optimized .bls file together with a .zip file which contained some custom-sized bricks to use for regions.

I imagined something like this could be done:
  • For every brick, identify nearby bricks with equal properties and attempt to calculate all possible cuboid regions to combine them in.
  • For every possible region, try different combinations to find the solution that would give the least amount of total regions and create a list of all the last decided regions.
  • For every last decided region, generate a .blb and script for it, then remove the bricks intersecting with the region's boundaries and create a brick of the new type there instead.
  • Combine all the generated bricks into a .zip file.
  • Export the new, modified brick set to a .blb file.
  • Provide a download page with both.
« Last Edit: February 28, 2012, 07:47:07 AM by Port »

Oh.
Oh wow.
That's pretty brilliant.

The problem is that the new bricks would begin to clutter up your add-ons, wouldn't they.

NOWAIT
They would generate all in the same folder, I'm dumb.

Also, wouldn't it be a cuboid area, not spherical?