C16 files
.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:
- A header, containing information about the file: 32+16=48 bits
- Image headers, one for each image
- Image data
type | description |
---|---|
File header | |
uint32 | RGB pixel format: 2=555, 3=565, 0x3000000=M16 file (big-endian 555) |
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 |
uint16[*] |
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 |
M16 files
.m16 files are a variant of C16 files used by the Macintosh Creatures Evolution Engine. All values in theses files are big-endian, rather than little-endian. They can be identified as the first 32-bit little-endian value is equal to 0x3000000 (i.e. the big-endian encoding of the value 0x3). They use the RGB555 format.
Related Links
External links
- Great explanation and an example of how to work with s16 at The Creatures Developer Resource (colour handling adaptable to c16)