To celebrate 35 years of Pac-Man, the great yellow pizza himself, I thought I would try to give a detailed overview about one of the more famous glitches in video game history, the Pac-Man kill screen.
If you are unfamiliar with the term, a kill screen is when something in the game goes wrong, and you are unable to continue playing, effectively prematurely killing the game that is on the screen (see what I did there?). It's not a terribly common occurrence thankfully, but when it does happen, I personally always find it interesting to know why. So why don't we take this dive together, into what makes the Pac-Man kill screen happen and celebrate one of the most famous video game characters of all time.
The Pac-Man kill screen is a glitch that is relatively easy to reproduce; you just need to get up to level 256, easy, right? This is a feat that is possible by mere humans, as demonstrated by Billy Mitchell in 1999, who managed to play a perfect Pac-Man game, which involved getting every fruit, pellet, and hitting all 4 ghosts with every power pellet, for all 255 playable levels, all without losing a life. The final score? 3,333,360. I think my high score is about 1,000, but I digress.
[caption id="attachment_40513" align="aligncenter" width="300"] The man, the myth[/caption]
The number 256 holds great significance in computing and binary math; it is exactly one more then what a byte can hold. If you have never done any binary math, or don't really understand how computers do counting, let me give you a brief-ish rundown on how it works.
Computers are actually really stupid, they only know how to count to one, really. Computers represent data using ones and zeros, also known as a binary counting system. So there was a small amount of untruth in my stupid computers statement; while they can only really count to one, they can use that to count up to, well, basically anything. Let me explain.
In our normal counting method, the decimal system, we use 10 distinct characters, the numbers 0 - 9, to represent the values zero(0) through nine(9). When we get to ten(10), we roll over and start again, and when we get to a hundred(100), a thousand(1000) etc, the same thing happens. The same principal applies to the binary number system, except you only have two characters, 0 and 1. So when you hit two, you actually write 10, and three is 11, and four is 100, and eight is 1000, and so on. Each 1 or 0 is referred to as a bit, you may have heard this before, but you may be more familiar with the word "byte" which represents a group of eight bits.
[caption id="attachment_40512" align="aligncenter" width="188"] Binary can be fun...[/caption]
Stick with me, I promise I am getting to it.
A single byte is capable of representing 8^2, or 256 numbers (0-255). See, told you. When you try to put the number 256 into a single byte, you actually get shot back down to zero. 11111110(254) becomes 11111111(255), which then becomes 1 00000000(256). That seems fine, but unless you are actually looking for that lonely 1 at the beginning, you are going to read 00000000(0), and that's when things can start to go wrong. This kind of error is called an "integer overflow" error, and while this is a comical example, this kind of error can be used to do malicious, or otherwise unintended, things to an application.
[caption id="attachment_40511" align="aligncenter" width="361"] A mechanical buffer overflow[/caption]
One of the more famous examples of this, and much more easily viewable then the Pac-Man kill screen, is in Mario 64. In Mario 64, there is no level that can exceed 255 coins, actually, the max is 191 on TinyHuge Island, but with a bit of patience and using the infinite coin glitch, you can actually go all the way up to 999. But there is a catch, as when you do this, you will only get 231 coins at the end of level summary. Using the same logic as above, this is what happens:
You have 999 coins, which is 11 11100111 in binary, this is all well and good until you realize that the programmers, realizing there wasn't a legitimate way to get more than 255 coins on a level, decided to only take the bottom 8 bits (1 byte) and save that out in an effort to save space. So what happens if you actually only get a score of 11100111, or 231? The conclusion? If you are going to use this glitch, get either 255, 511, or 767 coins for the maximum score.
In the case of Pac-Man, the thing that is affected is the fruit drawing routine. Generally, you will only get a maximum of seven, but due to this bug, it would try to draw 256. Because of the way Pac-Man is programmed, it tried to draw each of the fruit in order, one block after another, left to right . When it goes off the screen, due to a comedy of errors, it starts drawing things in the top right hand corner, and start drawing down, and when it gets to the bottom of the screen, it goes one row to the left, and starts drawing down again. This is why you get this split-screen type effect, where one half of the screen is normal, and the other half is garbage.
[caption id="attachment_40510" align="aligncenter" width="261"] The kill screen is a mighty foe[/caption]
As easy as it is now for a programmer to look at this and say "I can fix this in a jiffy!," but back then, who would have thought to test up to the 256th level? Even knowing that people have done this, I still think of this as a far-fetched concept, so you really cant ride the programmers toO hard for this one, the same with the Mario 64 example.
While I have written a somewhat lengthy article here, I haven't even scratched the surface on the mechanics of this particular bug, so if you are interested in more information, go over to Don Hodges webpage here for a MUCH more in-depth view of how this works.
In conclusion, I would just like to wish a big happy birthday to one of the most recognizable characters in video game history, and in his honor, you should click here and waste even more time than I did playing a stupidly fun rendition of the classic.
Have you ever hit the kill-screen? Have you ever scored a perfect game? If so, are you Billy Mitchell? Let me know in the comments below.