Each room has an integer size in map-tiles (I believe from 1x1 to 3x3, although I haven't played the game for a while). One map-tile is always NxM room-tiles big (the actual number does not matter, the point is you can easily fit rooms together in a map like that and exits are always in the center of a map-tile edge).
These design decisions make a Rogue Legacy-like map generation actually a lot easier. In pseudo code:
Place the starting room. While the map is not big enough: Pick a random 'closed' exit E in any room already placed Pick a random room R from the library of possible rooms (all exits of this new room are 'closed') Pick a random exit E' (opposite direction of E) of R and try to place it in the map so that E and E' connect If that is possible without overlapping with existing rooms in the map: (*) Place R in the map Iterate over all other 'closed' exits of R If there is a corresponding 'closed' exit in the room in that direction, set both to 'open'The check at (*) is actually extremely simple. Since everything is neatly on map-tiles, there is exactly one way how you could place the room in the map and the check could be as simple as a bitmap with one bit for each map-tile.