What are all of the rules that determine where secret rooms appear?
Solution 1:
Looks like somebody on Steam forums decided to answer this question and to use SCIENCE! while doing it.
To put it simply he divides the room in four categories(he calls hidden rooms those that in my other answer I called Top Secret Rooms):
- Corridors: two exits, they connect the other rooms, no decision about where to go;
- Junctions: three or four exits, you have to decide where to head next;
-
Terminators:
they come from the future and have a funny Austrian accentonly one exit, all of the special rooms are terminators(shops, treasure rooms, bosses and mini bosses). The hidden room is a terminator - Secret rooms: these are different from the other rooms and have special generation rules.
So, basically, every floor is generated randomly, then the hidden room takes the place of one of the normal terminators, then the secret room is put into place, AFTER all of the other rooms have been placed. Please note that the floors have a size limit: the map will never be bigger than 9x6 tiles (width x height). Also every floor has its specific room number:
- Basement / Cellar 1 - 8 or 9 rooms
- Basement / Cellar 2 - 11 or 12 rooms
- Caves / Catacombs 1 - 13 or 14 rooms
- Caves / Catacombs 2 - 16 or 17 rooms
- The Depths / Necropolis 1 - 18 or 19 rooms
- Everything deeper - 20 rooms
While I disagree with the completely random placement of the secret room (he says that every wall is rolled randomly to see if it connects to a secret room), his theory is pretty sound, and applies quite well with what we already know about the behaviour of hidden and secret rooms.
To summarize:
HIDDEN ROOMS:
-
are terminators. This means they cannot be placed near more than one other room. They also cannot be placed near other terminators, and this includes every other special room(treasure, shop, arcade, curse, challenge). Be aware however that a room that looks like a terminator may be a corridor leading to a hidden room.
will never fall out of the normal 9x6 grid. If you have a potential wall candidate that would bring you out of the grid, it means that there's no hidden room back there.
they're intentionally hard to find. No tarot card and no item (with the exception of X-ray Vision and Spelunker Hat) will help you in finding them. Anyway they're potential teleport destination, so you may be lucky and find them this way. Other than that, you have to use your bombs and your brain.
Secret rooms instead are generated in a completely different way from the other rooms. Secret rooms are placed after the rest of the level has been created. Vimescarrot, the creator of the post on Steam forums, proposes the idea that ANY wall can lead to a secret room:
Every exitless wall that already exists in the game, but isn't linked to a room (so, basically, all of the blank walls) is given a number, and then a random number is generated. Whichever wall matches that number - that's the wall that becomes an exit, and leads to the secret room.
However, I disagree with this idea. In ~400 runs I have NEVER found a secret room near a single wall, and the only times I've found them near only two walls was when there were no available 3 or 4 rooms spaces. This seems to me a big enough sample to be quite sure of what I've found.
Whichever idea you'll follow anyway, it will be more likely to find secret rooms in spaces surrounded by many other rooms.
The secret rooms too will follow the 9x6 rule, so any wall leading out of the grid can be safely left unbombed.
Differently from hidden rooms, there are many items that can help you find secret rooms: the Sun and the World tarot cards, the Map and the Crystal Ball show you the current level map layout, including the secret room. Spelunker hat and X-ray Vision work as well.
PAY ATTENTION: Curse of the Labyrinth completely messes up all these rules. To put it in Vimescarrot words:
I haven't got a ♥♥♥♥ing clue.
Until now nobody has been able to find a pattern in level generation with Curse of the Labyrinth. If you happen to find by chance a secret room in one of those levels, it can be filled with enemies(from my experience I can tell that it WILL be). If you're low on bombs and don't have X-ray Vision get the hell out of there through the exit you came in: if you bomb one of the other walls you may find yourself on the other side without a way to end the level.
By the way, basing on a small sample(2 runs), it looks like that, similarly to shop rooms, an XL level will only have one secret and one hidden room each.
Solution 2:
The hidden room also counts as a border for the secret room, considering that it is just converted terminator. Secret rooms that are only bordered by two normal rooms are also connected to the hidden room.