Displaced Gamers‘ Behind the Code series, and its companion Talkin’ Code, are probably the best technical examinations of NES games on Youtube. They take games that were the bread and butter of the Famicom/NES in its heyday, products of skilled programmers some of whom had gotten started working on arcade games, and disassemble them, revealing both their the tricks of their trade and the quirks, and sometimes glitches, that made their work unique.
Their most recent examination is the best NES basketball game, Double Dribble. If you’re not familiar with it, it plays and feels an awful lot like it were an early version of NBA Jam, without the teams or players or personality sure, but it does play a mean arcade-style game, which makes sense since it was a port of an arcade game (one that plays, I should say, a hideous vocalized version of the Star Spangled Banner at game start).
Here is the video. (32 minutes) Discussion of the discussion is below it.
Okay, the first surprise is that it that whether the ball goes in or not depends entirely on physics. The game takes the angle of the player to the basket (gotten from the X and Y position of the shot on screen) and sends the ball towards the basket using a lookup table to tell how the ball should move. When the ball arrives, whether it goes in depends on whether the ball is close enough to the center of the basket.
Double Dribble actually just sends the ball towards the basket, and if it’s close enough to the hoop (less than four pixels away), it goes in. Basically, the spot on screen the ball leaves from is what determines whether it scores. Affecting that is that there’s a limited number of discrete angles the ball can be thrown at. Displaced Gamers runs through the math, which is fairly involved, but in short, if you throw at the wrong combination of angle and distance, the ball just won’t go in.
More than that. The big discovery made by Displaced Gamers is that the two hoops aren’t the same! Due to flaw in the math, both hoops’ centers are essentially shifted to the right slightly, and both are also easier to hit when shots are made from the top of the screen, above the basket.
This is only a couple of points from the video. It’s full of the kinds of shortcuts that time-pressed programmers from the age of 8-bit consoles often had to use to make their code work. If you’re allergic to discussions of math (especially trigonometry) you might want to skip this one, but I think it’s worth a look.