With the footsteps recorded and ready to go within Wwise, I could now begin the process of creating the footsteps system in the Unreal Engine. It uses a node based coding system that I had to get to grips with for the first time, but allows for programming by stringing processes together in a very visual way. As I am not a programmer, this is very intuative and accessable to me.
The first step to adding footsteps is to define the physical surfaces that the player will walk on. Doing this will enable the creation of physical materials of objects to have these surfaces applied to them. For example, the stone texture in my level can be applied with a stone physical material, telling Wwise that the player is walking on stone.
The above nodes are part of a section of the Player Character blueprint, the script that controls everything to do with the player. The nodes start from the left and move across the screen to the right and this is the start of the footsteps audio process.
Beginning at the Event Tick node which will fire a signal every frame of gameplay (60 frames per second). This adds to a timer to for the footsteps to keep time with. This then moves into a Branch node which works like an If statement in coding. If the red input (red is boolean so can either be true or false) is true then perform the next action.
In this case the red input is checking if the player is moving and that 2.2 seconds has passed since they started moving. Editing the float value at the bottom of the screen will change the rate in which the sound is triggered. This needed to be tested to choose a realistic pace for the footstep sounds to be triggered.
From the True outlet of the Branch node, the next process is started which checks if the player is on the ground. It does this by using a LineTraceByChannel node which fires a line at the ground. If the line hits the ground at the height of the player, they must be touching the ground. This outputs another boolean output into another branch node.
The next node in the process is another LineTraceByChannel that this time fires a line at the ground but instead checks the Physical Material of the surface by having the OutHit node travel into a Break Hit Result Node. This then outputs the name of the material which can then be sent into Wwise with a Set Switch node that will change the switch to the name of the material.
The final step of the footsteps audio process is to proceed through a delay node that waits 0.2 seconds, then into a Post Event node that will play a Wwise event (in this case the Player_Footsteps event) at the position of a selected actor which is self. Self refers to the current blueprint so the sound will be played at the location of the player.
Next it goes into a Set Occlusion Refresh Interval node which is set to 0 which will ensure that the footsteps sounds are never occluded. Finally it travels into a Set node which resets the timer variable to 0 so the process can start again.