ANM format (.anm)
Overview
Format .anm is used to store animations of skeletal models in engines of the GEM family.
GEM RTS supports all previous versions of the animation format.
Each file may contain:
frame range parameters;
bone map;
animation keys;
visibility data;
mesh animation;
optional comments.
File structure
EANM
version
FRMS
frame_max + 1
CMNT
size
comment[size]
BMAP
bone_count
bones [bone_count]
bone_name
frame cycle
FRMN | FRM2 | FRM3Chunks
File Header
Content verifier. Confirms that the file contains animation.
FourCC
uint8[4]
4
EANM
version
int16[2]
4
Format version. The first 2 bytes contain major, the second 2 bytes contain minor:
0x00040000 version 4.0 (GEM1, Soldiers Heroes of World War II)
0x00060000 version 6.0 (GEM2, Men of War)
0x00060001 version 6.1 (GEM2.5, Majesty2; GEM RTS, Men of War II)
GEM RTS supports all versions
Chunk FRMS
Specifies the maximum frame number in the animation.
Data structure
FourCC
uint8[4]
4
FRMS
frame_max + 1
int32
4
The value is 1 greater than the maximum frame number.
Chunk CMNT
An optional comment chunk. Also used as a GEM3 format flag.
Data structure
FourCC
uint8[4]
4
CMNT
size
uint16
2
Comment size in bytes
comment
char[size]
1+
Comment text
Chunk BMAP
Animation bones map. Supports LOD via suffix ._lod<lod_number> in the name of a bone.
Data structure
FourCC
uint8[4]
4
BMAP
bone_count
int32
4
The number of bones in the map. Regardless of type int32, version 6.1 supports no more than 255 bones
bones
struct[bone_count]
Bone data array
Description of the bone array
bone_name
string8/24 or string32
1+
Name of the bone. If the GEM3 format is used, the following applies string8/24. For older formats, use string32
Frame cycles
After the bone map, a sequence of animation frames begins.
Data structure
The chunk type depends on the animation format version.
FRMN
V1
Supported since GEM1
FRM2
V2
Supported since GEM2
FRM3
V3
Supported since GEM2.5 / GEM RTS
*) GEM RTS supports all format versions.
Frame format V1 (FRMN)
Used in GEM1.
Data structure
Frame Verifier V1
FourCC
uint8[4]
4
FRMN
frame_no
int32
4
Frame number
Chunk BONE
Contains animation of a single bone.
FourCC
uint8[4]
4
BONE
index
int32
4
Bone index from the BMAP table
Chunk MATR
Bone transformation matrix.
FourCC
uint8[4]
4
MATR
matrix
float[3][4]
48
3x4 matrix. Contains: position, orientation, scale
Chunk VISI
Visibility of a bone.
FourCC
uint8[4]
4
VISI
visibility
int32
4
Visibility flag. Values: 0 - invisible 1 - visible
Chunk MESH
Mesh animation.
FourCC
uint8[4]
4
MESH
size
int32
4
Mesh animation data size
mesh_data
uint8[size]
Mesh animation data
Frame Format V2 (FRM2)
Used in GEM2.
Data structure
Frame Verifier V2
FourCC
uint8[4]
4
FRM2
frame_no
uint16
2
Frame number
key_count
uint8
1
Number of animated keys per frame
keys
struct[key_count]
Key description structure
Key structure (struct[key_count])
bone_map_index
uint8
1
Bone index from the BMAP table
key_flags
uint16
2
Bitmask of animated parameters
Bit mask for key_flags
0x0001
Position
0x0002
Orientation
0x0004
Sign of a mirrored matrix
0x0008
Turning on visibility
0x0010
Turning off visibility
0x0020
Mesh animation
0x0040
Scale
Key data
Fields are present only if the corresponding bit is set in key_flags.
position
float[3]
12
Position
orientation
float[3]
12
Normalized form of a quaternion
scale
float[3]
12
XYZ scale
mesh
struct
Mesh animation
mesh.size
int32
4
Data size
mesh.data
uint8[size]
Binary data of mesh animation
Frame format V3 (FRM3)
Used in GEM2.5 and GEM RTS.
Data structure
Frame Verifier V3
FourCC
uint8[4]
4
FRM3
frame_no
uint8 uint16 uint32
1 2 4
The field size depends on frame_max.
Used by:
uint8, ifframe_max <= 255uint16, ifframe_max <= 65535uint32, ifframe_max >= 65536
key_count
uint8
1
Number of animated keys per frame
keys
struct[key_count]
Key description structure
Key structure (struct[key_count])
bone_map_index
uint8
1
Bone index from the map BMAP table
key_flags
uint16
2
Bitmask of animated parameters
Bit mask (key_flags)
0x0001
Position
0x0002
Orientation
0x0004
Sign of a mirrored matrix
0x0008
Turning on visibility
0x0010
Turning off visibility
0x0020
Mesh animation
0x0040
Scale
Key data
Fields are present only if the corresponding bit is set in key_flags.
position
float[3]
12
Position
orientation
float[3]
12
Normalized form of a quaternion
scale
float[3]
12
XYZ scale
mesh
struct
Mesh animation
mesh.size
int32
4
Data size
mesh.data
uint8[size]
Binary data of mesh animation
Last updated