Pac-Man Has Parallel Universes

- Video Games

Pac-Man

Back in 2011, I contacted Jamey Pittman, author of the excellent article The Pac-Man Dossier, because I wanted some help in order to figure out how the infamously-glitched 256th level of the original arcade version of Pac-Man actually worked during gameplay. Thanks in part to his technical expertise, I was able to reverse-engineer the information I needed to answer most of the questions I had about this level, and even drew maps of it.

While I offered him at the time to publish my findings and maps as a supplement to The Pac-Man Dossier, he never did. I did publish some of the information on forums in the past, but I didn't go into the details back then, and as far as I'm aware it didn't reach the broader Pac-Man community.

So here are my findings, fully published for the first time publicly below, along with a polished version of the map I made back then!

What's so special about the 256th level of Pac-Man?

Normally, when starting a new game of Pac-Man or whenever the player advances to the next level, the following maze appears:

Pac-Man, all versions, normal level

Note that I am omitting the HUD from the screenshots for clarity.

However, when reaching the 256th level on the original arcade version, a bug in the game causes the fruit counter in the HUD to not render correctly, overwriting the right half of the playable area with garbage data. To add to the confusion, there are fake dots and invisible dots mixed in as well, along with tiles flashing for no reason where power pellets are normally supposed to appear in the corrupted zone.

The resulting maze does not have enough dots for Pac-Man to eat to complete the level. While there are nine dots hidden in the garbage data that respawn when losing a life, it's still not enough to do so even after playing perfectly and sacrificing all available lives for this purpose. Because of this, this 256th level is known as the kill screen.

Here is what the glitched maze looks like in the Japanese version:

Pac-Man, Japanese version, 256th level

Here is the same maze in the international version:

Pac-Man, international version, 256th level

Note that the international version has additional glitched graphics, specifically the orange "PN QO" at the very top of the screen in the middle, the white "DB EC" at the very bottom of the screen also in the middle, and the pinwheel-like thingy immediately above it. I only discovered this difference by myself during my investigation.

For a technical analysis of why this bug occurs, I highly suggest reading Splitting Apart the Split Screen by Don Hodges.

Expert players found relatively quickly an easy way to maximize score on this level. It was discovered that when a ghost is lured in the rightmost column, they no longer turn around and simply move vertically in a straight line while endlessly wrapping around the screen. Jamey Pittman even made a video where he showcases how to easily trap Blinky, Pinky and Inky that way by parking Pac-Man in a bottom-right corner from the start. Navigating through the glitched maze is trivial afterwards despite the glitched mess since there is no longer any danger to worry about except for Clyde which is barely a threat due to its cowardly AI.

This exploit is possible because of the way the game is programmed to handle when a character wraps around the screen. In the case of Pac-Man, he can't turn up or down while entering the left of right column even if there are no walls. In the case of ghosts, when entering one of these columns, they pick a direction and their AIs and collision with walls becomes disabled until they emerge back on the other side horizontally, which never occurs if they turned up or down at the edge of the screen.

While this was interesting to know, I wanted more clarity about the level data itself still.

The glitched level data

Thanks to Don Hodges's article, I knew that the playable area was made out of a 28x32 grid of 8x8 tiles, that the data was located in VRAM in-between addresses 0x4040 and 0x43BF for the graphics of each tile and in-between 0x4440 and 0x47BF for their corresponding colors, and that the sprite order was starting at the top-right cell, then going from top to bottom, then from right to left.

I also got the following message from Jamey Pittman through our correspondence back then:

From a quick glance at the character tile set in RAM, it looks like these would be the relevant entries for the standard Pac-Man maze:

  • Dot: 0x10, 0x11
  • Energizer: 0x14, 0x15
  • Blank: 0xC0 - 0xCF
  • Maze Walls: 0xD0 - 0xFB
  • Blank: 0xFC - 0xFF

Of course, you would have to know how the code references these and (more importantly) how it reacts to unexpected values from other character tiles when half the screen is corrupted to completely understand why the split screen works as it does.

The color palette memory map is also used in Pac-Man to mark the two zones around the tunnels (slow ghost movement) as well as the two zones where ghosts can't turn upwards and must move only left or right. The majority of the color palette map entries are 0x10 for the maze. The tunnel areas entries are 0x1B and the "no turn up" areas are 0x1A. The ghost movement subroutines translate their current (x,y) tile position to the appropriate color palette value for the same tile and check specifically for these two values and branch appropriately if found.

I eventually discovered that 0x11 dots cannot be eaten by Pac-Man. Only 0x10 dots can.

He also sent me the following message about the game's code a little bit later:

Here's a some of Blinky's movement code:

1c0e  cd5220    call    #2052   ; convert Y,X pos to color mem map location
1c11  7e        ld      a,(hl)  ; load A with color of screen location of ghost
1c12  fe1a      cp      #1a     ; == #1A ? (don't change direction)
1c14  2803      jr      z,#1c19 ; yes, skip next step
1c16  ef        rst     #28     ; no, insert task #08 to control red ghost AI
1c17  08 00

Here's a subroutine each ghost calls to check whether or not they're in a tunnel:

; Before calling, bc register = mem address to write boolean result
205a  cd5220    call    #2052    ; convert Y,X pos to color mem map location
205d  7e        ld      a,(hl)   ; load A with color of screen location of ghost
205e  fe1b      cp      #1b      ; == #1B ? (tunnel area)
2060: 20 04     jr      nz,$2066 ; no, skip ahead
2062: 3E 01     ld      a,$01    ; A = 1
2064  02        ld      (bc),a   ; store into ghost tunnel slowdown flag
2065  c9        ret              ; done
2066  af        xor     a        ; A = 0
2067  02        ld      (bc),a   ; store into ghost tunnel slowdown flag
2068  c9        ret              ; done

And later in the same message:

I do have a highly-annotated disassembly of the code but I'm not disposed to make it available. I will point you to some relevant portions to help you out, however:

  • Blinky's movement routine: 1B36 - 1C4A
  • Pinky's movement routine: 1C4B - 1D21
  • Inky's movement routine: 1D22 - 1DF8
  • Clyde's movement routine: 1DF9 - 1ECF
  • Blinky's chase/scatter A.I.: 2730 - 276B
  • Pinky's chase/scatter A.I.: 276C - 27A8
  • Inky's chase/scatter A.I.: 27A9 - 27F0
  • Clyde's chase/scatter A.I.: 27F1 - 283A

One last important detail that I noticed myself was that the "READY!" message causes the corrupted tiles on which it appears to revert to normal, which occurs when starting the level and whenever the level resets after Pac-Man loses a life.

With that information, I booted up the game, used the rack test feature to skip to the 256th level, dumped the game's memory and got to work.

My technical analysis

The first important finding I made, beyond the fact that there are two different versions of the kill screen, was that the difference between versions is purely cosmetic. The difference occurs because data was added in-between 0x3D00 and 0x3D07 in the international version for localization purposes. Specifically, the data in that version is equal to 9603424F4E555340 in hexadecimal, which spells "BONUS" in ASCII starting from 0x3D02. In the Japanese version, the same memory region is empty.

My second finding was to discover that in the entire corrupted region, all tunnel areas where ghosts normally slow down and all areas where ghosts can't turn up are deleted, and no new ones are created. While it is possible that I overlooked a detail in the code, the code is simple enough that I would be surprised if I did.

My third finding is probably something that expert players already knew but that I had not seen documented anywhere. Specifically, when Pac-Man enters the leftmost or rightmost column, he can no longer turn up or down and he ignores collision until he returns in-between these columns. Because of this, he may get stuck in a wall on the other side and softlock. Regardless of where he crosses the screen that way, the off-screen corridor buffer applies. Note that the off-screen buffer only exists when crossing through the left and right edges of the screen.

My fourth and most surprising finding was that Pac-Man has parallel universes. Specifically, a mirror of the maze exists above the visible playable area shifted 7 tiles to the right, and another mirror of the maze exists under the visible playable area shifted 1 tile to the right. Ghosts can freely access these parallel universes, assuming their AI guides them there, in which case a hurtful image of them will appear in the visible playable area seemingly going through walls. This is because the conversion formula from a character's (x,y) grid coordinates to VRAM is 32x + y + 0x4040, and because y is an unsigned 8-bit integer.

Pac-Man cannot enter these parallel universes as he simply wraps around the screen vertically instead, but he can still hit a wall in them if one exists at the edge. If he does wrap around, *his position will shift by 1 tile to the right when going down and 1 tile to the left when going up.

My map

While I'm far from the first person to map the 256th level of Pac-Man, I believe that I am the first to include zones affecting only ghosts and the immediate parallel worlds.

As such, here is the map that I made combining the level data I obtained to recreate what the level should look like without the glitched graphics based on the above:

My decoded version of the 256th level of Pac-Man

Legend:

Again, note that the nine dots on the right side of the screen respawns after Pac-Man loses a life, but not the other normal dots and power pellets.

There is more parallel world zones that I haven't mapped beyond the edges of this map, but I currently lack the time and motivation to investigate further and ensure of its accuracy.

And finally, here is the same map again, but this time with the graphics of the international version overlaid on top of it for reference:

My decoded and complete version of the 256th level of Pac-Man

Header image and game graphics: © 1980 Bandai Namco Entertainment Inc.

Related content I wrote

An Ace of Spades featuring a skull design, with similar Aces of other suits in the background

How to Play Liar's Deck (From Liar's Bar) - Full Rules and Variants

- Video Games, Game Design

The following are the rules of the Liar's Deck bluffing card game and its official variants, first introduced in the Liar's Bar video game. These rules are based on its in-game tutorials, observations I made from gameplay sessions, and comments from the game's developers. While there may be a few…

Fireworks

The New Open Source Video Game Randomizer List Is Now Live

- Video Games, Programming

Time to update your bookmarks! After a few months of work behind the scenes, the new open source version of The BIG List of Video Game Randomizer is now live for your enjoyment, with dark mode support and a brand new UI for better readability! The new URL is: https://randomizers.debigare.com/ (The…

Open treasure chest with a question mark in it

The Future of the Video Game Randomizer List

- Video Games, Programming, Anecdotes

It's hard to believe that it's been almost 8 years since I first posted on the ROMhacking.net forums a list of video game randomizers that I found online, and that it would evolve into the massive project it has become today, with almost 900 entries currently being listed. It's always a strange…

Playing with an Xbox controller

My Personal Video Game Completion List

- Anecdotes, Video Games

I thought it would be fun to track the long list of video game that I have beaten and/or completed for reference, so I've done just that! There may be a few mistakes here and there due to secret features unknown to me, or due to misremembering details of my past gaming experiences, but I believe the…

Brandon Dillon's portrait in Hack 'n' Slash

After 8 Years, Double Fine's Hack 'n' Slash Secret Room Has Finally Been Cracked

- Video Games, Security

In the history of obscure video game secrets, not many has been quite infamous as the SecretRoom.lua puzzle in 2014's computer hacking game Hack 'n' Slash by Double Fine. Since the game's release, a mysterious encrypted file was found in the game files, yet despite the very nature of the game being…

See all of my articles