Skip to main content

Module cs2_parsed

Module cs2_parsed 

Source
Expand description

CS2 Parsed file format support.

CS2 Parsed files (.cs2.parsed) define gameplay logic and interaction data for 3D building models in Total War games. These files contain information about unit placement, pathfinding, collision, defense positions, and various building-specific behaviors.

§File Format

CS2 Parsed files are binary files containing:

  • Version header
  • UI flag position for minimap display
  • Building pieces with destruction states
  • Gameplay logic: platforms, pipes, gates, EF lines, etc.
  • Legacy collision data (moved to separate .cs2.collision files in newer games)
  • Projectile emitters (moved to map data in newer games)

§Supported Versions

  • Version 0: Legacy format (Empire/Napoleon)
  • Version 8: Legacy format
  • Version 9: Legacy format
  • Version 10: Legacy format
  • Version 11: Legacy format
  • Version 12: Legacy format
  • Version 13: Legacy format
  • Version 18: Older format (Three Kingdoms)
  • Version 20: Older format (Troy/Warhammer II)
  • Version 21: Current format (Warhammer III)

§Key Components

§Platforms

Define walkable surfaces where units can stand and fight.

§Pipes

Define paths for unit movement between platforms (stairs, ladders, doors, etc.).

§EF Lines (Entity Formation Lines)

Define positions where units form up for specific actions (firing lines, boarding positions, officer spawn points, etc.).

§Gates

Define entrance/exit collision for wall gates.

§Docking Lines

Define where siege equipment can attach to walls.

§Usage

use rpfm_lib::files::cs2_parsed::Cs2Parsed;
use rpfm_lib::files::Decodeable;

// Decode from binary data
let parsed = Cs2Parsed::decode(&mut data, &None)?;

// Access building pieces
for piece in parsed.pieces() {
    println!("Piece: {}", piece.name());

    // Access destructs (damage states)
    for destruct in piece.destructs() {
        println!("  Destruct: {} ({} platforms, {} pipes)",
            destruct.name(),
            destruct.platforms().len(),
            destruct.pipes().len()
        );
    }
}

§File Location

These files are typically found at:

  • rigidmodels/buildings/*/*.cs2.parsed

Structs§

CollisionOutline
A 3D collision outline.
Cs2Parsed
Represents a CS2 Parsed file decoded in memory.
Destruct
A destruction state of a building piece.
DockingLine
Line where siege equipment can attach to walls.
EFLine
Entity Formation line for unit positioning and actions.
FileRef
Reference to an attached building model.
Gate
Gate collision data for wall gates.
OrangeThingy
Unknown vertex data (possibly no-go zones).
Piece
A piece of a building model with multiple destruction states.
Pipe
A path for unit movement between platforms.
Platform
A walkable platform surface where units can stand and fight.
ProjectileEmitter
Projectile emitter position for building-based ranged attacks.
SoftCollisions
Soft collision data.
UiFlag
UI flag position shown on the minimap.
Vfx
Visual effects attachment point.

Constants§

EXTENSION
File extension for CS2 Parsed files.