ANCS (File Format)

Revision as of 01:01, 30 April 2016 by imported>Antidote (→‎AnimationSet)

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.


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.


Root Structure

Data Type Description Notes
u16 Version Always 1
CharacterSet Character Set Contains multiple CharacterInfo Entries
AnimationSet Animation Set Describes Meta Animations, Meta Transitions, Half Transitions, and Resource association

CharacterSet

Data Type Element Count Description Notes
u16 1 Version Always 1
u32 1 CharacterInfoPair count Number of characters in this set.
CharacterInfoPair character_info_count Character Info Pairs

CharacterInfoPair

Data Type Description
u32 Id
CharacterInfo Character Info

CharacterInfo

Data Type Element Count Description Notes
u16 1 Info Type Count Informs the engine which info types are present within the CharacterSet
string 1 Character Name Human readable name, useful for editors, the engine does not use this internally.
CMDL 1 Character Model
CSKR 1 Character Skin
CINF 1 Character Rig
u32 1 Animation Count Animations in AnimationSet that specifically relate to this character, some characters make heavy use of this abstraction, Space Pirates being the biggest culprit.
AnimationName animation_count Animation Names Animations linked to this character by name and index.
PASDatabase 1 Parameterized Animation State Data Not much is known about how this data is used.
ParticleResData 1 Particle systems used by this character
u32 1 Unknown
u32 1 Unknown Not present when info_type_count <= 9
u32 1 Unknown Not present when info_type_count <= 9
u32 1 Animation AABB count Only present when info_type_count > 1
AnimationAABB animation_aabb_count Animation bounds Only present when info_type_count > 1
u32 1 Effect Count Only present when info_type_count > 1
Effect effect_count Effects used by this character, including which bones they're attached to Only present when info_type_count > 1
CMDL 1 Overlay Model for status effects, such as ice when frozen Only present when info_type_count > 3
CSKR 1 Overlay Skin for status effects, such as ice when frozen Only present when info_type_count > 3
u32 1 Animation Index Count The total number of animations used by this, only present when info_type_count > 4
u32 animation_index_count Indices of each animation used by this character Only present when info_type_count > 4
u32 1 Unknown Only present when info_type_count > 9
u8 1 Unknown Only present when info_type_count > 9
u32 1 Animation AABB Indexed Count Only present when info_type_count > 9
AnimationAABB animation_aabb_indexed_count Animation bounds, referenced by index Only present when info_type_count > 9

AnimationName

Data Type Element Count Description Notes
u32 1 Index The index into AnimationSet's MetaAnimation table.
string 1 Unknown Not present when info_type_count >= 10
string 1 Animation Name The name of the index ref'd Animation

ParticleResData

Data Type Element Count Description Notes
u32 1 PART count How many particle systems are used by this character
PART part_count The particle systems used by this character
u32 1 SWHC count How many swooshes are used by this character
SWHC swhc_count The swooshes used by this character
u32 1 Unknown Count How many unknown systems are used by this character
UniqueID32 unknown_count The unknown systems used by this character
u32 1 ELSC count How many electric systems are used by this character, only present if info_type_count > 5
ELSC else_count The electric systems used by this character Only present if info_type_count > 5

AnimationAABB

Data Type Description
string Name
CAABox Animation bounds

Effect

Data Type Element Count Description
string 1 Name
u32 1 Component Count
EffectComponent component_count Effect Components

EffectComponent

Data Type Description
string Name
FourCC Type
UniqueID32 Resource as defined by Type
string Bone to attach the effect to
float Unknown
u32 Unknown
u32 Unknown

AnimationAABB Indexed

The only difference between this and the previous AnimationAABB is the fact that animations are referenced by index, rather than by name.

AnimationSet

Data Type Element Count Description Notes
u16 1 Info Count Enumeration of the presence of certain sections
u32 1 Animation Count How many animations there are in the set
Animation animation_count Animations that can be referenced by characters
u32 1 Transition Count How many transitions there are in the set
Transition transition_count Transitions that can be referenced by characters
MetaTransition 1 Default Transition
u32 1 Additive Animation Count How many additive animations there are
AdditiveAnimationPair additive_animation_count Additive animations that can be referenced in some fashion Reference method is currently unknown, presumably PASDatabase.
AdditiveAnimation 1 Default additive
u32 1 Half Transition Count How many half transitions there in the set, Only present if info_count > 2
HalfTransition half_transition_Count Half Transitions Only present if info_count > 2
u32 1 Animation Resource Count Only present if info_count > 3, and not present at all in MP2
AnimationResource animation_resource_count Animation Resources Only present if info_count > 3, and not present at all in MP2
u32 1 Event Count Only present in MP2
EVNT event_count Animation Events Only present in MP2

Animation

Data Type Description
string Name
MetaAnimation Animation configuration

MetaAnimation

MetaAnimations can be one of five types, and may contain children.

Data Type Description
EMetaAnimationType The Animation type
Primitive, Blend, PhaseBlend, Random or Sequence The animation description, including name, animation ID, and index used to connect character animations references to actual animations.

EMetaAnimationType

Name Value
Primitive 0
Blend 1
PhaseBlend 2
Random 3
Sequence 4

Primitive

Data Type Description Notes
ANIM Animation ID The asset ID for this particular animation
u32 Index The ID used by characters to reference this animation
string Name The animations name
float Unknown
u32 Unknown

Blend

Blend's structure is shared between Blend and PhaseBlend, with the only currently known difference being the animation type value.

Data Type Description Notes
MetaAnimation Animation A The animation to, presumably, blend from
MetaAnimation Animation B The animation to, presumably, blend to
float Unknown
bool Unknown

Random

Random may contain one or more children in an Animation -> Probability pair following this structure:

Data Type Element Count Description Notes
u32 1 Animation Count The number of child animations
AnimProbabilityPair animation_count The animations to select from The exact manner these are used is currently unknown
AnimProbabilityPair
Data Type Description Notes
MetaAnimation The animation use if the probability factor is met
u32 Probability How probability is used is not currently known

Sequence

Sequence is a fairly easy to understand type, it simply plays a list of animations in succession as each animation finishes

Data Type Element Count Description
u32 1 Animation Count
MetaAnimation animation_count The animations to play in a sequence

Transition

Data Type Description Notes
u32 Unknown
u32 Animation Index A The animation to transition from
u32 Animation Index B The animation to transition to
MetaTransition Transition configuration Describes how the transition is performed

MetaTransition

Meta Transitions can be one of four types, and may contain animations.

Data Type Description
EMetaTransitionType The type of transition
TransAnimation, TransTransition, TransPhaseTransition, TransNoTransition The transition configuration

EMetaTransitionType

Name Value
TransAnimation 0
TransTransition 1
TransPhaseTransition 2
TransNoTransition 3

TransAnimation

Data Type Description
MetaAnimation The animation to use while transitioning

TransTransition

Data Type Description
float Time
u32 Unknown
bool Unknown
bool Unknown
u32 Unknown

AdditiveAnimationPair

Data Type Description
u32 Animation Index
AdditiveAnimation Additive Animation fade-in, fade-out values

AdditiveAnimation

Describes how animations are additively blended together.

Data Type Description
float Fade In Duration
float Fade Out Duration

Half Transition

A half transition is very similar to a regular transition, but has less configuration information, any other differences are currently unknown

Data Type Description
u32 Animation Index
MetaTransition Transition configuration.

AnimationResource

Data Type Description
ANIM Animation Asset ID
EVNT Event Asset ID