Prefab block based level generation | Generating a level from prefab blocks
I have building blocks for a level, each block has 4 sides:
Front
Back
Left
Right
Each of these blocks have different sides that are open or closed creating different types of blocks: Straights, corners, start, end, etc...
Some of these blocks can be rotated and some of them can't (otherwise some obstacles would be backwards)
I'm wondering how I would go about creating a system that:
Places the start block
Selects which side it should continue the path from
Selects a random block from the pool
Checks to see if it can fit
If it can't fit in it's current state
See if it is allowed to be rotated
If it is allowed to be rotated, rotate it into place, instantiate it and continue the loop
If not, select another block and try again
I've been racking my brain on how I could go about achieving this but I think I'm in a rut. Any help or pointers would be greatly appreciated :D
I did a labirintih like that a littlt bit simpler but in your case i would make 2 solutions
1 make 12 prefabs each for the each possible need
2 make 12 functions getting a certain prefab and placing it at each possible need.
I went on the 2 way
Also remember you need 4 bool s per node and 3 are related to each other