ANCS (File Format): Difference between revisions

Jump to navigation Jump to search
>Aruki
>Aruki
 
(31 intermediate revisions by 3 users not shown)
Line 1: Line 1:
The '''ANCS format''' defines characters for animation in Metroid Prime 1 and 2. Starting in Metroid Prime 3, it was replaced by the [[CHAR (Metroid Prime 3)|CHAR]] format. The extension stands for '''AN'''imation '''C'''haracter '''S'''et.
The '''ANCS format''' defines character sets and animation sets in Metroid Prime 1 and 2. Starting in Metroid Prime 3, it was replaced by the [[CHAR (File Format)|CHAR]] and [[SAND (File Format)|SAND]] formats. The extension stands for '''AN'''imation '''C'''haracter '''S'''et.
 
{{todo|Notate Metroid Prime 2 differences.}}
{{researchmajor|reason=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.}}


__TOC__
__TOC__


== Header ==
== Format ==


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 (File Format)|ANIM]] and [[EVNT (File Format)|EVNT]] files.
{| class="wikitable"
! Type
! Name
! Notes
|-
| u16
| '''Version'''
| Always 1.
|-
| [[#Character Set|Character Set]]
| '''Character Set'''
| Set of characters that share animation data.
|-
| [[#Animation Set|Animation Set]]
| '''Animation Set'''
| Set of animations used by the characters in the character set.
|}


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


{| class="wikitable"
{| class="wikitable"
! Offset
! Type
! Size
! Count
! Description
! Name
! Notes
|-
|-
| 0x0
| u16
| 2
| 1
| {{unknown|'''Unknown'''; always 1}}
| '''Version'''
| Always 1.
|-
|-
| 0x2
| u32
| 2
| 1
| {{unknown|'''Unknown'''; always 1 (maybe actually one 32-bit magic?)}}
| '''Character Count'''
| Count of characters in this set.
|-
|-
| 0x4
| [[#Character|Character]]
| 4
| ''Character Count''
| '''Node count'''
| '''Characters Array'''
|-
| Array of characters.
| 0x8
| colspan=2 {{unknown|Nodes begin}}
|}
|}


== Nodes ==
==== Character ====


{| class="wikitable"
{| class="wikitable"
! Type
! Type
! Count
! Count
! Description
! Name
! Notes
! V1
! V2
! V4
! V5
! V10
|-
|-
| u32
| u32
| 1
| 1
| '''Node number'''; starts at 0, increases by 1 on each subsequent node
| '''Character ID'''
| Typically begins at 0 and increments by 1 on each successive character in the set.
| {{check}}
| {{check}}
| {{check}}
| {{check}}
| {{check}}
|-
|-
| u16
| u16
| 1
| 1
| {{unknown|Flags? This value can alter the structure of the file. Usually 6.}}
| '''Version'''
| This can vary between different files/characters. Usually 5 or 6 in MP1 and 10 in MP2.
| {{check}}
| {{check}}
| {{check}}
| {{check}}
| {{check}}
|-
|-
| string
| string
| 1
| 1
| '''Node name''' (zero-terminated)
| '''Name'''
| Name of the character. Not used by the game; was likely included for debugging purposes.
| {{check}}
| {{check}}
| {{check}}
| {{check}}
| {{check}}
|-
| Asset ID ([[CMDL (Metroid Prime)|CMDL]])
| 1
| '''Model ID'''
| ID of the model used by this character.
| {{check}}
| {{check}}
| {{check}}
| {{check}}
| {{check}}
|-
| Asset ID ([[CSKR_(File_Format)|CSKR]])
| 1
| '''Skin ID'''
| ID of the skin used by this character.
| {{check}}
| {{check}}
| {{check}}
| {{check}}
| {{check}}
|-
| Asset ID ([[CINF_(File_Format)|CINF]])
| 1
| '''Skeleton ID'''
| ID of the skeleton used by this character.
| {{check}}
| {{check}}
| {{check}}
| {{check}}
| {{check}}
|-
| u32
| 1
| '''Animation Name Count'''
| Count of animation names in the next array.
| {{check}}
| {{check}}
| {{check}}
| {{check}}
| {{check}}
|-
| [[#Animation Name|Animation Name]]
| ''Animation Name Count''
| '''Animation Name Array'''
| Array of names of animations used by this character.
| {{check}}
| {{check}}
| {{check}}
| {{check}}
| {{check}}
|-
|-
| [[CMDL (Metroid Prime)|CMDL]]
| [[PAS Database]]
| 1
| 1
| '''Model'''
| '''PAS Database'''
| Not much is known about how this data is used.
| {{check}}
| {{check}}
| {{check}}
| {{check}}
| {{check}}
|-
|-
| [[CSKR (File Format)|CSKR]]
| [[#Particle Resource Data|Particle Resource Data]]
| 1
| 1
| '''Skin'''
| '''Particle Resource Data'''
| List of particle assets being used by this character. This includes particles being used by attached effects as well as by [[EVNT (File Format)|animation events]].
| {{check}}
| {{check}}
| {{check}}
| {{check}}
| {{check}}
|-
|-
| [[CINF (File Format)|CINF]]
| u32
| 1
| 1
| '''Skeleton'''
| {{unknown}}
|
| {{check}}
| {{check}}
| {{check}}
| {{check}}
| {{check}}
|-
|-
| u32
| u32
| 1
| 1
| '''Animation count'''
| {{unknown}}
|}
|
 
| {{nocheck}}
This struct then repeats ''animation count'' times:
| {{nocheck}}
 
| {{nocheck}}
{| class="wikitable"
| {{nocheck}}
! Type
| {{check}}
! Count
|-
! Description
| u32
| 1
| '''Animation AABB Count'''
| Count of animation bounding boxes.
| {{nocheck}}
| {{check}}
| {{check}}
| {{check}}
| {{check}}
|-
| [[#Animation AABB|Animation AABB]]
| ''Animation AABB Count''
| '''Animation AABB Array'''
| Array of animation bounding boxes for this character.
| {{nocheck}}
| {{check}}
| {{check}}
| {{check}}
| {{check}}
|-
| u32
| 1
| '''Effect Count'''
| Count of attached effects.
| {{nocheck}}
| {{check}}
| {{check}}
| {{check}}
| {{check}}
|-
| [[#Effect|Effect]]
| ''Effect Count''
| '''Effect Array'''
| Effects attached to this character.
| {{nocheck}}
| {{check}}
| {{check}}
| {{check}}
| {{check}}
|-
| Asset ID ([[CMDL_(Metroid_Prime)|CMDL]])
| 1
| '''Frozen Model'''
| Overlay model that appears when the character is frozen with the Ice/Dark Beam.
| {{nocheck}}
| {{nocheck}}
| {{check}}
| {{check}}
| {{check}}
|-
| Asset ID ([[CSKR_(File_Format)|CSKR]])
| 1
| '''Frozen Skin'''
| Skin for rigging the ''Frozen Model'' to the character's skeleton.
| {{nocheck}}
| {{nocheck}}
| {{check}}
| {{check}}
| {{check}}
|-
| u32
| 1
| '''Animation Count'''
| Count of animations used by this character.
| {{nocheck}}
| {{nocheck}}
| {{nocheck}}
| {{check}}
| {{check}}
|-
|-
| u32
| u32
| ''Animation Count''
| '''Animation ID Map'''
| Array of animation IDs. Indexing this array with the character-relative animation ID returns the animset-relative animation ID.
| {{nocheck}}
| {{nocheck}}
| {{nocheck}}
| {{check}}
| {{check}}
|-
| Asset ID ([[CSPP (File Format)|CSPP]])
| 1
| 1
| '''Animation number'''; starts with 0, increases by 1 on each subsequent animation
| '''Spatial Primitives ID'''
| ID of the spatial primitives used by this character.
| {{nocheck}}
| {{nocheck}}
| {{nocheck}}
| {{nocheck}}
| {{check}}
|-
|-
| u8
| u8
| 1
| 1
| {{unknown|'''Unknown'''; usually 0}}
| {{unknown}}
|  
| {{nocheck}}
| {{nocheck}}
| {{nocheck}}
| {{nocheck}}
| {{check}}
|-
|-
| string
| u32
| 1
| 1
| '''Animation name''' (zero-terminated)
| '''Indexed Animation AABB Count'''
| Count of indexed animation bounding boxes.
| {{nocheck}}
| {{nocheck}}
| {{nocheck}}
| {{nocheck}}
| {{check}}
|-
| [[#Indexed Animation AABB|Indexed Animation AABB]]
| ''Indexed Animation AABB Count''
| '''Indexed Animation AABB Array'''
| Unknown purpose.
| {{nocheck}}
| {{nocheck}}
| {{nocheck}}
| {{nocheck}}
| {{check}}
|}
|}


=== PAS Database ===
===== Animation Name =====
 
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:


{| class="wikitable"
{| class="wikitable"
! Offset
! Type
! Size
! Name
! Description
! Notes
! V1
! V10
|-
|-
| 0x0
| u32
| 4
| '''Animation ID'''
| '''"PAS4" magic''' fourCC
| Character-relative animation ID. Must be remapped via the ''Animation ID Map'' to access the corresponding animation in the animset.
| {{check}}
| {{check}}
|-
|-
| 0x4
| string
| 4
| {{unknown|'''Unknown'''}}
| '''Anim state count'''
| Always empty.
| {{check}}
| {{nocheck}}
|-
|-
| 0x8
| string
| 4
| '''Animation Name'''
| '''Default state''' (will be 0xFFFFFFFF on files with no anim states)
| The name of the animation.
| {{check}}
| {{check}}
|}
|}


==== Anim State ====
===== Particle Resource Data =====


{| class="wikitable"
{| class="wikitable"
! Type
! Type
! Count
! Count
! Description
! Name
! Notes
! V5
! V6
! V10
|-
| u32
| 1
| '''Generic Particle Count'''
| Count of generic particle systems.
| {{check}}
| {{check}}
| {{check}}
|-
| Asset ID ([[PART (File Format)|PART]])
| ''Generic Particle Count''
| '''Generic Particle List'''
| List of generic particle systems used by this character.
| {{check}}
| {{check}}
| {{check}}
|-
|-
| u32
| u32
| 1
| 1
| {{unknown|'''Unknown'''}}
| '''Swoosh Particle Count'''
| Count of swoosh particle systems.
| {{check}}
| {{check}}
| {{check}}
|-
| Asset ID ([[SWHC (File Format)|SWHC]])
| ''Swoosh Particle Count''
| '''Swoosh Particle List'''
| List of swoosh particle systems used by this character.
| {{check}}
| {{check}}
| {{check}}
|-
| u32
| 1
| {{unknown}}
| Always 0.
| {{nocheck}}
| {{check}}
| {{check}}
|-
|-
| u32
| u32  
| 1
| 1
| '''Parm Info count''' (PC)
| '''Electric Particle Count'''
| Count of electric particle systems.
| {{check}}
| {{check}}
| {{check}}
|-
| Asset ID ([[ELSC_(File_Format)|ELSC]])
| ''Electric Particle Count''
| '''Electric Particle List'''
| List of electric particle systems used by this character.
| {{check}}
| {{check}}
| {{check}}
|-
|-
| u32
| u32
| 1
| 1
| '''Anim Info count''' (AC)
| '''Spawn Particle Count'''
| Count of spawn particle systems.
| {{nocheck}}
| {{nocheck}}
| {{check}}
|-
| Asset ID ([[SPSC (File Format)|SPSC]])
| ''Spawn Particle Count''
| '''Spawn Particle List'''
| List of spawn particle systems used by this character.
| {{nocheck}}
| {{nocheck}}
| {{check}}
|}
 
===== Animation AABB =====
 
{| class="wikitable"
! Type
! Name
! Notes
|-
| string
| '''Animation Name'''
|
|-
| {{AABox}}
| '''Animation Bounding Box'''
|
|}
 
===== Indexed Animation AABB =====
 
Similar to [[#Animation AABB|Animation AABB]], but with animations referenced via ID instead of name.
 
{| class="wikitable"
! Type
! Name
! Notes
|-
|-
| [[#Parm Info|Parm Info]]
| u32
| PC
| '''Animation ID'''
| '''Parm Info'''
| Confirm this is character-relative?
|-
|-
| [[#Anim Info|Anim Info]]
| {{AABox}}
| AC
| '''Animation Bounding Box'''
| '''Anim Info'''
|
|}
|}


===== Parm Info =====
===== Effect =====


{| class="wikitable"
{| class="wikitable"
! Type
! Type
! Count
! Count
! Description
! Name
! Notes
|-
|-
| u32
| string
| 1
| 1
| '''Parm Type'''; enum ranging from 0 to 4, see below for possible values
| '''Effect Name'''
| Name of the effect.
|-
|-
| u32
| u32
| 1
| 1
| {{unknown|'''Unknown'''}}
| '''Effect Component Count'''
|-
| Count of effect components
| float
| 1
| {{unknown|'''Unknown'''}}
|-
|-
| ParmType
| [[#Effect Component|Effect Component]]
| 2
| ''Effect Component Count''
| '''Parms'''
| '''Effect Components'''
| Array of effect components used by this effect.
|}
|}


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


{| class="wikitable"
{| class="wikitable"
! Value
! Size
! Type
! Type
! Name
! Notes
|-
|-
| 0
| string
| 4
| '''Component Name'''
| s32
| Name of this effect component.
|-
|-
| 1
| {{FourCC}}
| 4
| '''Particle Asset Type'''
| u32
| Type of the particle used by this effect.
|-
| Asset ID
| '''Particle Asset ID'''
| Particle resource used by this effect.
|-
| string
| '''Bone Name'''
| Bone that the component is attached to.
|-
|-
| 2
| 4
| float
| float
| '''Scale'''
| Scale of the component.
|-
|-
| 3
| u32
| 1
| '''Parented Mode'''
| bool
| Needs documentation
|-
|-
| 4
| u32
| 4
| '''Flags'''
| enum
| Needs documentation
|}
|}


===== Anim Info =====
=== Animation Set ===
 
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.


{| class="wikitable"
{| class="wikitable"
! Type
! Type
! Count
! Count
! Description
! Name
! Notes
! MP1
! MP2
|-
| u16
| 1
| '''Version'''
| Always 4. Note there are format differences between MP1 and MP2 despite them both being version 4.
| {{check}}
| {{check}}
|-
|-
| u32
| u32
| 1
| 1
| '''Particle count''' (PC)
| '''Animation Count'''
| Count of animations contained by the set.
| {{check}}
| {{check}}
|-
|-
| [[PART (File Format)|PART]]
| [[#Animation|Animation]]
| PC
| ''Animation Count''
| '''Particle file IDs'''
| '''Animation Array'''
| Array of animations.
| {{check}}
| {{check}}
|-
|-
| u32
| u32
| 1
| 1
| '''Swoosh particle count''' (SC)
| '''Transition Count'''
| Count of transitions contained by the set.
| {{check}}
| {{check}}
|-
|-
| [[SWHC (File Format)|SWHC]]
| [[#Transition|Transition]]
| SC
| ''Transition Count''
| '''Swoosh particle file IDs'''
| '''Transition Array'''
| Array of transitions.
| {{check}}
| {{check}}
|-
| [[Meta-Transition]]
| 1
| '''Default Transition'''
|
| {{check}}
| {{check}}
|-
| u32
| 1
| '''Additive Animation Count'''
| Count of additive animations contained by the set.
| {{check}}
| {{check}}
|-
| [[#Additive Animation|Additive Animation]]
| ''Additive Animation Count''
| '''Additive Animation Array'''
| Array of additive animations. Although any animation can be used as additive, this array allows for customizing the fade in/out time for each animation.
| {{check}}
| {{check}}
|-
| float
| 1
| '''Default Additive Fade-In Time'''
| Fade-in time used for additive animations not listed in the above array.
| {{check}}
| {{check}}
|-
| float
| 1
| '''Default Additive Fade-Out Time'''
| Fade-out time used for additive animations not listed in the above array.
| {{check}}
| {{check}}
|-
|-
| u32
| u32
| 1
| 1
| {{unknown|'''Unknown'''}}
| '''Half Transition Count'''
| Count of half transitions contained by the set.
| {{check}}
| {{check}}
|-
| [[#Half Transition|Half Transition]]
| ''Half Transition Count''
| '''Half Transition Array'''
| Array of half transitions.
| {{check}}
| {{check}}
|-
|-
| u32
| u32
| 1
| 1
| '''Electric particle count''' (EC)
| '''Animation Resource Count'''
| Count of animation assets used by this set.
| {{check}}
| {{nocheck}}
|-
|-
| [[ELSC (File Format)|ELSC]]
| [[#Animation Resource Pair|Animation Resource Pair]]
| EC
| ''Animation Resource Count''
| '''Electric particle file IDs'''
| '''Animation Resource List'''
| List of animation assets used by this set.
| {{check}}
| {{nocheck}}
|-
|-
| u32
| u32
| 1
| 1
| {{unknown|'''Unknown'''}}
| '''Event Set Count'''
| Count of event sets. Matches the animation count.
| {{nocheck}}
| {{check}}
|-
| [[EVNT_(File_Format)|Event Set]]
| ''Event Set Count''
| '''Event Set Array'''
| Array of animation events. Each event set maps to the animation at the same index. Note this is basically MP1's [[EVNT (File Format)|EVNT]] file format, but embedded in ANCS.
| {{nocheck}}
| {{check}}
|}
|}


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


{| class="wikitable"
{| class="wikitable"
! Type
! Type
! Count
! Name
! Description
! Notes
|-
|-
| string
| string
| 1
| '''Name'''
| '''Animation name'''
| Animation name.
|-
|-
| float
| [[Meta-Animation]]
| 6
| '''Animation'''
| {{unknown|'''Unknown'''; possibly an AABB}}
| Meta-animation data.
|}
|}


=== Effects ===
==== Transition ====
 
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:


{| class="wikitable"
{| class="wikitable"
! Type
! Type
! Count
! Name
! Description
! Notes
|-
|-
| string
| u32
| 1
| {{unknown}}
| '''Effect name'''
|  
|-
|-
| u32
| u32
| 1
| '''Animation ID A'''
| {{unknown|'''Unknown'''}}
| The animation being transitioned from.
|-
|-
| string
| u32
| 1
| '''Animation ID B'''
| '''Effect name 2'''
| The animation being transitioned to.
|-
|-
| char
| [[Meta-Transition]]
| 4
| '''Transition'''
| '''"PART" fourCC'''
| Meta-transition data.
|}
 
==== Additive Animation ====
 
{| class="wikitable"
! Type
! Name
! Notes
|-
|-
| [[PART (File Format)|PART]]
| u32
| 1
| '''Animation ID'''
| '''Particle file ID'''
|
|-
|-
| string
| float
| 1
| '''Fade-In Time'''
| '''Bone name'''
| Fade-in duration.
|-
|-
| float
| float
| 1
| '''Fade-Out Time'''
| {{unknown|'''Unknown'''}}
| Fade-out duration.
|}
 
==== Half Transition ====
 
{| class="wikitable"
! Type
! Name
! Notes
|-
|-
| u32
| u32
| 1
| '''Animation ID'''
| {{unknown|'''Unknown'''}}
| The animation being transitioned from.
|-
|-
| u32
| [[Meta-Transition]]
| 1
| '''Transition'''
| {{unknown|'''Unknown'''}}
| Meta-transition data.
|}
|}


=== Footer ===
==== Animation Resource Pair ====
 
The end of the node structure contains this data:


{| class="wikitable"
{| class="wikitable"
! Type
! Type
! Count
! Name
! Description
|-
| [[CMDL (Metroid Prime)|'''CMDL''']]
| 1
| {{unknown|'''Unknown model'''}}
|-
|-
| [[CSKR (Metroid Prime)|'''CSKR''']]
| Asset ID ([[ANIM_(File_Format)|ANIM]])
| 1
| '''ANIM ID'''
| {{unknown|'''Unknown skin'''}}
|-
|-
| u32
| Asset ID ([[EVNT_(File_Format)|EVNT]])
| 1
| '''EVNT ID'''
| {{unknown|'''Unknown count''' (UC)}}
|-
| u32
| UC
| {{unknown|'''Unknowns'''}}
|}
|}


Anonymous user

Navigation menu