I haven’t gotten around to making it yet, but basically the generator would just create a prefab starting room, then a prefab room connected randomly to one of the starting room’s door, then another connected to said previous room,etc for a specific number of room. When generating it, how would I check if a room is overlapping another one? just have collider on both and check if said colliders are colliding? or are there other ways?
(basically the dungeons would be like immortal redneck, except linear and with branching out of only 1 room max or something)
I would use Physics2D.OverlapCollider if the rooms are organically shaped or are otherwise complex. You can give each room prefab a collider that defines its overlapping area, check for conflicts each time your generator posits a room to place, and remove all of these colliders from the room objects after the dungeon is assembled.
If they use any kind of regular tile system (square or hexagonal cells, etc.) you can just keep track of all the cells that are already used as you generate rooms, and disallow placement of rooms that would need those cells.
1 Like