Week 6-7 A Closer look to the Preset pieces alignment.
Week 6-7 A Closer look to the Preset pieces alignment.
Something I had in mind when first drafting the algorithm for the PGL was the ability to set certain rooms in certain areas within the labyrinth.
After the completion of the rooms attaching and not overlaping each other, I moved onto the part of including the prep-laced pieces.
It is worth to mention that even the pre-placed rooms are not in a constant location but are instantiated within an area set by the user.
I had initially thought to look for open exits close to the open exits of the pre-placed piece and then create a corridor connecting the two exits. But that in its own creates a few new problems:
The corridor connecting the two rooms would need to be curved so it would not collide with the rooms and keep the distance of the corridor equal at all points. Also the creation of a code generated corridor might not be up to the same standard of our custom made rooms.
I initially thought to follow the brilliant video above to create a spline based corridor, but realized it would need a lot more coding and still not look good. Though it is something that I can see been added in a later version of the PLG. So I thought of a simpler solution, when i randomly place the preset room in its area no one really knows were it is set. So I place it randomly and replace again to attach to an existing exit.
The way it works is the following, after we have checked that the new room we attached does not collide with others, and after we have removed exits that are outside the level's dimensions, we check if any of the rooms remaining exits are withing X distance to any of our preset pieces exits.
if it is then we move the preset piece and remove the 2 exit points. Incredibly simple after you realize that you are allowed to remove the randomly placed preset piece.
Something I had in mind when first drafting the algorithm for the PGL was the ability to set certain rooms in certain areas within the labyrinth.
After the completion of the rooms attaching and not overlaping each other, I moved onto the part of including the prep-laced pieces.
It is worth to mention that even the pre-placed rooms are not in a constant location but are instantiated within an area set by the user.
| To set the preset pieces you drag the room to the inspector, set the area dimentions and location where you want it to spawn. |
The corridor connecting the two rooms would need to be curved so it would not collide with the rooms and keep the distance of the corridor equal at all points. Also the creation of a code generated corridor might not be up to the same standard of our custom made rooms.
I initially thought to follow the brilliant video above to create a spline based corridor, but realized it would need a lot more coding and still not look good. Though it is something that I can see been added in a later version of the PLG. So I thought of a simpler solution, when i randomly place the preset room in its area no one really knows were it is set. So I place it randomly and replace again to attach to an existing exit.
The way it works is the following, after we have checked that the new room we attached does not collide with others, and after we have removed exits that are outside the level's dimensions, we check if any of the rooms remaining exits are withing X distance to any of our preset pieces exits.
if it is then we move the preset piece and remove the 2 exit points. Incredibly simple after you realize that you are allowed to remove the randomly placed preset piece.
Comments
Post a Comment