This post describes the implementation of combo sound effects with ADX2 using the Combo Sequential Cue type and without requiring any code.
[Before going further, if you are not familiar with the Cue system in ADX2, we recommend that you watch this Video Tutorial to learn more about it.]
What is a Sequential Cue?
A Sequential Cue can be used when we want to play a different sound each time the Cue is triggered, following a predefined order. A countdown would be a good example. When first triggered, a Sequential Cue will play the top-most Track (as it appears on the Cue timeline in AtomCraft). Then, for each subsequent request, the next Track will be played back. When the last Track has been played, the first Track will play again and the cycle starts again. [Note that the order in which the Tracks are played can also be defined in a playlist].
Below is a simple example of a Sequential Cue using two footstep sound effects. It will therefore simulate –rather crudely – a left-foot / right-foot walking cycle by playing them one after the other.
What is a Combo Sequential Cue?
The Combo Sequential Cue builds upon the Sequential Cue while introducing the notion of playback timing. More specifically, a Combo Sequential Cue will play its Tracks sequentially only when the subsequent playback requests are issued within a specified time window.
Therefore, it works like this: when the Cue is first triggered, the top-most Track is played. Then, for each subsequent request, the next Track is played, but only if the Cue has been re-triggered within a given period of time. When it reaches the last Track, it returns to a specified Track. At any point, if the Cue is triggered outside of the allowed time window, it will go back to the first Track.
The origin of the Combo Sequential Cue
As its name suggests, this type of Cue is of course very useful to implement combo sound effects, such as the ones found in numerous fighting games or platformers.
Tatsuya Suizu, the main architect of the AtomCraft tool recalls: “The first implementation of the Combo Sequential Cue goes back to 2010. It was first added to CriAudio, our previous game audio middleware and the parent of ADX2. It was done at the request of a sound designer from SEGA. His team was mainly developing Sonic titles and, for Sonic the Hedgehog 4, I remember that they wanted a sound design that would create a musical scale while the player was progressively breaking an object in the level but that it should reset after a predefined time interval.”
Setting the Combo Sequential Cue
In addition to the common Cue settings, a Combo Sequential Cue has two specific parameters – the [Combo Interval] and the [Combo Loop Back]. They both can be found in the property pane.
Combo Interval: Here, we specify the time period (in milliseconds) during which the Cue has to be retriggered for the next Track to be played. Once this period expired, the Cue will automatically return to the first Track.
Combo Loop Back: This is where we specify which Track to play once the Cue has reached the last Track and has been re-triggered within the combo interval. It is a 0-based index so, for instance, if we enter “0” here, the next time the Cue is triggered it will play the first Track.
Creating a Combo Sequential Cue in AtomCraft
In this project we simulate a 4-stage combo for a fighting character:
Here is a screenshot of the project open in AtomCraft. You can see the Combo Sequential Cue with its 4 tracks in the middle of the screen. The 4 wave files used are in the Materials section in the bottom-left corner.
A few other implementation details are worth noting in that project. We added a reverberation on Bus1. We randomize the volume and the pitch of each Track slightly to make the sound effect less repetitive. The first Track is attenuated a bit by using the Biquad filter. We also have volume automation on the Track corresponding to the last stage of the combo which had a longer tail initially.
As for the combo sound design itself, here is how it will work in the game:
As soon as the player throws a punch, it will trigger the “Anime_Combo” Cue and the 1st Track called “Anime_Punch01” will play. Then, if a second attack happens within a 700ms time window, the game will re-trigger the “Anime_Combo” Cue and this time it will play the second Track called “Anime_Punch02”. The same applies to the 3rd combo move which will play the “Anime_Punch03” Track if triggered during another 700 ms time interval. Finally, if a 4th attack is unleashed in time, the Cue is going play the last track called “Anime_Punch04”. The Cue will then return to the 1st Track.
If at any point during this sequence no attack is triggered during the combo interval, the Cue will go back to the 1st Track. The timeline below summarizes both cases.
Here is how our combo sfx sounds in AtomCraft. In the video below, we first trigger the Cue and wait for a bit. The Combo mode is not engaged and the Cue goes back to play the first Track the next time. However, we then trigger the Cue 3 times in a row – each time within the combo interval period – so we can hear the full development of the combo sfx. Notice the green lights on the left of the Tracks that show which Track is actually playing:
Of course, you can build on that sample project and make the audio implementation a lot more intricate, for example by nesting other Cues in the “Anime_Combo” Cue. Each Track could then trigger a Random Cue to bring more variation, or a Switch Cue so that the sound would correspond to the type of attack move or to the body part being hit.
In the game
Without the equivalent of a Combo Sequential Cue in your game audio middleware, if you wanted to implement a sound effect for a combo, you would need to keep track of the different audio event handles (4 in this case), the time elapsed since the last player action and the current stage in the combo. Then, based on all this information, you would trigger the correct sound event.
But with ADX2, since all the logic is already done in the audio engine, there is no need to declare and update variables or to check time: all this is replaced by a single call to play a Cue as usual. It does not involve any extra work from the audio programmer.
It is equally easy when you are using ADX2 with a game middleware such as Unity (or Unreal), as there is no need for extra scripting (or C++ code). Simply select the right combo Cue in the component, and let ADX2 take care of the combo logic automatically each time you trigger it.
This concludes our post about Combo Sequential Cues. Let us know if you want to learn more about a specific ADX2 feature!