Displaced Gamers‘ Behind the Code series doesn’t get new videos often, but they’re always great. This one is more technical than usual, but I don’t think it’s really all that technical. It’s about how the NES processes and renders its sprites, particularly explains why there’s a eight sprite per scanline limit, and even reveals a couple of games that use that limit to produce special effects!
The gist: while each scanline is being prepared for display, the NES’ PPU looks through the entries for the machine’s 64 hardware sprites in order, finds the first eight that will display on the current line, and copies their attribute data to a small area of internal RAM. There is only space there for eight sprites, so, the NES cannot display more than eight sprites in a single scan line. Any later sprites in the primary attribute data won’t have room to be copied, and so the PPU won’t be able to display them.
One thing it notably doesn’t cover, however, is how games implement priority shuffling to cause sprites to flicker instead of not display at all. The video suggests that that might be coming in a future video….
Street Fighter II has some really complex spritework! Its characters don’t actually use traditional sprites, but more what amounts to custom tile layers for each one. This helped unlock characters from being mostly rectangular, and allow them to have poses with radically different shapes.
ROMs were expensive, and Street Fighter II required a lot of them, so it was important to make the most out of each one. A big rectangular shape around Edmond Honda would contain a lot of empty, wasted space. Imagine how much space they would have wasted with Dhalsim’s long stretchy legs! With this system, they only had to include the graphics data that would actually contain pixels.
This was in 1991, mind you. More recent development practices would probably have the data be compressed in storage, which would take care of all those empty pixels, or at least they could make a tool to handle figuring out which tiles should contain data. What the Street Fighter II artists had to do was create physical representations of each character on a physical board, chop that up into squares, and figure out what each tile had to contain, a laborious process.
Fabian reckons this system was used for other CPS-1 games, going back to at least Forgotten Worlds. Looking at the tile layouts of CPS-2 titles, it seems a lot more evident that they used a packing tool to handle fitting their characters into the memory space. For more info, please go check out the article!
Popular and prolific game asset creator Kenney has a page up at Github that links to some of his favorite tools for manipulating pixel art, such as creating sprite sheets and extracting images out of them. It’s got a lot of useful info! If you have an interest in this style of art, especially making games with it, these programs are worth having in your toolbox.