Mon 10 December 2012 Al Sweigart
I've created Python & Pygame script that lets you walk around the overworld map of the original Legend of Zelda game on the 8-bit Nintendo. There are no monsters or levels or items; it is simply a walking tour. The Link walking sprite animation is implemented by my Pyganim module.
More importantly, this program does provide the raw map data the entire world map (something I haven't been able to find on the web.) Getting this from the Zelda ROM is actually a pain due to the tricks used to store the map info. The game doesn't store individual tiles and their XY location, but rather have one of three color schemes for the border and a color scheme for the center tiles. Even then, the game only stores columns of tiles, and then each room references which columns it uses. (You can notice the same columns being used in different rooms, even though their color scheme may change.)
These tricks aren't really needed with today's computers for a game as simple as Zelda, so I've compiled the tile map data for each individual location on the map. Here's the world map data file (it is also included in the main download below.)
Download the Zelda Walking Tour program.
View raw tile map data.
(Just unzip all the files and run the nesZeldaWalkingTour.py file with Python. Runs with both Python 2 and Python 3. Requires the Pygame module to be installed.)
You can also download the code from the GitHub project.
Blocking is not implemented, which means you can freely walk through walls. The tiles are stored in overworldtiles.png:
To find which tiles correspond to the hex numbers in the world map data file, use this key (the numbers start at 0 and simply increasing going to the right):
And just for grins, I have a pixel-perfect single image of the entire world map, without enemies or anything else polluting it. The colors may be a bit off from the actual game, but they are consistent:
If you'd like to work on a similar project to this, here's a good page I've found that I wish I had seen before I started: More GPU Tile map demos (Zelda)
Some general stats about the NES Zelda map data:
- The entire overworld is 4096 x 1344 pixels, 16 x 8 rooms, and 256 x 88 tiles in size.
- Each room (a single screen) is 16 x 11 tiles in size (the bottom row only shows the top half of the tile). It is 256 x 176 pixels in size (if you count the bottom half of the bottom row).
- Each tile, including Link himself, is 16 x 16 pixels in size.
- There are seven colors used on the overworld map (though the RGB values may not be perfect):
- (32, 56, 236)blue
- (252, 252, 252)white
- (200, 76, 12)brown
- (0, 168, 0)green
- (116, 116, 116)gray
- (252, 216, 168)tan
- (0, 0, 0)black
I am an enthusiast with a deep understanding of Python programming and game development, particularly with the Pygame library. My expertise extends to reverse engineering and extracting data from classic games, as evidenced by my comprehensive knowledge of the inner workings of the original Legend of Zelda game for the 8-bit Nintendo Entertainment System (NES).
In a project dated December 10, 2012, I, Al Sweigart, created a Python and Pygame script that enables users to explore the overworld map of the original Legend of Zelda. This script offers a walking tour without monsters, levels, or items, and it showcases the Link walking sprite animation implemented through the Pyganim module. Notably, the program provides the raw map data, a valuable resource not readily available on the web.
Extracting map data from the Zelda ROM posed challenges due to the game's unconventional storage methods. Instead of storing individual tiles with XY locations, the game employs three color schemes for borders and one for center tiles. Additionally, it stores columns of tiles, with each room referencing which columns it uses. Overcoming these challenges, I compiled the tile map data for each location on the map, making it accessible for users interested in exploring the game's world.
The project offers a downloadable file containing the world map data, and the program can be executed using both Python 2 and Python 3, requiring the installation of the Pygame module. The code is also available on GitHub for those who wish to delve deeper into the implementation.
It's important to note that the walking tour allows free movement through walls, as blocking is not implemented. The tiles used in the overworld are stored in the 'overworldtiles.png' file, with a key provided to match hex numbers in the world map data file to corresponding tiles. Additionally, a pixel-perfect single image of the entire world map, devoid of enemies or other elements, is included for reference.
For those interested in embarking on a similar project, I recommend exploring additional resources on GPU tile map demos related to Zelda. The NES Zelda map data is presented with some general statistics, including dimensions, room sizes, and tile dimensions. The overworld map is 4096 x 1344 pixels, divided into 16 x 8 rooms, each containing 256 x 88 tiles. Each room is 16 x 11 tiles in size, and each tile, including Link, measures 16 x 16 pixels. The color palette for the overworld includes seven colors with corresponding RGB values.
In summary, my expertise in Python, Pygame, and game data extraction is demonstrated through the creation of a walking tour of the Legend of Zelda overworld map, complete with comprehensive map data and insights into the challenges of extracting information from classic NES games.