Overview_of_PCE_Graphics

From ArchaicPixels: HuC and PCEAS Documentation

Jump to: navigation, search

Color, Sprite & Tile Overview for the PCE


Colors: The PCE has an available palette of 512 Colors, the best way to think of the colors is in Octal representation. Each color can be represented by "RGB" where each "r", "g" and "b" can represent a number in the 0-7 range. a "0" represents that no color is on for that area, whereas 7 is full power. A number such as "000" represents black, whereas "777" is white. Other color examples:

 111 - Dark Grey
 333 - Grey
 555 - Light Grey
 700 - bright red
 755 - pink
 707 - bright purple
 070 - bright green
 003 - dull blue
 etc.


Basic Concepts with Palettes. The PCE has 32 palettes, 16 palettes are for "tiles" and 16 are for "sprites." Each palette has 16 colors, this is the limit for a tile or sprite. Also, this number is a little misleading, for sprites the color at palette entry 0 is the "invisible" color, so technically a sprite only has 15 visible colors. If more colors are needed in a sprite, then several sprites can be combined (this is not advisable since it is very difficult to coordinate). Tiles have the same limit, but the "background" color (palette entry 0) is displayed. However a sprite can be setup to hide behind the Background tiles EXCEPT for anything in this color. This is a fairly advanced concept, so consider a small example.

if you have a 2 color BG tile that looks like this:

  +---------+
  | entry 1 |
  |         | 
  |         |
  +---------+
  |         | 
  |         |
  | entry 0 |
  +---------+

and you place a sprite BEHIND the tile, only the part in the lower half of the tile will be visible:

  +---------+
  | entry 1 |
  |         | 
  |         |
  +--+---+--+ anything in the sprite above this line will not be seen --
  |  |SPR|  | 
  |  +---+  |
  | entry 0 |
  +---------+


Sprites: Most on screen movements are handled through sprites. The PCE can have a maximum of 64 sprites on screen at any 1 given time (there are other limitations, which are beyond the scope of this document: vertical scan line limitations, size/memory issues).

Sprites can be defined to be one of several sizes:

 16x16    32x16
 16x32    32x32
 16x64    32x64

Anything larger would need to be assembled from combining sprites.

Sprites can also be flipped on either the X or Y (or both) axes, so if you have "4 frames" of animation for a character walking to the left, these can be "X flipped" so that he is walking to the right. Car must be taken when using this technique so that things like lighting and text are not "give aways" that the sprite has flipped. Design your sprites as ambiguously as possible.

Each sprite can have one of the 16 "Sprite palettes" associated with it, palettes can be changed during a game, however care must be taken as there can be undesired side effects of doing this.

To use Sprites & Tiles in a PCE game, they should be in PCX (version 2) format. This format only allows a palette of 16 colors, so the best way to handle this is to let each palette have its own PCX file from which the sprites can be ripped.


Tiles: Tiles are traditionally used for backgrounds. For the PCE tiles can be either 8x8 or 16x16. Each tile is associated with one of the tile palettes. In general it is BEST to use a single palette for a "background." This is rather limiting, but enhancements can be made if needed (use sprites to alter the background, for example). Recent improvements in HuC make the one pal background advice mostly unnecessary.

If a game has a "constant" background (non scrolling), then tiles can effectively be used as game components (games like Tetris will use this technique), but keep in mind that only 1 tile can occupy a space, (unlike sprites which can have several in the same area). Also remember that tiles are limited in where they can be. 8x8 tiles can only occupy every 8th space, so smooth animation using a single tile without scrolling is not really possible.

The default PCE screen size is 256 x 224; this can be changed (and again this is an advanced topic), so if you are using 8x8 tiles, you will need 32x28 tiles (16x14 for 16x16 sized tiles).



 History Information.
 v 1.0    2003-01-15         Bt Garner   Original Version
 v 1.01   2007-06-13         Bt Garner   Wiki Updated version
Personal tools