Difference between revisions of "President"

From Pin Eight
Jump to: navigation, search
(Two styles: see also Map decoding in President)
(It sure isn't pilgrim's progress)
Line 50: Line 50:
== See also ==
== See also ==
*[[Map decoding in President]]
*[[Map decoding in President]]
*[[President progress]]
== System requirements ==
== System requirements ==

Revision as of 04:58, 9 August 2009

President will be a platformer engine for NES, designed to be slightly more general than the Super Mario Bros. (SMB1) engine. (The name stands for Another Side Scroller Hosted On a Limited Environment; see "Dai Hin Min" on Wikipedia to learn why.) It shares no code or graphics with any NES game from the classic era.


  • 16x16-pixel metatiles
  • 512x12-metatile maps (32 screens wide)
  • Multiple locales
  • Repeating background scenery layer similar to SMB1's clouds, fences, bushes, and rear walls
  • Object-based area data compression
  • Limited backtracking support
  • Sprite animation


Pick two

Scrolling game engines on the NES tend to have a slight limitation: Backtracking, destructible environments, no extra RAM, pick two.

The earliest side-scrolling games for NES, such as Mappy and Lode Runner, only scrolled back and forth across a 2-screen area. A 32 by 12 metatile area could be represented in 384 bytes of RAM, or 3/8 of the 2 KiB RAM connected to the NES CPU.

Super Mario Bros. (SMB1) had 32 KiB of PRG ROM, and its level maps took about 4 KiB of that. They were compressed in a format that could be efficiently decoded forward, but not backward, and the game stored the immediate vicinity around the camera in a pair of 208-byte buffers each representing a 16x13-metatile screen. This made the best use of the cart's 32 KiB of PRG ROM and the NES's 2 KiB of internal RAM. Some levels of SMB1, such as 1-2 and 4-2, had hundreds of breakable elements such as bricks, coins, and ? blocks. If the game allowed the player to backtrack, the game would have to remember whether each element has been broken.

Other platformers, such as the Mega Man series, allowed the player to move back and forth freely across a map. But they typically did not let the player destroy a lot of things in the map, not nearly to the extent of SMB1, so they didn't have to remember the state of the whole level. Most power-ups in such games were dropped by defeated enemies.

Later platformers, such as Super Mario Bros. 2, Super Mario Bros. 3, and M.C. Kids, allowed the player to backtrack in the level and destroy/collect things, but they had an extra 8 KiB of PRG RAM on the Game Pak to store either an entire decompressed map or at least whether or not each block is destroyed.

Two styles

President will give the level designer a choice: either dial down the backtracking, or dial down the destructibility. In a level that has only one destructible item per column, the player can move back and forth freely, and what is destroyed stays destroyed. In a level that has more, the player can go back only one screen before running into an invisible wall. Either way, this is a significant improvement over the capabilities of SMB1.

Two buffers in the NES's RAM hold the state of the map. As in SMB1, a 32x12-byte "block buffer" holds fully decoded metatiles in a 2-screen-wide sliding window over the map. An additional 512-bit "destruction buffer" holds a bit for each column of the map. When something is destroyed, the bit for its column in the destruction buffer is turned on. Then when a column of the map is decoded, if the column is marked destroyed, each destructible metatile in the decode buffer is set to its destroyed alternate before being written to the nametable, attribute table, and block buffers. This would work for something like SMB2, whose levels could be designed so as not to have more than one tuft of grass, POW block, cherry, etc. in a column.

But if there is more than one destructible thing in a column, the player won't be allowed to backtrack and thus visit previous columns that may have been partly destroyed. A Lode Runner clone built on President would completely fit each map into the block buffer and thus wouldn't trigger the limitation. A SMB1 clone would still let the player go back farther than the original game did.

See also

System requirements

  • NES
  • UNROM/UOROM board with 64 to 256 KiB of PRG ROM and 8 KiB of CHR RAM


President hasn't been coded yet; first I have to draw the graphics that the engine will display. Here are some houses and some sprites:

An outdoor scene in town