Audio: Multiphase Destruction – Arma Reforger

From Bohemia Interactive Community
Jump to navigation Jump to search
(Page creation)
 
m (Text replacement - "\{\{GameCategory\|armaR\|Modding\|(Guidelines|Tutorials)\|([^=↵]*)\}\}" to "{{GameCategory|armaR|Modding|$2|$1}}")
 
(2 intermediate revisions by the same user not shown)
Line 9: Line 9:
*# The enum string (e.g., "METAL_HEAVY") combines with "SOUND_MPD_" to form the sound name (e.g., "SOUND_MPD_METAL_HEAVY").
*# The enum string (e.g., "METAL_HEAVY") combines with "SOUND_MPD_" to form the sound name (e.g., "SOUND_MPD_METAL_HEAVY").
*# The system plays the sound from the {{hl|.acp}} file linked to the MPDestructionManager.
*# The system plays the sound from the {{hl|.acp}} file linked to the MPDestructionManager.
{{Feature|warning|In order for Multiphase Destruction to work, a Multiphase Destruction Manager must be present within the world.}}




Line 18: Line 20:




== MPD Sound Setup ==
== MPD Enum Overview ==
 
{{Feature|warning|In order for Multiphase Destruction to work, a Multiphase Destruction Manager must be present within the world.}}
 
=== MPD Manager Setup ===
 
* {{armaR}} uses one universal prefab for the MPDestruction Manager: {{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/MP/MPDestructionManager.et}}
* In its base entity, {{hl|SCR_MPDestructionManager}}, the default {{hl|.acp}} file is defined ({{hl|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:
Sounds use enum values. Pick one of the following two to mod:
Line 162: Line 154:


|}
|}
=== 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 {{hl|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 {{hl|Destruction_Multiphase.sig}} Signal file.
* There are three important Signals that can be used to change the sound dynamically: {{hl|PhasesToDestroyed}}, {{hl|EntitySize}} and {{hl|CollisionDV}}; more information about them can be found {{Link|#Signals|here}}.
=== Entity Setup ===
Entities either have a {{hl|SCR_DestructionMultiphaseComponent}} or integrate the MPD functionality in the entity type itself.
All components and entities that use MPD can be found below:
{| class="wikitable valign-top"
! Entities
! Components
|-
|
* {{Link/Enfusion|armaR|DestructibleEntity}}
* {{Link/Enfusion|armaR|SCR_DestructibleEntity}}
* {{Link/Enfusion|armaR|SCR_LargeDestructibleEntity}}
* {{Link/Enfusion|armaR|SCR_SmallDestructibleEntity}}
|
* {{Link/Enfusion|armaR|SCR_DestructionDamageManagerComponent}}
* {{Link/Enfusion|armaR|SCR_DestructionMultiPhaseComponent}}
|}
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 {{hl|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.
{{Feature|informative|
* 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.
}}




Line 243: Line 192:
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.
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.


{{Feature|informative|
=== Diag Menu ===
 
If a {{hl|DestructionMPDestructionManager.et}} is present in the world, a {{Link|Arma Reforger:Diag Menu}} entry can be found:
If a {{hl|DestructionMPDestructionManager.et}} is present in the world, a {{Link|Arma Reforger:Diag Menu}} entry can be found:
  Diag Menu \ Sounds \ Show MPD Impulse Values
  Diag Menu \ Sounds \ Show MPD Impulse Values


Upon colliding, the debris entity will then display the impulse data in the format {{hl|<impulse value>/<impulse threshold>/<mass>}}.
Upon colliding, the debris entity will then display the impulse data in the format {{hl|<impulse value>/<impulse threshold>/<mass>}}.
}}


=== Check for Prefabs Lacking Sound Definition ===
=== Sound Definition Check ===


In the main Workbench Window ('''not''' World Editor), the "Multiphase Destruction Soundless Prefab Search" tool can be accessed via Plugins → Prefabs.
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.
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.
# Open any terrain
# Make sure an {{hl|MPDestructionManager}} is present in the GameWorld. (If not, add ''Prefabs → MP → MPDestructionManager.et'')
# Place the entity you want to test (make sure MPD is enabled)
# Then
## If it is a GenericEntity with an {{hl|SCR_DestructionMultiPhaseComponent}}
### In the "Destruction Setup" tab, set
#### '''Base Health''' to 1
### In the "Unsorted" tab, search for ''Additional Hitzones → Default'' and set
#### '''Max Health''' to 1
#### '''Damage Reduction''' to 0
#### '''Damage Threshold''' to 0
## If it is an Entity with integrated MPD functionality
### In the Unsorted tab, set
#### '''Max Health''' to 1,
#### '''Base Damage Multiplier''' to 1
#### '''Damage Reduction''' to 0
#### '''Damage Threshold''' to 0
### Save the change to the prefab and reload the world.
# The target should now get destroyed in 1 shot from any weapon.
# (Optional) To fully isolate the MPD sounds,
## Open the Audio Editor
## Open ''Debug → In-Game Debug → Sounds / Signals''. The In-Game Debug window opens.
## Uncheck "Strict Filtering"
## Enter {{hl|SOUND_MPD}} in the filter string bar
## The game will now only play back sounds that have {{hl|SOUND_MPD}} in their Sound Event name.




{{GameCategory|armaR|Modding|Guidelines}}
{{GameCategory|armaR|Modding|Audio|Guidelines}}

Latest revision as of 14:32, 26 February 2025

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.
In order for Multiphase Destruction to work, a Multiphase Destruction Manager must be present within the world.


Design


MPD Enum Overview

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


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.

Diag Menu

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>.

Sound Definition Check

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.