ADX

Implementing a Laser Turret

In this post, we will implement the sound of a turret that fires a destructive laser beam. The sound effect will start with high-impact sounds for the initial energy burst, followed by the continuous sound of the beam. Once the laser beam is stopped in the game, whooshes will be played, adding a convincing tail to the audio of our laser turret.
To achieve this, we will mainly rely on Polyphonic Cues, an On Stop Action, and the Envelope Generator. You can hear the final result below.

 

For the asset creation, we recorded some synth patches for the laser beam, along with some impacts and sci-fi whooshes for the leading/ending parts of our sound. These were designed separately, knowing that they would be played by different Cues.

After importing our wave files as Materials in AtomCraft, we made sure to set the Override Loop Information option for the files corresponding to the beam sound, to ensure they loop correctly.

We created a Polyphonic Cue called laser_start, on which we dropped the three impactful sound effects that will play simultaneously when the laser turret is first fired. It is recommended that you adjust the volume of each track to your liking and add fade-outs for a smoother result.

We also created Polyphonic Cues for the body of the sound (laser_loop), and its tail (laser_end).

On the 3 tracks that compose the laser_loop Polyphonic Cue (i.e., the looping beam), we added a 1800 ms release in the Envelope Generator (EG). Therefore, the loops will continue to play while fading-out over a duration of 1800 ms after the Cue has been stopped.

In the Cue properties, we added an On Stop Action, set it to Play, and assigned the laser_end Cue. This means that each time the laser_loop Cue is stopped, it will trigger the laser_end Cue while the Envelope Generator fades it out.

It is time to bring all the pieces together. We create our main Polyphonic Cue called laser_main. This will be the Cue started and stopped from the game code. It will reference the laser_start and laser_loop Cues, the latest triggering the laser_stop Cue. We position the laser_loop Cue on the timeline with a short delay, in order to let the turret’s startup energy reach full power.

We now have our complete audio system for this laser turret. Since only the laser_main Cue should be visible from the game code, we can mark the other Cues as Private. Their IDs will not be exported and they will stay invisible to the programmers.