Skip to main content

Bmd

Struct Bmd 

Source
pub struct Bmd { /* private fields */ }
Expand description

Represents a complete Battle Map Definition file decoded in memory.

This struct contains all battle map data including buildings, terrain, lighting, deployment zones, AI hints, and numerous other gameplay and visual elements.

§Field Categories

§Core

  • serialise_version: File format version (23-27)

§Buildings & Objects

  • battlefield_building_list - Buildings inside the battlefield area
  • battlefield_building_list_far - Buildings outside the battlefield area
  • prefab_instance_list: Prefab object instances
  • prop_list: Small decorative props
  • composite_scene_list: Composite scene references

§Terrain & Boundaries

  • terrain_outlines: Terrain area boundaries
  • non_terrain_outlines: Non-terrain area boundaries
  • go_outlines: Traversable area outlines (where units can go).
  • water_outlines: Water body boundaries
  • bmd_outline_list: Additional outline definitions
  • lite_building_outlines: Simplified building outlines
  • playable_area: Playable map boundaries

§Gameplay

  • deployment_list: Unit deployment zones
  • capture_location_set: Capture point locations
  • bmd_catchment_area_list: Catchment area definitions
  • zones_template_list: Zone template definitions
  • ef_line_list: Entity Formation line definitions
  • ai_hints: AI pathfinding and behavior hints

§Lighting

  • point_light_list: Point light sources
  • spot_light_list: Spotlight sources
  • light_probe_list: Global illumination probes

§Effects & Audio

  • particle_emitter_list: Particle effect emitters
  • sound_shape_list: 3D audio zones
  • building_projectile_emitter_list: Building-based projectile emitters

§Vegetation

  • tree_list_reference_list: Tree placement references
  • grass_list_reference_list: Grass placement references

§Advanced Rendering

  • custom_material_mesh_list: Custom material meshes
  • terrain_stencil_triangle_list: Terrain stencil geometry
  • terrain_stencil_blend_triangle_list: Blended stencil geometry
  • terrain_decal_list: Terrain decal placements

§Civilians & Sieges

  • civilian_deployment_list: Civilian unit spawns
  • civilian_shelter_list: Civilian shelter locations
  • toggleable_buildings_slot_list: Destructible building slots

§Cameras

  • camera_zones: Camera constraint volumes

§Getset

All fields have public getters, mutable getters, and setters generated via getset:

let version = bmd.serialise_version();  // Getter
*bmd.serialise_version_mut() = 27;      // Mutable getter
bmd.set_serialise_version(27);          // Setter

§Example

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

let bmd = Bmd::decode(&mut reader, &None)?;

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

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

// Access deployment zones
for zone in bmd.deployment_list().list() {
    println!("Deployment zone: {:?}", zone);
}

Implementations§

Source§

impl Bmd

Source

pub fn serialise_version(&self) -> &u16

File format version number (23-27).

Source

pub fn battlefield_building_list(&self) -> &BattlefieldBuildingList

Building instances inside the battlefield area.

Source

pub fn battlefield_building_list_far(&self) -> &BattlefieldBuildingListFar

Building instances outside the battlefield area.

Source

pub fn capture_location_set(&self) -> &CaptureLocationSet

Groups of capture locations.

Source

pub fn ef_line_list(&self) -> &EFLineList

Entity Formation line definitions.

Source

pub fn go_outlines(&self) -> &GoOutlines

Traversable area outlines (where units can go).

Source

pub fn non_terrain_outlines(&self) -> &NonTerrainOutlines

Non-terrain area boundary outlines.

Source

pub fn zones_template_list(&self) -> &ZonesTemplateList

Zone template definitions.

Source

pub fn prefab_instance_list(&self) -> &PrefabInstanceList

Prefab object instances.

Source

pub fn bmd_outline_list(&self) -> &BmdOutlineList

Additional outline definitions.

Source

pub fn terrain_outlines(&self) -> &TerrainOutlines

Terrain area boundary outlines.

Source

pub fn lite_building_outlines(&self) -> &LiteBuildingOutlines

Simplified building outline definitions.

Source

pub fn camera_zones(&self) -> &CameraZones

Camera constraint volumes.

Source

pub fn civilian_deployment_list(&self) -> &CivilianDeploymentList

Civilian unit deployment locations.

Source

pub fn civilian_shelter_list(&self) -> &CivilianShelterList

Civilian shelter locations.

Source

pub fn prop_list(&self) -> &PropList

Small decorative prop instances.

Source

pub fn particle_emitter_list(&self) -> &ParticleEmitterList

Particle effect emitter instances.

Source

pub fn ai_hints(&self) -> &AIHints

AI pathfinding and behavior hints.

Source

pub fn light_probe_list(&self) -> &LightProbeList

Global illumination light probes.

Source

pub fn terrain_stencil_triangle_list(&self) -> &TerrainStencilTriangleList

Terrain stencil triangle geometry.

Source

pub fn point_light_list(&self) -> &PointLightList

Point light source instances.

Source

pub fn building_projectile_emitter_list(&self) -> &BuildingProjectileEmitterList

Building-based projectile emitter instances.

Source

pub fn playable_area(&self) -> &PlayableArea

Playable map area boundaries.

Source

pub fn custom_material_mesh_list(&self) -> &CustomMaterialMeshList

Custom material mesh instances.

Source

pub fn terrain_stencil_blend_triangle_list( &self, ) -> &TerrainStencilBlendTriangleList

Blended terrain stencil triangle geometry.

Source

pub fn spot_light_list(&self) -> &SpotLightList

Spotlight source instances.

Source

pub fn sound_shape_list(&self) -> &SoundShapeList

3D audio zone definitions.

Source

pub fn composite_scene_list(&self) -> &CompositeSceneList

Composite scene references.

Source

pub fn deployment_list(&self) -> &DeploymentList

Unit deployment zone definitions.

Source

pub fn bmd_catchment_area_list(&self) -> &BmdCatchmentAreaList

Catchment area definitions.

Source

pub fn toggleable_buildings_slot_list(&self) -> &ToggleableBuildingsSlotList

Destructible/toggleable building slot definitions.

Source

pub fn terrain_decal_list(&self) -> &TerrainDecalList

Terrain decal placements.

Source

pub fn tree_list_reference_list(&self) -> &TreeListReferenceList

Tree placement references (links to vegetation files).

Source

pub fn grass_list_reference_list(&self) -> &GrassListReferenceList

Grass placement references (links to vegetation files).

Source

pub fn water_outlines(&self) -> &WaterOutlines

Water body boundary outlines.

Source§

impl Bmd

Source

pub fn serialise_version_mut(&mut self) -> &mut u16

File format version number (23-27).

Source

pub fn battlefield_building_list_mut(&mut self) -> &mut BattlefieldBuildingList

Building instances inside the battlefield area.

Source

pub fn battlefield_building_list_far_mut( &mut self, ) -> &mut BattlefieldBuildingListFar

Building instances outside the battlefield area.

Source

pub fn capture_location_set_mut(&mut self) -> &mut CaptureLocationSet

Groups of capture locations.

Source

pub fn ef_line_list_mut(&mut self) -> &mut EFLineList

Entity Formation line definitions.

Source

pub fn go_outlines_mut(&mut self) -> &mut GoOutlines

Traversable area outlines (where units can go).

Source

pub fn non_terrain_outlines_mut(&mut self) -> &mut NonTerrainOutlines

Non-terrain area boundary outlines.

Source

pub fn zones_template_list_mut(&mut self) -> &mut ZonesTemplateList

Zone template definitions.

Source

pub fn prefab_instance_list_mut(&mut self) -> &mut PrefabInstanceList

Prefab object instances.

Source

pub fn bmd_outline_list_mut(&mut self) -> &mut BmdOutlineList

Additional outline definitions.

Source

pub fn terrain_outlines_mut(&mut self) -> &mut TerrainOutlines

Terrain area boundary outlines.

Source

pub fn lite_building_outlines_mut(&mut self) -> &mut LiteBuildingOutlines

Simplified building outline definitions.

Source

pub fn camera_zones_mut(&mut self) -> &mut CameraZones

Camera constraint volumes.

Source

pub fn civilian_deployment_list_mut(&mut self) -> &mut CivilianDeploymentList

Civilian unit deployment locations.

Source

pub fn civilian_shelter_list_mut(&mut self) -> &mut CivilianShelterList

Civilian shelter locations.

Source

pub fn prop_list_mut(&mut self) -> &mut PropList

Small decorative prop instances.

Source

pub fn particle_emitter_list_mut(&mut self) -> &mut ParticleEmitterList

Particle effect emitter instances.

Source

pub fn ai_hints_mut(&mut self) -> &mut AIHints

AI pathfinding and behavior hints.

Source

pub fn light_probe_list_mut(&mut self) -> &mut LightProbeList

Global illumination light probes.

Source

pub fn terrain_stencil_triangle_list_mut( &mut self, ) -> &mut TerrainStencilTriangleList

Terrain stencil triangle geometry.

Source

pub fn point_light_list_mut(&mut self) -> &mut PointLightList

Point light source instances.

Source

pub fn building_projectile_emitter_list_mut( &mut self, ) -> &mut BuildingProjectileEmitterList

Building-based projectile emitter instances.

Source

pub fn playable_area_mut(&mut self) -> &mut PlayableArea

Playable map area boundaries.

Source

pub fn custom_material_mesh_list_mut(&mut self) -> &mut CustomMaterialMeshList

Custom material mesh instances.

Source

pub fn terrain_stencil_blend_triangle_list_mut( &mut self, ) -> &mut TerrainStencilBlendTriangleList

Blended terrain stencil triangle geometry.

Source

pub fn spot_light_list_mut(&mut self) -> &mut SpotLightList

Spotlight source instances.

Source

pub fn sound_shape_list_mut(&mut self) -> &mut SoundShapeList

3D audio zone definitions.

Source

pub fn composite_scene_list_mut(&mut self) -> &mut CompositeSceneList

Composite scene references.

Source

pub fn deployment_list_mut(&mut self) -> &mut DeploymentList

Unit deployment zone definitions.

Source

pub fn bmd_catchment_area_list_mut(&mut self) -> &mut BmdCatchmentAreaList

Catchment area definitions.

Source

pub fn toggleable_buildings_slot_list_mut( &mut self, ) -> &mut ToggleableBuildingsSlotList

Destructible/toggleable building slot definitions.

Source

pub fn terrain_decal_list_mut(&mut self) -> &mut TerrainDecalList

Terrain decal placements.

Source

pub fn tree_list_reference_list_mut(&mut self) -> &mut TreeListReferenceList

Tree placement references (links to vegetation files).

Source

pub fn grass_list_reference_list_mut(&mut self) -> &mut GrassListReferenceList

Grass placement references (links to vegetation files).

Source

pub fn water_outlines_mut(&mut self) -> &mut WaterOutlines

Water body boundary outlines.

Source§

impl Bmd

Source

pub fn set_serialise_version(&mut self, val: u16) -> &mut Self

File format version number (23-27).

Source

pub fn set_battlefield_building_list( &mut self, val: BattlefieldBuildingList, ) -> &mut Self

Building instances inside the battlefield area.

Source

pub fn set_battlefield_building_list_far( &mut self, val: BattlefieldBuildingListFar, ) -> &mut Self

Building instances outside the battlefield area.

Source

pub fn set_capture_location_set(&mut self, val: CaptureLocationSet) -> &mut Self

Groups of capture locations.

Source

pub fn set_ef_line_list(&mut self, val: EFLineList) -> &mut Self

Entity Formation line definitions.

Source

pub fn set_go_outlines(&mut self, val: GoOutlines) -> &mut Self

Traversable area outlines (where units can go).

Source

pub fn set_non_terrain_outlines(&mut self, val: NonTerrainOutlines) -> &mut Self

Non-terrain area boundary outlines.

Source

pub fn set_zones_template_list(&mut self, val: ZonesTemplateList) -> &mut Self

Zone template definitions.

Source

pub fn set_prefab_instance_list(&mut self, val: PrefabInstanceList) -> &mut Self

Prefab object instances.

Source

pub fn set_bmd_outline_list(&mut self, val: BmdOutlineList) -> &mut Self

Additional outline definitions.

Source

pub fn set_terrain_outlines(&mut self, val: TerrainOutlines) -> &mut Self

Terrain area boundary outlines.

Source

pub fn set_lite_building_outlines( &mut self, val: LiteBuildingOutlines, ) -> &mut Self

Simplified building outline definitions.

Source

pub fn set_camera_zones(&mut self, val: CameraZones) -> &mut Self

Camera constraint volumes.

Source

pub fn set_civilian_deployment_list( &mut self, val: CivilianDeploymentList, ) -> &mut Self

Civilian unit deployment locations.

Source

pub fn set_civilian_shelter_list( &mut self, val: CivilianShelterList, ) -> &mut Self

Civilian shelter locations.

Source

pub fn set_prop_list(&mut self, val: PropList) -> &mut Self

Small decorative prop instances.

Source

pub fn set_particle_emitter_list( &mut self, val: ParticleEmitterList, ) -> &mut Self

Particle effect emitter instances.

Source

pub fn set_ai_hints(&mut self, val: AIHints) -> &mut Self

AI pathfinding and behavior hints.

Source

pub fn set_light_probe_list(&mut self, val: LightProbeList) -> &mut Self

Global illumination light probes.

Source

pub fn set_terrain_stencil_triangle_list( &mut self, val: TerrainStencilTriangleList, ) -> &mut Self

Terrain stencil triangle geometry.

Source

pub fn set_point_light_list(&mut self, val: PointLightList) -> &mut Self

Point light source instances.

Source

pub fn set_building_projectile_emitter_list( &mut self, val: BuildingProjectileEmitterList, ) -> &mut Self

Building-based projectile emitter instances.

Source

pub fn set_playable_area(&mut self, val: PlayableArea) -> &mut Self

Playable map area boundaries.

Source

pub fn set_custom_material_mesh_list( &mut self, val: CustomMaterialMeshList, ) -> &mut Self

Custom material mesh instances.

Source

pub fn set_terrain_stencil_blend_triangle_list( &mut self, val: TerrainStencilBlendTriangleList, ) -> &mut Self

Blended terrain stencil triangle geometry.

Source

pub fn set_spot_light_list(&mut self, val: SpotLightList) -> &mut Self

Spotlight source instances.

Source

pub fn set_sound_shape_list(&mut self, val: SoundShapeList) -> &mut Self

3D audio zone definitions.

Source

pub fn set_composite_scene_list(&mut self, val: CompositeSceneList) -> &mut Self

Composite scene references.

Source

pub fn set_deployment_list(&mut self, val: DeploymentList) -> &mut Self

Unit deployment zone definitions.

Source

pub fn set_bmd_catchment_area_list( &mut self, val: BmdCatchmentAreaList, ) -> &mut Self

Catchment area definitions.

Source

pub fn set_toggleable_buildings_slot_list( &mut self, val: ToggleableBuildingsSlotList, ) -> &mut Self

Destructible/toggleable building slot definitions.

Source

pub fn set_terrain_decal_list(&mut self, val: TerrainDecalList) -> &mut Self

Terrain decal placements.

Source

pub fn set_tree_list_reference_list( &mut self, val: TreeListReferenceList, ) -> &mut Self

Tree placement references (links to vegetation files).

Source

pub fn set_grass_list_reference_list( &mut self, val: GrassListReferenceList, ) -> &mut Self

Grass placement references (links to vegetation files).

Source

pub fn set_water_outlines(&mut self, val: WaterOutlines) -> &mut Self

Water body boundary outlines.

Source§

impl Bmd

Source

pub fn export_prefab_to_raw_data( &self, name: &str, vegetation: Option<&BmdVegetation>, output_path: &Path, ) -> Result<()>

Exports this BMD to Terry (Creative Assembly’s editor) format.

Generates two files for use in Terry:

  • .terry - Project file defining the prefab structure
  • .layer - Scene layer with entities, associations, and vegetation
§Parameters
  • name: Base name for output files (e.g., “siege_map”)
  • vegetation: Optional vegetation data from BMD vegetation file
  • output_path: Directory where files will be created
§Returns
  • Ok(()): Successfully exported files
  • Err(_): I/O error or conversion error
§Generated Files
  • {name}.terry - Project file with scene hierarchy
  • {name}.187abf10b8b9a13.layer - Layer file with entities
§Entity Associations

The layer file includes two association types:

  • Logical: Parent-child grouping relationships in Terry’s UI
  • Transform: Spatial/hierarchical relationships
§Example
use rpfm_lib::files::bmd::Bmd;
use rpfm_lib::files::bmd_vegetation::BmdVegetation;
use std::path::Path;

let bmd = Bmd::decode(&mut reader, &None)?;
let vegetation = BmdVegetation::decode(&mut veg_reader, &None)?;

bmd.export_prefab_to_raw_data(
    "my_battle_map",
    Some(&vegetation),
    Path::new("output/")
)?;
§Note

Not all BMD data lists are currently exported. Some are commented out in the implementation and will be added as export support is completed.

Source

pub fn logical_associations(&self) -> HashMap<String, Vec<String>>

Returns logical entity associations for Terry export.

Logical associations define parent-child grouping relationships for organizing entities in Terry’s UI hierarchy.

§Returns

Map of parent entity IDs to their logically grouped child entity IDs.

§Note

Currently returns an empty map. Will be populated as association logic is implemented.

Source

pub fn trasnform_associations(&self) -> HashMap<String, Vec<String>>

Returns transform (spatial hierarchy) entity associations for Terry export.

Transform associations define parent-child spatial relationships between entities (e.g., props attached to buildings, lights attached to structures).

§Returns

Map of parent entity IDs to their child entity IDs.

§Note

Currently returns an empty map. Will be populated as association logic is implemented.

Trait Implementations§

Source§

impl Clone for Bmd

Source§

fn clone(&self) -> Bmd

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Bmd

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Decodeable for Bmd

Source§

fn decode<R: ReadBytes>( data: &mut R, extra_data: &Option<DecodeableExtraData<'_>>, ) -> Result<Self>

Decodes binary data into the implementing type. Read more
Source§

impl Default for Bmd

Source§

fn default() -> Bmd

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Bmd

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Encodeable for Bmd

Source§

fn encode<W: WriteBytes>( &mut self, buffer: &mut W, extra_data: &Option<EncodeableExtraData<'_>>, ) -> Result<()>

Encodes the implementing type into binary data. Read more
Source§

impl PartialEq for Bmd

Source§

fn eq(&self, other: &Bmd) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Bmd

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Bmd

Auto Trait Implementations§

§

impl Freeze for Bmd

§

impl RefUnwindSafe for Bmd

§

impl Send for Bmd

§

impl Sync for Bmd

§

impl Unpin for Bmd

§

impl UnsafeUnpin for Bmd

§

impl UnwindSafe for Bmd

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,