Welcome to the Creatures Wiki! Log in and join the community.

C16 files

From Creatures Wiki
(Redirected from .c16)
Jump to navigation Jump to search

.c16 is the extension for C16 files, used in most Creatures 3/Docking Station images. These files actually store several images, so most agents only need one c16. They can be viewed and edited with Creature Labs' SpriteBuilder, and previewed in Windows using GreenReaper's Sprite Thumbnail Viewer. The c16 is a compressed version of the s16 file, where transparent pixels are grouped together as a pixel count.

C16 files are used by the Creatures Evolution Engine to store compressed sprite data. They're compressed simply by Run Length Encoding (RLE) transparent pixels in the image files.

In the following description, 'uint16' refers to an unsigned 16 bit short integer, and 'uint32' to an unsigned 32 bit integer. Files are stored in little-endian format.

You can find the file naming convention here.


A C16 file consists of three distinct parts:

  1. A header, containing information about the file: 32+16=48 bits
  2. Image headers, one for each image
  3. Image data
    type     description
File header
    uint32 RGB pixel format: 2=555, 3=565
    uint16 Number of images
Image headers
    uint32 Image #1: Offset to beginning of first line in image data
    uint16 Image #1: width in pixels
    uint16 Image #1: height in pixels
    uint32[height-1] Image #1: Array of offsets pointing to the rest of the image lines (not including line 0)
    ... Repeat for each image
Image data
    Lines Image #1: Lines

Each "line" or "row" of an image, as pointed to by the image header, is split into one or more "runs". These runs can be either transparent or color runs.

Each run starts with a uint16 run tag: Bit 0 is the run type (0=Transparent, 1=Color). Bits 1-15 specify the run length in pixels (0 – 32767).

For a color run, the tag will be followed by the given number of 16-bit color pixels. For a transparent run, nothing follows the tag.

       uint16 End-of-line marker, always 0x0
       ... Repeat for each line
    uint16 End-of-image marker, always 0x0
    ... Repeat for each image

Related Links[edit]

External links[edit]