Skip to main content

Module anim_fragment_battle

Module anim_fragment_battle 

Source
Expand description

Animation fragment battle file format support.

This module handles animation fragment files (.bin/.frg) which define battle animations for units in Total War games. These files replaced the older text-based animation tables with a more efficient binary format.

§File Format

Animation fragments use game-specific binary formats with different versions:

  • Version 2 (Warhammer 2): Basic animation metadata with file references
  • Version 2 (Three Kingdoms): Enhanced with mount/unmount tables and locomotion graphs
  • Version 4 (Warhammer 3): Advanced format with animation references and cavalry tech flags

§File Extensions

  • .bin - Modern binary animation fragment files (Warhammer 2+)
  • .frg - Legacy fragment file extension (older games)

§File Organization

Animation fragments are stored in:

animations/{skeleton_name}/battle/{animation_type}.bin

§Supported Games

Full support for:

  • Total War: Warhammer II (version 2)
  • Total War: Three Kingdoms (version 2, enhanced)
  • A Total War Saga: Troy (version 2)
  • Total War: Warhammer III (version 4)
  • Total War: Pharaoh / Pharaoh Dynasties (version 2)

Older games (pre-Warhammer 2) are not supported.

§Animation Entry Structure

Each entry contains:

  • Animation ID and metadata (blend time, selection weight)
  • Weapon bone flags (for weapon attachment points)
  • File references to animation data and metadata
  • Optional single-frame variant flag

§Table Conversion

Animation fragments can be converted to/from TableInMemory for editing as TSV files.

§Usage

use rpfm_lib::files::anim_fragment_battle::AnimFragmentBattle;
use rpfm_lib::files::Decodeable;

// Decode an animation fragment
let fragment = AnimFragmentBattle::decode(&mut data, &Some(extra_data))?;

// Access entries
for entry in fragment.entries() {
    println!("Animation {}: blend={}, weight={}",
        entry.animation_id(),
        entry.blend_in_time(),
        entry.selection_weight()
    );
}

// Convert to table for TSV export
let table = fragment.to_table()?;

Structs§

AnimFragmentBattle
Represents a battle animation fragment file.
AnimRef
Animation file reference (version 4 only).
Entry
Represents a single animation entry within a fragment.
WeaponBone
Weapon attachment bone flags.

Constants§

BASE_PATH
Base directory path for animation files.
EXTENSION_NEW
Modern file extension for animation fragment files.
EXTENSION_OLD
Legacy file extension for animation fragment files.
MID_PATH
Middle path component for battle animations.