# Were the dungeons in Legend of Zelda designed to fit together?

As can be seen in the image below, the dungeons of Legend of Zelda fit quite well together.

Were they designed to be, or is this just a coincidence?

Does this make them easier to store, with the empty spaces used for caves for instance?

• Rad. I'm glad this exists. That layout is 16x16, which points to a code/memory reasoning in my mind. 16^2 is 256. Eight bits hold 256 values. All very computery, as opposed to a layout like 17x17 or 5x20. That could be a coincidence, of course. As I recall, the 2nd run through (after saving Zelda) had completely different dungeons, in the shape of numerals. Level 1 looked like a '1', and so on. Do those fit nicely into the same size grid? May 4, 2018 at 2:07

As seen in that incorrect image, the levels seem to merge well. This wasn't a case of "Let's take these shapes, and see if they... whoa! They fit together!"

It was more like, "Here's a big rectangle. Let's cut away some shapes."

It's kind of like starting with a big batch of cookie dough, or silly putty, and cutting shapes out of that. Then, at the end, saying, "Look at how all those shapes fit neatly together!" Well, yes, of course they do. Because having all the pieces fit together was not an "end product" that they had to work to try to create; it was actually the starting point.

The Cutting Room Floor: Prerelease: The Legend of Zelda has some information, including those drawn maps, and interview info with Miyamoto about this.

Tezuka: Basically, we were going to make lots of dungeons using one square per room, and lay them out like a jigsaw puzzle.
Iwata: In order to fit in as many dungeons as possible given the limited memory, you were making them like you were doing a puzzle.

Another spot on the web that discusses this is the Siliconera.com article: "Thanks To A Mistake The Legend Of Zelda Got A Second Quest", which also shows the layout of the levels in the original hand-drawn maps seen at this article on the web.

The "Mistake" in question (as noted by The Cutting Room Floor: Prerelease: The Legend of Zelda and Siliconera.com article: "Thanks To A Mistake The Legend Of Zelda Got A Second Quest") is that during the game's development, half of the memory used for map layout got lost for a while. So they crammed in the levels in the remaining space. Then the memory got found again, but they determined that the game length felt pretty good after they crammed things into half the space, so instead of making the levels twice as wide to explore through, they just made other levels and made it so that you access them through the "second quest".

Having this "mistake" revealed helps to explain why there is a pre-release screenshot, that you can view on The Cutting Room Floor: Prerelease: The Legend of Zelda, that shows Level 2, Moon, that looks twice as wide. At one point, the levels we have were apparently going to have about the same shape, but twice as many underworld rooms per quest (and half as many quests).

So, yes, as noted above, the image used in the Question shows a layout that does not match how the game stores the levels in memory. Level 9 is actually located west of levels seven and eight, not east of levels seven and eight. We can see that in the hand-drawn maps shown in the articles mentioned above.

Also, the map layout is known. Some software named Dungeon Master, a map editor makes clear that if you walk off of any of those five "world" maps, then you leave the area and go back to the overworld screen with the corresponding entrance. (If you leave the overworld, it brings you to the start screen where you get the Wooden Sword). So walking off the outer edges makes it pretty clear what the actual level layout is. Also, walking between levels 9 and 7 is possible with modified walls, so that makes it rather clear that the East side of Level 9 touches Level 7, not the edge of that area of underworld map data.

• How do you know what the correct positions are? Does the game actually store them like this? May 4, 2018 at 6:21
• Looking at the overworld map again, it's more likely that the underworld map is two maps of 16x8. as well. That explains the sharp horizontal divide between dungeons 1-6 and dungeons 7-9: those are two separate maps.
– SQB
May 4, 2018 at 6:42
• @SQB : Correct, there are five maps. One overworld, two underworld for first quest, and two underworld for second quest. The 2nd quest overworld involves some code tricks to make the changes to the landforms for a few screens, and of course details about where the secrets are. May 4, 2018 at 7:15
• SQB: While you were making that quest, I was, in fact, actively editing the question as I located some authoritative sources. @wizzwizz4: I'm deleting my earlier comment to you, as the info has now been moved into the answer which has now been further expanded. Thank you for the questions. May 4, 2018 at 7:55
• @TOOGAM do you think you can include the information about there being 5 maps in total as well? Also, do you know if I'm correct in my guess that the empty slots on the map are used for caverns and miscellaneous other screens? I don't think that would warrant a separate question.
– SQB
May 4, 2018 at 19:44

Typically in cases like this, they are designed to fit together.

Actually, it's not so much that they are separate maps that happen to fit together, but rather it's just one big map and each 'dungeon' is simply a piece of it. This can simplify the game design because what appears to the player as moving to a new map can be coded internally as simply moving the player to a new place on the same map.

• I'm not completely persuaded; I'd expect there to be a single routine for running a room which exits upon the player exiting the room. So surely it's just the difference between indexing the configuration for the next room as a function of room location + direction of exit, or supplying a next room index directly as room data? I'm pretty sure Jet Set Willy does the latter, as a contemporaneous example. May 3, 2018 at 18:43
• I'd like some sources, as well, though I find it plausible. Developers had to do strange things back then to deal with limited resources, and the Zelda series in particular has a long history of weird little (exploitable) bugs where you can finish the game in minutes or less (sometimes without even needing computer/robot assistance) by doing weird things that manipulate the game's state so that it suddenly goes from thinking you're in the first dungeon to thinking you're in the last room of the last dungeon (which in this case would trigger the ending), or something like that. May 3, 2018 at 20:29
• I'm not sure what you mean by moving the player to a new place on the same map. The dungeons aren't actually connected at all in the game, and there is no way to move directly from one to another (each dungeon has a separate entrance in the overworld). May 3, 2018 at 21:45
• @Carmeister Not directly, hitting the entrance teleports the player to another part of the same map, potentially somewhere far away. The dungeons are right next to each other, the only thing that stops you from walking into another are the solid wall blocks. May 4, 2018 at 1:00
• It sounds like it's similar to the way that bitmap images for icons in applications are often stored as one big image, with the icons specifying a size and offset into that master image. May 4, 2018 at 1:58

I don't know whether this was deliberate for Legend of Zelda, or whether it used any of these techniques, but here are some benefits of doing so:

• It's easier to keep track of the levels if you're storing them like that in the ROM.
• You can draw the whole game on one big piece of paper.
• Going off the edges of the dungeons can be implemented more easily if they're stored like that in the ROM (dungeons don't need to store which dungeons they connect to).