Block generation

What I’m asking


I basically need to sort of create a room generation but with jenga blocks. Each jenga block specifically designed to have stations, entrances that allow to to other blocks or just go out of and fall down. (All blocks are hollow)


The red text at the end says “entrances”

When I mean connections I am not talking abt welding and sticking together but connected through pathways such as shown in the green.


plan so far:


Each full block (the large rectangles) are 42x16x16 in studs. Each full block is made of 3 normal blocks.

The middle block and the first and last blocks. Which are just one type of block but rotated


Last and first are same type of “blocks”

In the final outcome:


All full blocks should be accessible no matter where you are


Final details


  • The height of the blocks should be customizable. :white_check_mark:
  • There will be special full blocks that are already made that need to fit in. :white_check_mark:
  • Be able to force types of blocks (its amount and its level placement like if it’s on the high or low and mount of each of it) :white_check_mark:
  • every souls be made block by block and needs to be unanchored and mini blocks need to be welded together :white_check_mark:
    are*

So how would I achieve this in code?

ignore the bad drawing an hand writing :x:

1 Like

First of all, A+ question in terms of info provided.

Your requirement that every block be reachable is simple to check, but you can make decisions to affect how hard it is to actually generate a tower with this property. To check it:

  • Take a random block and put in the “Reachable” list.
  • Check each block that is connected to this block via an entrace, make sure it is not already in Reachable, then add it to Reachable.
  • If you added the block, repeat the above check for its entrances (recursive step)
  • Repeat this until you’ve checked all entrances to the first chosen block
  • If the Reachable list has all the same elements as the full list of blocks, every block is reachable.

You may find that a good way to ensure a valid tower can always be generated with all the required special blocks is to let it keep growing until those conditions are met. This affects your height requirement.

For welding, you can just weld everything to the platform, unless you want the welds to be realistic for some other reason, such as having a block fall if it is no longer supported.

Ensuring that a valid tower is always possible for a set of constraints (set of special blocks, where they are placed, forced types of blocks) may be really easy or really hard. It would be quite hard to answer, so your best bet is to just try it once you’re able and see how often it fails.

1 Like

As for actually coding this, I think its a good idea to separate it into different components:

  • A component to choose blocks, which is random but affected by height and which special blocks are left to place.
  • A componentfor placing a block. It will have the possibility of failing, so it needs a way to return that failure so a different block can be picked.
  • A component for placing groups of blocks. Layers seem like a good way of organizing this for several reasons. You can rule out certain placements early if its obvious they will result in an invalid tower. E.g. a layer with no entrances on top or no entrances on the bottom will make some part of the tower unreachable.

The smaller of a group you choose, the simpler the placement problem becomes, but the less convoluted the resulting maps can be, which might not be acceptable for gameplay reasons. If you use single layers as your group of blocks, then the path from bottom to top is guaranteed to have a no-backtracking path. If you generate 3 layers at a time, then backtracking routes can exist up to 3 layers deep.

1 Like

Thanks for responding!

The game is a jenga like game so the mini blocks in each full block must be welded but that’s easy


I think tho tha I may have made this harder for my self not thinking out side the box enough. What if instead of 16 by 16 hollow cubes. It was panels


Instead of mini blocks we had panels

This would decrease modeling time and also have more control when coming to generation. However there would be some issue regarding my “stations”

There are small little structures found in the blocks however. Adding these in naturally + having a max and minimum amount each can occur in one full end result is something of its own issue because there are also bottom entrances and you cannot put these against a wall which isn’t exactly a wall but another entrance

Ok, so once the entrances are placed (in any given block) there is a known number of valid places to put stations?

1 Like

I don’t know. I only have problems not solutions :sob::x:

Well does a place for a station depend on anything other than the entrances in that block? If not, then you can count the number of station locations as soon as the entrances for a set of blocks are decided.

1 Like

All structures must be against a wall. And sometimes two can be placed together if it could

Also are all the layers just alternating 3-rows then 3-columns like a jenga tower?

1 Like

Yup the whole game is based off of jengas



You can see in the diagrams. The lines missing were intentional to show that mb

Jenga Tower.rbxl (82.1 KB)
Example of Jenga Tower Generator.

1 Like

My suggestio: make all variable block (1-6 entrance) which front face always the entrance one, from there entrancr generate a block(make it face to the last block). And one the last block having above 2 entrane the loop will running

1 Like

Jenga Tower2.rbxl (86.4 KB)
Example of Block generator script.

1 Like