ANCS (File Format): Difference between revisions

From Retro Modding Wiki
Jump to navigation Jump to search
>Aruki
>Aruki
m (Parax0 moved page User:Parax0/ANCS (File Format) to ANCS (File Format) without leaving a redirect: how the fuck did that happen)
(No difference)

Revision as of 16:51, 28 January 2015

The ANCS format defines characters for animation in Metroid Prime 1 and 2. Starting in Metroid Prime 3, it was replaced by the CHAR format. The extension stands for ANimation Character Set.


To do:
Notate Metroid Prime 2 differences.
This file format needs a lot of research
Most of the file structure is known, but we still don't know what any of it actually is! Also, the table at the end of the file is unknown.

Header

The ANCS format is split up into multiple nodes. Each node defines a character - a model, a skeleton, and a skin - and then sets a number of animation-related parameters on each one. At the end of the file, after every node, is a listing of ANIM and EVNT files.

There's a very short 8-byte header before the nodes begin.

Offset Size Description
0x0 2 Unknown; always 1
0x2 2 Unknown; always 1 (maybe actually one 32-bit magic?)
0x4 4 Node count
0x8 Nodes begin

Nodes

Type Count Description
u32 1 Node number; starts at 0, increases by 1 on each subsequent node
u16 1 Flags? This value can alter the structure of the file. Usually 6.
string 1 Node name (zero-terminated)
CMDL 1 Model
CSKR 1 Skin
CINF 1 Skeleton
u32 1 Animation count

This struct then repeats animation count times:

Type Count Description
u32 1 Animation number; starts with 0, increases by 1 on each subsequent animation
u8 1 Unknown; usually 0
string 1 Animation name (zero-terminated)

PAS Database

The next part of the file is the PAS Database, which creates animation states and sets parameters on them. The PAS Database header is structured:

Offset Size Description
0x0 4 "PAS4" magic fourCC
0x4 4 Anim state count
0x8 4 Default state (will be 0xFFFFFFFF on files with no anim states)

Anim State

Type Count Description
u32 1 Unknown
u32 1 Parm Info count (PC)
u32 1 Anim Info count (AC)
Parm Info PC Parm Info
Anim Info AC Anim Info
Parm Info
Type Count Description
u32 1 Parm Type; enum ranging from 0 to 4, see below for possible values
u32 1 Unknown
float 1 Unknown
ParmType 2 Parms

These are the possible types that can be specified by Parm Type:

Value Size Type
0 4 s32
1 4 u32
2 4 float
3 1 bool
4 4 enum
Anim Info

The Anim Info structure is a little unorthodox. It starts with an unknown 32-bit value, and then is followed by a set of values. There's one value present per Parm Info instance, and the type of each value corresponds to that Parm Info's Parm Type setting.

Particles

Note: if the flag value at the start of the node is 5 instead of 6, when of these values is missing. It's currently not known specifically which one it toggles, so be careful.

Type Count Description
u32 1 Particle count (PC)
PART PC Particle file IDs
u32 1 Swoosh particle count (SC)
SWHC SC Swoosh particle file IDs
u32 1 Unknown
u32 1 Electric particle count (EC)
ELSC EC Electric particle file IDs
u32 1 Unknown

Animations

This section begins with a 32-bit count value, then this struct repeats:

Type Count Description
string 1 Animation name
float 6 Unknown; possibly an AABB

Effects

This section is used for effect placement - binding particles to bones, which is used for things like Space Pirate eye fire. It starts with a 32-bit count value, then this stuct repeats:

Type Count Description
string 1 Effect name
u32 1 Unknown
string 1 Effect name 2
char 4 "PART" fourCC
PART 1 Particle file ID
string 1 Bone name
float 1 Unknown
u32 1 Unknown
u32 1 Unknown

Footer

The end of the node structure contains this data:

Type Count Description
CMDL 1 Unknown model
CSKR 1 Unknown skin
u32 1 Unknown count (UC)
u32 UC Unknowns