Impact sounds on materials Primer

About this guide

This guide is intended to take you through a specific function of the sound function library (IMP_PlayImpactSound) With the intention of showing you how to make new sounds for weapon impacts.
It is not meant to be a detailed guide for the sound library, as such a guide would be very long. We will, however, give an overview of the general method employed for determining what sound to play through the sound function library.

What is a function library?

Blueprint Function Libraries are a collection of static functions that provide utility functionality not tied to a particular gameplay object. These libraries can be grouped into logical function sets, e.g. AI Blueprint Library, or contain utility functions that provide access to many different functional areas, e.g. System Blueprint Library. (Ref: https://docs.unrealengine.com/5.3/en-US/blueprint-function-libraries-in-unreal-engine/ )

Function libraries are available in any blueprint, and so knowing the sound function library allows you access to the different functions within that library without having to write them yourself.

Transmission types and surface types

To understand how the Sound Function Library works, let's first talk about Transmission types and Surface types.

A Transmitter is the source the actor acting on the physical surface of a target. This may be a weapon, or a foot, or an arrow, etc.

A Physical Surfaces are the receiving end of the impact and can be another character, the ground, or a shield, etc. Together, these make out a unique identifier for the sound to be played. A hammer that hits a shield should sound different than if an arrow hit the shield.

These two entries are combined into a single reference point for playing a sound called an Identifier. These identifiers often look something like this: “ AxeL_15 ”, or “ footstep_2 ”.

When creating an identifier the transmitter is most often translated by name, followed by an underscore, and finally, the physical surface is appended to the identifier as a number (derived from the index of an enum).

This sounds more complicated than what it really is and we will go through this concept in detail when we look at the impact sounds on materials below.

Impact sounds on materials

The function “ IMP_PlayImpactSound ” is the primary function for determining what sound should be played when an impact happens. An impact Is typically a weapon hit, harvesting a resource node, or blocking. An example of how to call the function can be found in the “BP_CollisionComponent” (By first calling the function “PlayImpactSound”), or “BaseHitActor” (directly calling “IMP_PlayImpactSound”).

The screenshot below shows you how to access the IMP_PlayImpactSound function. In this case, the example is from the BP_CollisionComponent.

As you can see at the end of the execution line of the blueprint, the function takes 3 inputs:

The input of the transmitter and the physical surface type are combined into a single identifier by appending an underscore and the physical surface type to the transmitter name, like this:

This identifier is then looked up in the WeaponMaterialTable (located here: Game/Sound/Tables/WeaponMaterialTable ), and the sound present in the “sound to play” column in that table is then played.