Roguelike procedural generation help

thanks. is there a way to say have another clip have all the possible door arrangements of a room to be layered on top of each room so each room can look better while having the rooms have collision?

@Hamzah_Al_Ani
So nice !!!
thanks for sharing your toughs and methods !!!

@gamer_boi
You’re working on a grid system and it’s likely you breaked apart your clips so collision (hittest) wont be efficient. It’s probably better to use your character position to know where you are

1 Like

Yes, it is possible, and yes, the rooms were broken apart in the last file! You can remove the break apart line of code by deleting line 14 of the load script inside of the rooms clip, but you don’t need to.

The path objects aren’t broken apart, however, which makes it easier to find the possible door arrangements of a room (not to mention an XY array I used that has all of the door locations marked, “rooms.level1.paths”).

Since there is a path object between every room, you won’t even need to keep track of the room locations after they’re broken apart.

I agree, the character’s position will play a major role in determining whether or not

Note

The first room isn’t broken, only the clones are, so it could be your starting point as well. You could also find the location of the last room easily, and add an end there, or if you want, we can calculate the distances between all the rooms and the beginning to find the farthest one based on the X and Y values.

Note about broken apart clips

It’s important to mention that if you’d ever want to change the size of the rooms clip, after the clip is broken apart, you will find that the path objects inside of the clip didn’t change size.


For this reason, if you want to change the size of the rooms, you’ll have to go inside of the actual rooms clip and change the size from there rather than from the project’s timeline.

There’s no need to detect the room, if you were to snap the rooms to grid based on their width, then you can have a create a wall clip that’s snapped on the same grid based on the x and y of the player, and rooms.level1.paths array should return the x and y values of all “doors,” so if you were to also snap a clip based on the width of the grid divided by two, based in the player’s x and y as well, and check if the rooms.level1.paths array has the x and y of that clip, then check if the player is touching that clip (make sure to give it a reasonable width+height), then you’d know whether or not the player is inside of a path.

My Project11-24-2022_22-15-42.wick (4.4 KB)
(^ note that this project is a bit buggy+rushed, it’s only an example of how to detect rooms for collision)