Audio: Multiphase Destruction – Arma Reforger

From Bohemia Interactive Community
Revision as of 16:25, 31 January 2025 by Lou Montana (talk | contribs) (Page creation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The Multiphase Destruction (MPD) system handles environmental destruction (e.g., breaking signs, crumbling walls, etc.). Each MPD entity transitions through "damage phases", altering its model, spawning debris and particle effects, or emitting sounds.

  • For efficiency, sounds are managed by the Audio: SCR SoundManagerEntity system, not individual entities. Entities reference enums in SCR_DestructionMultiPhaseComponent for sound definitions.
  • Sounds are triggered:
    1. When an entity's damage phase changes (using SCR_EMaterialSoundTypeBreak).
    2. When spawned debris collides with the environment or other entities (using SCR_EMaterialSoundTypeDebris).
  • When triggering a sound:
    1. The enum string (e.g., "METAL_HEAVY") combines with "SOUND_MPD_" to form the sound name (e.g., "SOUND_MPD_METAL_HEAVY").
    2. The system plays the sound from the .acp file linked to the MPDestructionManager.


Design


MPD Sound Setup

In order for Multiphase Destruction to work, a Multiphase Destruction Manager must be present within the world.

MPD Manager Setup

  • Arma Reforger uses one universal prefab for the MPDestruction Manager: MPDestructionManager.et
  • In its base entity, SCR_MPDestructionManager, the default .acp file is defined (Destruction_Multiphase.acp) in the "Untitled" category in "Sound Project".
  • "Sound Event Name" is unused.

Enum Setup

Sounds use enum values. Pick one of the following two to mod:

  • SCR_EMaterialSoundTypeBreak if the sound is supposed to play when the entity changes its damage phase.
    In this case, the enum must start with "BREAK_", e.g. "BREAK_GLASSBOTTLE";
  • SCR_EMaterialSoundTypeDebris if the sound is supposed to play when debris collides with the environment

Add the desired name to the correct enum through modding - make sure to choose a descriptive one. Example:

Copy
modded enum SCR_EMaterialSoundTypeBreak { BREAK_GLASSBOTTLE, }

Break Sounds Debris Sounds
SCR_EMaterialSoundTypeBreak SCR_EMaterialSoundTypeDebris
Defined via the "Material Sound Type" entry in the "Unsorted" category .

These sounds will play once when the entity breaks OR changes its damage phase (PhasesToDestroyed Signal).

Example: A wooden fence breaking and playing a snapping/splintering sound.

Defined in the "Small Debris" classes of the destructible entity. This sound will trigger when the spawned debris collides with something else and a certain impact threshold is exceeded.

Example: Broken off wooden fence plank falls over and impacts with the ground.

Enum Value Description
NONE No sound, default
BREAK_GLASS Small glass objects, e.g. a glass or bottle
BREAK_GLASS_PANE Larger glass objects, e.g. car or building windows
BREAK_GROUNDRADAR Dedicated sound for breaking ground radars
BREAK_MATRESS Soft thump, used for soft, cloth-like sounds
BREAK_METAL General metal break sound
BREAK_METAL_GENERATOR When a generator breaks down
BREAK_METAL_NETFENCE Metal-ish sound with elements of netfence rattling
BREAK_METAL_POLE Resonant pole break sound
BREAK_PIANO Dedicated sound for breaking pianos
BREAK_PLASTIC Sharp smaller-scale plastic cracking
BREAK_ROCK Break sound for larger rock/stone/asphalt objects, e.g. a massive wall
BREAK_SANDBAG Soft and plastic-y
BREAK_TENT Dedicated sound for tents
BREAK_WATERHYDRANT Dedicated sound for waterhydrants
BREAK_WOOD_SOLID Universal wooden break sound
Enum Name Description
NONE No sound, default
BELL_SMALL Dedicated sound for small bells
GLASS Small glass objects, e.g. bottles
MATRESS Dedicated sound for matresses and pillows
METAL_HEAVY Heavy metal impacts
METAL_LIGHT Light, crisp metal impacts
METAL_NETFENCE Metal-y impacts with netfence rattling
METAL_POLE Resonant, medium-sized metal
PLASTIC_HOLLOW E.g. a tube or food container
PLASTIC_SOLID E.g. an old telephone
ROCK Concrete chunks
ROCK_SMALL More brick-like, slightly hollow
SANDBAG Soft and plastic-y
WOOD_PLANK_SMALL For small, wooden objects, e.g. fence boards
WOOD_PLANK_LARG For large(r) wooden objects, such as smaller tree trunks


ACP and File Setup

  • All MPD-related samples should be stored in Sounds → Destruction → Multiphase → Samples, with their folder matching the corresponding enum
  • If the enum value is e.g. "BREAK_GLASSBOTTLE", the folder must be called Break_GlassBottle
  • The most important thing regarding the actual ACP is the name of the Sound Event / Sound Node. The system will automatically create a mix of "SOUND_MPD_" + the name of the enum value. If our enum is e.g. "BREAK_GLASSBOTTLE", the Sound Event must be called "SOUND_MPD_BREAK_GLASSBOTTLE".
  • Any logic should be kept in the singular Destruction_Multiphase.sig Signal file.
  • There are three important Signals that can be used to change the sound dynamically: PhasesToDestroyed, EntitySize and CollisionDV; more information about them can be found here.

Entity Setup

Entities either have a SCR_DestructionMultiphaseComponent or integrate the MPD functionality in the entity type itself.

All components and entities that use MPD can be found below:

Entities Components

Break sounds:

  • Find the Material Sound Type towards the bottom of the "Unsorted" tab.
  • Choose a fitting sound type from its dropdown menu.

Debris sounds:

  • Find the "Small Debris" classes of the entity (sounds are defined in there):
    • For a GenericEntity with SCR_DestructionMultiPhaseComponent, find "Destroy Spawn Objects" in the Destruction FX tab.
    • For entities with built-in MPD, find "Phase Destroy Spawn Objects" in the Unsorted tab under destruction phases.
  • Sounds are set in Material Sound Type at the bottom, using the SCR_EMaterialSoundType ENUM. Choose sounds matching the debris models defined in the Model Prefabs array.
  • If no suitable sound exists and the entity is common, consider creating a new one.
  • When assigning a sound to a Small Debris class, all model prefabs in Model Prefabs will use that sound. If certain prefabs differ too much to share the same sound, ask Encoding to reassign them to a more fitting class or create a new one.


Signals

Not all signals are available for each type of sound.

Signal Name Description Available for Break Sounds Available for Impact Sounds
PhasesToDestroyed An integer indicating how damaged the entity is.
  •   0 = Total destruction
  •   1 = Broken
  • > 1 = Anything else
Checked Unchecked
EntitySize The entity's mass, usually used in order to "scale" sounds. Checked Checked
CollisionDV A value reflecting the change in speed of an entity upon contact (how fast was it before, how much was it slowed down?) Unchecked Checked


Debugging

If any issues arise, the first step should always be to make sure an MPDestructionManager entity exists in the world. Check if the SCR_DestructionMultiPhaseComponent is actually enabled (if it is an Entity with integrated MPD functionality, make sure "Enabled" is checked in the "Unsorted" tab). Entities with integrated MPD functionality will always use the values stored in their Prefabs - meaning a per-instance change will not work. A Prefab change also requires a reload of the current world.

If a DestructionMPDestructionManager.et is present in the world, a Diag Menu entry can be found:
Diag Menu \ Sounds \ Show MPD Impulse Values
Upon colliding, the debris entity will then display the impulse data in the format <impulse value>/<impulse threshold>/<mass>.

Check for Prefabs Lacking Sound Definition

In the main Workbench Window (not World Editor), the "Multiphase Destruction Soundless Prefab Search" tool can be accessed via Plugins → Prefabs. The tool will go through all prefabs and list in the debug console log those which do not have a "Break" or "Impact" sound defined.

Test MPD Sound in Game

This method should only be used to check if sounds work/are present in general. The broken objects behave differently based on damage dealt and impulses, so the only "proper" way is it to actually destroy them as they would get destroyed in-game. Look at step 6 to isolate the sounds when doing so.

  1. Open any terrain
  2. Make sure an MPDestructionManager is present in the GameWorld. (If not, add Prefabs → MP → MPDestructionManager.et)
  3. Place the entity you want to test (make sure MPD is enabled)
  4. Then
    1. If it is a GenericEntity with an SCR_DestructionMultiPhaseComponent
      1. In the "Destruction Setup" tab, set
        1. Base Health to 1
      2. In the "Unsorted" tab, search for Additional Hitzones → Default and set
        1. Max Health to 1
        2. Damage Reduction to 0
        3. Damage Threshold to 0
    2. If it is an Entity with integrated MPD functionality
      1. In the Unsorted tab, set
        1. Max Health to 1,
        2. Base Damage Multiplier to 1
        3. Damage Reduction to 0
        4. Damage Threshold to 0
      2. Save the change to the prefab and reload the world.
  5. The target should now get destroyed in 1 shot from any weapon.
  6. (Optional) To fully isolate the MPD sounds,
    1. Open the Audio Editor
    2. Open Debug → In-Game Debug → Sounds / Signals. The In-Game Debug window opens.
    3. Uncheck "Strict Filtering"
    4. Enter SOUND_MPD in the filter string bar
    5. The game will now only play back sounds that have SOUND_MPD in their Sound Event name.