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

C32

From Creatures Wiki
Revision as of 22:06, 23 February 2018 by OnlyAnAlligator (talk | contribs) (URL fix)
Jump to navigation Jump to search

.c32 is the extension for the c32 files used by the Kreatures game engine. Much like C16 files, these files store several images, so most objects only need one c32.

Each sprite in the file has 5 sub sprites, the first is the baked map, used if lighting is disabled or the others do not exist, while the other 4 will be used by the lighting engine.

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.

Overview

A C32 file consists of 3 distinct parts:

  1. A header, containing information about the file
  2. Image headers, one for each image,
  3. Image data

File header

The first 32 bits are the unsigned integer 1, which is used to determine that the engine's Big/Little endian compatibility functions are working correctly before loading.

the next 16 bits are an unsigned short containing the number of sprites in the file.

Image Header

Next comes a whole bunch of image headers, one for each sprite the file.

  • uint16: image width in pixels
  • uint16: image height in pixels
  • uint32: offset to the first byte of the baked map
  • uint32: offset to the first byte of the albedo map
  • uint32: offset to the first byte of the normal map
  • uint32: offset to the first byte of the microsurface map
  • uint32: offset to the first byte of the reflectivity map

The first two image maps are stored normally (RGBA), while the rest have been swizzled (0G0R), used to reduces compression artifacts in the default compressors.

Image data

Images are compressed twice, first with an image compression algorithm, then with run length encoding. For a type of compression to be considered valid, the data must remain compressed on the graphics card.

uint8: if the highest bit is 1 then the image data is followed by a mimpmap. The remaining 7 indicate which kind of compression is used:

  • 0 uncompressed 32 bit image data
  • 1 compressed with dxt1
  • 3 compressed with dxt3
  • 5 compressed with dxt5

uint32: the total number of bytes in the image, after the run length encoding has been undone.

Next the following two kinds of runs alternate until the image buffer contains the previously indicated number of bytes. uint32: the number of bytes representing transparent image data, this is followed immediately by: uint32: the number of bytes representing non-transparent image data, this tag will be followed by the given number of bytes of image data.


Related Links

External links