creatures

.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.

Overview

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

File header

The first 32 bits are a bitfield:

The next 16 bits are a uint16, the number of sprites in the file.

Image header

Then comes a whole bunch of image headers, one for each sprite in the file:

Image data

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.

A run begins with a uint16 tag:

For a color run, the tag will be followed by the given number of 16-bit color pixels. (Black pixels #000000 are to be considered transparent).

For a transparent run, nothing follows the tag.

Each line is terminated by a zero tag (uint16), with an additional zero tag to represent the end of the image.

Related Links

External links