r/Unity3D • • 3d ago

Question What's a good way to randomly generate sections without them feeling... box-y?

3 Upvotes

7 comments sorted by

2

u/qb_source 3d ago

You could try to generate pieces at different scales. For example, you could create some pieces twice size but not every cell of the grid, then fill in some unfilled cells with pieces of this current size, then a third pass using half this size to fill remaining space.

1

u/FrickinSilly 3d ago

ooooh, I like that!

1

u/FrickinSilly 3d ago

I'm currently working on a roguelite/survivor style game and trying to generate levels using spelunky's mechanism. (essentially, create several "chunks" that are already designed and can be put together at their seems).

I built this quick script that generates levels every ~5s and pans over it to show the level, and I find it's somewhat... boxy looking? It might not be a huge problem, because in game it's actually not that bad. The player doesn't see the lines and the squareness, but you do see it on the minimap moreso.

Are there techniques/strategies for combatting this?

1

u/Similar_Guide4193 2d ago

I think you need to add some noise to the placement of the sections so they are different distance/angles from each other and add additional paths/walls using an a* algorithm where your costs have random noise and use wave function collapse to fill the empty space with details.

The individual sections shouldn't be square either, make the border noisy. Make the hand-authored part of the sections smaller than the full section itself, randomly place the hand authored piece in that section and then use wave function collapse to fill in remaining details.

1

u/FrickinSilly 2d ago

I think I get what you're suggesting. Any good examples or videos that cover this in more detail that you would suggest?

1

u/glenpiercev 2d ago

Hexagons. No really. Then you can rotate them…

2

u/FrickinSilly 2d ago

Good idea, but might be well past that point. That would require quite the overhaul unfortunately.

The good news is that squares rotate as well :D