Skip to main content

Module bmd

Module bmd 

Source
Expand description

Battle Map Definition (BMD) file format support.

BMD files (.bmd) are FASTBIN0-format files that define battle map layouts for Total War games. They contain comprehensive 3D scene data including buildings, terrain, lighting, vegetation, deployment zones, AI hints, and other gameplay-critical map elements.

§File Format

BMD files use the FASTBIN0 binary format with a version-specific structure:

[8 bytes]  FASTBIN0 signature
[u16]      serialise_version
[...]      version-specific data

§Supported Versions

All currently supported versions are:

  • Version 23
  • Version 24
  • Version 25
  • Version 26
  • Version 27

§File Contents

BMD files contain numerous specialized data lists:

§Buildings & Structures

  • BattlefieldBuildingList - Buildings inside the battlefield area
  • BattlefieldBuildingListFar - Buildings outside the battlefield area
  • PrefabInstanceList - Prefab object instances
  • PropList - Small decorative props

§Terrain & Outlines

  • TerrainOutlines - Terrain boundary definitions
  • NonTerrainOutlines - Non-terrain area boundaries
  • GoOutlines - Traversable areas (where units can go)
  • WaterOutlines - Water body boundaries

§Gameplay Elements

  • DeploymentList - Unit deployment zones
  • CaptureLocationSet - Groups of capture locations
  • PlayableArea - Playable map boundaries
  • AIHints - AI pathfinding and behavior hints

§Lighting & Visual Effects

  • PointLightList - Point light sources
  • SpotLightList - Spotlight sources
  • LightProbeList - Global illumination probes
  • ParticleEmitterList - Particle effect emitters

§Vegetation

  • TreeListReferenceList - Tree placement references
  • GrassListReferenceList - Grass placement references

§Other

  • CameraZones - Camera constraint zones
  • SoundShapeList - 3D audio zones
  • CompositeSceneList - Composite scene references
  • CustomMaterialMeshList - Custom material meshes
  • And 20+ more specialized lists

§Usage

use rpfm_lib::files::bmd::Bmd;
use rpfm_lib::files::Decodeable;

// Decode a BMD file
let bmd = Bmd::decode(&mut reader, &None)?;

println!("BMD version: {}", bmd.serialise_version());

// Access building list
for building in bmd.battlefield_building_list().list() {
    println!("Building: {:?}", building.key());
}

// Export to Terry (CA's editor format)
bmd.export_prefab_to_raw_data("map_name", Some(&vegetation), &output_path)?;

§Terry Export

BMD files can be exported to Terry (Creative Assembly’s map editor) format using Bmd::export_prefab_to_raw_data(). This generates:

  • .terry project file
  • .layer scene layer file with entities and associations

§File Location

BMD files are typically found in:

terrain/battles/*.bmd
terrain/tiles/*.bmd

Modules§

common
Common data structures shared across BMD format files.

Structs§

Bmd
Represents a complete Battle Map Definition file decoded in memory.

Constants§

EXTENSIONS
File extension for Battle Map Definition files.
SIGNATURE
FASTBIN0 file signature.

Traits§

ToLayer
Trait for converting BMD data structures to Terry .layer XML format.