Devlog 10


Sound System

Once all the gameplay was complete—rotation, raycast shooting, and damage handling—I moved on to feedback through sound implementation. A critical component of weapons having a strong, responsive feel is audio cues being meaningful and synced across all participants in a multiplayer game. I added a full audio system within the TurretController script to support both primary (rifle) and secondary (rocket) firing modes.

To maintain a clean and dynamic setup, I utilized Unity's Resources.Load() to load audio clips at runtime:

This method ensured that the sound system remained scalable and flexible and avoided hard references so that future replacement or expansion of the sounds would not require directly modifying the script. Audio files exist in a neatly structured folder at Assets/Resources/Audio/Weapons.

Rifle Shooting

When the player left-clicks to fire, the server does the raycast and damage and then calls a ClientRPC to play sound and VFX locally on all clients:

Rocket Launcher

Right click fires a powerful secondary fire: the rocket. Only fires if rocketReady is true, then enters cooldown controlled by RocketReloadCoroutine().

Rocket firing sound:

  1. Launch sound on all clients (RocketLaunchSoundClientRpc()).
  2. Explosion VFX and hit impact logic based on the position of the raycast hit (RocketExplosionClientRpc()). 

The explosion plays just once using an explosionPlayed flag to prevent spam or duplication due to repeated network events.


I created a small utility class called ExplosionSoundHelper. Its sole function is to load and play the explosion sound effect at runtime when needed without hard-coding it into gameplay scripts like TurretController. This was especially necessary as a number of systems rockets could potentially lead to explosions. Placing audio logic in every script would be inconvenient and hard to support. Instead, I followed the single-responsibility principle and made a static helper.