In Minecraft, I had found a few regular dungeons, on a Youtube video video, I saw a double dungeon and on the Wiki I found out that triple dungeons can spawn. Just then I thought "Can a quadruple dungeon spawn?" I researched it for some time and the Wiki doesn't seem to have to have it... Also, if it is possible for quadruple dungeons to spawn, what is the limit of dungeons able to spawn together.
Yes, it's possible. There is theoretically no limit, but the likelyhood of dungeons spawning with their sides touching is a rapidly plummeting percentage chance as the number of dungeons you're considering increases. To write this answer about dungeon spawning density I delved into the code. The more thorough explanation there will be helpful, but the short version is:
- On generation, a chunk will try 8 times to spawn a dungeon in 1<=Y<=128.
- The location to try is determined randomly, and only then does the game check if it's a legal spot to spawn it, so many of those 8 tries will fail.
- Dungeons only spawn under very precise conditions that depend on there being just the right amount of air blocks where their walls would be.
The game will not try its best to fit a dungeon in – it will blindly randomly determine the dungeon's size and location, and if it doesn't fit perfectly, it will simply not be placed.
Also note that multi-spawner dungeons are not something that the code actually tries to create – they're simply accidents of placement of single dungeons adjacent to each other. In particular, notice that the 8-per-chunk limit is only a limit per chunk, so multi-spawner dungeons can easily be made up of single dungeons from different neighbouring chunks. That's why the theoretical limit is infinite. The per-chunk limit is only useful to know because it illustrates how often (or not) the spawning algorithm creates dungeons at all.
So, to spawn four dungeons together would require that 4 spawning checks (in the same or adjacent chunks) happened to randomly place dungeons within 4 blocks vertically of each other in a chain, and that the X/Z spots randomly chosen just happened to be exactly far enough apart to make their walls line up in exactly the right way to satisfy the air-block tests that the dungeon spawner does. The likelyhood of this is very low! But it could happen. It becomes slightly more likely if there are narrow tunnels that could join them, but "slightly more likely" in this case is still a very, very small chance.
But wait! It's worse than that. We don't care about how often they spawn, but how often we discover them.
Add in the likelihood that, even if a chunk did spawn a four-dungeon dungeon, you'd probably never dig into that part of the world to discover it; and the chance of finding a four-dungeon dungeon then becomes almost vanishingly small.