Plane

From Sega Retro

This article is too Mega Drive-specific.
This is an old page originating from Sonic Retro and was originally designed to assist with Sonic the Hedgehog ROM hacking. The article should be modified to better reflect the scope of Sega Retro.

A plane, in Mega Drive games, is a layer consisting of 8x8 tiles arranged in a specific way - the way these 8x8 tiles are arranged is known as plane mappings. The Mega Drive VDP manages three separate planes: plane A, usually used as the foreground layer, plane B, usually used as the background layer, and the window plane, which acts as a replacement for plane A under certain register settings, and behaves differently from it.

The tile display for each plane is controlled by that plane's name table. The size of the name table can vary, but in Mega Drive Sonic games the size of the planes is usually 64x32 cells, or 512x256 pixels. The format of the name table is simple - one word per 8x8 tile, that word having the format PCCV HAAA AAAA AAAA, where P is the high priority flag, CC is the palette line to use, V and H are the vertical and horizontal flip flags, respectively, and AAA AAAA AAAA is the tile index of the 8x8 tile (i.e. VRAM location / $20). Since the size of the name tables generally exceeds the visible display area, horizontal and vertical scrolling techniques are used to select the part of the name table to be displayed in the visible area.

The VDP also manages a priority system between the different planes and sprites, with the backdrop color having the lowest priority, followed by low priority plane B tiles, low priority plane A tiles, low priority sprites, high priority plane B tiles, high priority plane A tiles, and high priority sprites.

The window plane replaces plane A for the lines on which it is displayed, meaning that the two planes can never overlap. It is special in that it is not affected by vertical and horizontal scrolling, and therefore any tiles displayed in it remain in a fixed position. An example of the usage of the window plane in Sonic games is the ending in Sonic the Hedgehog 3. After the final boss is defeated and the platform on which Sonic and Tails are standing separates from the Death Egg, the platform tiles are shifted into the window plane, which is displayed from line 40 onwards. This is used to give the illusion of the platform falling, while in reality the platform is remaining in a fixed place and it is the Death Egg which is being scrolled up. Another example of the usage of this plane in Mega Drive games is the HUD in Quackshot.

External Links

  • genvdp.txt, a document by Charles MacDonald explaining the functioning of the Mega Drive VDP in detail.