"Only 40 kilobytes of game data are available to the console at one time, so without any additional hardware on an NES cartridge to switch between multiple banks of memory, devs had to make due with their limited constraints."
- Morphcat Games explores how the studio fit its NES game Micro Mages into 40 kilobytes.
Morphcat Games, a studio that develops new NES games for the classic console, has released an interesting video discussing some optimization techniques that the devs used for its upcoming NES platformer title Micro Mages.
This could be helpful for other developers keen on creating completely new games for the NES.
To start off, Morphcat explains that 40 kilobytes contains barely enough memory to store 2 seconds of music in mp3 format-- and when the NES was developed in the early 1980s, electronic storage was severely limited and expensive.
"Only 40 kilobytes of game data are available to the console at one time, so without any additional hardware on an NES cartridge to switch between multiple banks of memory, developers had to make due with their limited constraints," the video explains.
So how did the devs at Morphcat manage to create a new game for the console under the same limitations? First they created a plan.
"Micro Mages would be a side scrolling platformer with a cartoonish occult theme. The core mechanics are running, shooting magic spells, and to make traversing vertical levels fun while jumping, we want to provide an adventure with many levels and boss battles."
"To program and NES game like this, you need maximum control and speed so wee need to speak the processes language directly, writing all code in 6502 assembly," the video goes on. "8 kilobytes are used for graphics and another 32 kilobytes for everything else."
As for the graphics, they are split into two tables. One for background elements, and the other for independently moving foreground elements called sprites. "Each table holds 256 graphical 8x8 pixel tiles, and a single sprite on the NES can use three different colors."
The NES can only handle 4 different sprite palettes at the same time, and so the Morphcat devs reserved one palette for each player, and they have to be reused for enemies. "One of the most characteristic limitations of the NES is that only a maximum of eight sprites can be rendered on the same horizontal line. Excess sprites simply disappear."
The entire video goes into more detail about working around the NES limitations the modern-day developers found workarounds for, so be sure to watch it here. It's definitely worth it.