Documentación del formato AVS del editor de personajes
AVS files used by the old 16-bit Comic Chat character editor are just plain PNG files with some metadata at the end. I figured out the file format and wrote a proof of concept bash script, avs.sh, that can create well formed AVS files compatible with the editor. Read the source code of avs.sh to learn how to use it then test it with the sample project. The structure of an AVS file is detailed below.
PNG part
The PNG image has no alpha channel or color index, although it won't complain if you do use indexed images (16 or 256 colors only). Comic Chat admits high density color images just fine, but it was common back in the day to use only 256 colors to reduce the file size of compiled characters.
A Comic Chat character has fixed width, height and number of poses. The image is a sprite sheet with the following structure:
- 5 images per row, one per pose, with the very first one reserved for the character icon (40x40 icon placed top left). This first frame also defines the transparent background color used by all character frames, which MUST be one of the 16 colors in the VGA palette.
- Sprite sheet width: 5 * character width.
- Sprite sheet height: ceil((number of poses + 1) / 5) * character height.
Metadata
Metadata begins immediately after the end of PNG data. All strings are right aligned by default and all numbers are padded with zeroes.
Metadata, part 1 (640 bytes)
- 39 bytes: The magic string "
Microsoft Chat Character Source File
". - 255 bytes: Character name.
- 255 bytes: Character description.
- 60 bytes: Author.
- 2 bytes: Blank.
- 3 bytes: Image colors. This is independent from the actual color
depth of the image file. It can take the values
002
for monochrome,016
for 16 colors and256
for 256 colors or high density color. - 1 byte: If set to
1
and the next 15 bytes are empty, the editor will ask to set a password when opening character properties. There seems to be no use for this password, and the feature is not documented anywhere. - 15 bytes: Password, usually blank. Left aligned.
- 3 bytes: Character width.
- 3 bytes: Character height. Note that although the editor doesn't allow you to make characters with dimensions greater than 400x400, you can set these two values to any 3 digit number without the editor complaining, but I haven't tested how Comic Chat reacts.
- 3 bytes: Number of images (poses) without counting the icon.
- 1 byte: If set to
1
, the option "add pose" in the "character" menu will be replaced by the undocumented options "add only head" and "add only body". They add "head" and "body" poses that, I assume, are meant to allow to use different heads with the same body, but this doesn't appear to work in the character preview.
Poses (62 bytes per pose)
Poses must be defined in the exact same order that their graphics are defined in the PNG sprite sheet.
- 2 bytes: Not used? Seems to be the same for every pose, but nothing happens when the value is changed.
- 1 byte: Usually
0
, but if the pose is either of the undocumented "head" or "body" poses, this will be set to1
for a "head" pose and2
for a "body" pose. - 3 bytes: Center of head, x position.
- 3 bytes: Center of head, y position. The editor shows these
values with a target icon whose top-left position is set by the value of
these 6 bytes. If no head center is set, the values are set to
---
. - 1 byte:
1
. Changing this value seems to have no effect. - 1 byte:
1
if the pose is disabled in the editor,0
otherwise. - 25 bytes: Pose name. Doesn't have to be unique.
- 2 bytes for each of the following expressions, in the
given order: neutral, laugh, shrug,
bored, angry, happy, scared, shout,
sad, coy, point to self, point to other and
waving (26 bytes total).
- Each pose can have multiple expressions or moods so the same
images can be reused, and each expression has an intensity. The
higher the intensity, the closer it'll be to the center of the
expression wheel. The intensity value in the AVS file is
1 more than the value shown by the editor, hence ranging from
02
to11
. - If an expression is not present, its intensity is set to
00
. - The expressions neutral, point to self,
point to other and waving always have intensity
02
. - The expressions point to self, point to other and waving can only appear in a single pose each.
- With the exception of neutral (which always has the same intensity), an expression of a given intensity can only be used once.
- Each pose can have multiple expressions or moods so the same
images can be reused, and each expression has an intensity. The
higher the intensity, the closer it'll be to the center of the
expression wheel. The intensity value in the AVS file is
1 more than the value shown by the editor, hence ranging from
Metadata, part 2 (544 bytes)
- 1 byte: Character sex.
1
for male,2
for female and any other value (usually0
) for indeterminate. - 255 bytes: Copyright.
- 255 bytes: AVB file download URL (must be FTP or HTTP).
- 31 bytes: Blank.
- 1 byte: Setting this to
1
enables the editor option "The user can't change the URL", any other value disables it. - 1 byte: Blank. May be omitted.