All courses / Data Structures and Algorithms for Game Devs / Bits and bytes
Under the hood: the level 256 glitch
Challenge lesson, about 13 min, +20 XP
Pac-Man came out in arcades in 1980, made by Namco. It has no last level. Clear the maze and the next level starts. A player who clears 255 levels reaches level 256, and level 256 is broken. The left half of the maze looks normal. The right half is a jumble of letters, numbers and broken pieces of tiles, and nobody can finish it. Players call it the split screen.
The cause is a byte that wraps, which you have seen plenty of times by now. This lesson follows the path from one wrapped byte to half a broken maze. Don Hodges traced that path through the game's own code in 2007, in an article called "Splitting Apart the Split Screen", and everything below about the arcade comes from that work.
Read the rest of this lesson and run the code in your browser.
Previous: Negative numbers in binary Next: Spot the bug: the gold total