TWIGZ Costume Files

TWIGZ Costume Files (".cos"):

All animated characters in TWIGZ, from the Ego & Non-Playable Characters (NPCs) to animated animals and insects, are animated using a system of virtual "costumes" for that character. Below is a tree representing the TIWGZ Costume File Format. Click on a node to learn more about it.

COHD - Marks the beginning of the Costume Header.
 
Total Costumes - INTEGER representing the total number of costume for the level
 
Total Sets in Costume # - INTEGER representing the total number of sets in costume number #
 
Images in #th Set - INTEGER representing the total number of images in set number #
 
Start Offset, Number of Bytes - INTEGER pair representing the starting offset in XMS memory where that image is stored & size of the image (in bytes). Note: this is repeated for all images in a set.
 
... ... ... ... - Follows the same pattern as the previous, similar node.
 
COST - Marks the beginning of the Costume data
 
Pixel Map - a listing of all the pixel color index numbers for all the costume images.


What exactly is a costume file?:
A costume file is a series of images divided up into "costumes", "sets" and "images" and include all data for all "Actors" in a level. An actor can be anything from the Ego & Non-Playable Characters (NPCs) to animated animals and insects. Each actor is assigned a costume and within that costume is several sets and each set has multiple images. Below is a brief explanation of how these sets and images are divided in memory:

Set 1: Walking
Number of Images Description
4 Walking Right
4 Walking Left
4 Walking Front
4 Walking Back
  
Set 2: Standing (Headless)
Number of Images Description
1 Standing Right
1 Standing Left
1 Standing Front
1 Standing Back
  
Set 3: Head Talking
Number of Images Description
4 Talking Right
4 Talking Left
4 Talking Front
4 Talking Back
  
Set 4: Head (Standing & Blinking)
Number of Images Description
2 Regular Right / Blink Right
2 Regular Left / Blink Left
2 Regular Front / Blink Front
2 Regular Down / Blink Down
  
Set 5: Full Animations
Number of Images Description
# Special Event 1
# Special Event 2
# Special Event 3
# Special Event 4
  
Set 6: Full Animations without Arms
Number of Images Description
# Armless Special Event 1
# Armless Special Event 2
# Armless Special Event 3
# Armless Special Event 4
  
Set 7: Full Animations without Legs
Number of Images Description
# Legless Special Event 1
# Legless Special Event 2
# Legless Special Event 3
# Legless Special Event 4
  
Set 8: Arms
Number of Images Description
# Arms 1
# Arms 2
# Arms 3
# Arms 4
  
Set 9: Legs
Number of Images Description
# Legs 1
# Legs 2
# Legs 3
# Legs 4

When a character is drawn on the screen several things are considered:

  1. If a script is running and executing a special animation, that animation is loaded, frame by frame, from the costume file
  2. If a character is talking then a headless "standing" body is placed on the screen followed by the appropriate head frame. Special arm animations and even leg animations can be added to add extra realism and flexibility.
  3. If an actor is standing for X amount of time a blinking head is placed atop a headless body to add that extra realism of blinking characters

What is the purpose of a costume?:
Costumes allow for on-the-fly actor animation. It enables the programmer to get a lot more animations without having to draw too many pictures. For example, instead of drawing the whole actor looking left, looking right, and blinking all separately, the programmer can just change the Actor().HeadDirection variable via a script and change the way the actor looks, on-the-fly.

How do I create my own costumes?:
Costumes can be created with the "Costume.exe" tool, part of the TWIGZ SDK. Below is a simple step by step guide to creating your own costumes.

STEP 1:
Create a sprite sheet or sheets in ".gif" format (MAX resolution 320 x 200). Keep in mind this file must adhere to the same GLOBAL PALETTE or you risk serious color complications and a whole lot of extra work. Below is a sample, note that the background color is color index 255, the transparent color. Each actor must have a minimum of 4 sets all with the appropriate number of images from the above table

STEP 2:
Run "Costume.exe". When asked which file to load, enter the name (8 characters or less) of a sprite sheet ".gif" file (NOTE: These must be stored in your "TWIGZ SDK\Gif" folder).

STEP 3:
Outline all the images, in the EXACT order they will appear in the costume file (see the above Table), for all of costume 1's sets. Then do the same for costume 2's, and so on until you have finished for all of your costumes.

STEP 4:
Save the costume file by pressing the "s" key and following the on-screen instructions. The (".cos") file will be saved to your "TWIGZ SDK\Costumes" folder.

Top

© 2004 Shattered Realm Productions