For the past week I have been looking for appropriate sounds to add to the rifle. I have been looking through websites such as Soundsnap and Gamebanana Day Of Defeat: Source for sounds to use for shooting, reloading and aiming.
I also had to record the sound files for the aiming and lowering the gun (currently called ‘Holster’ but this will be changed). I used the game Garrysmod to download some weapon packs to record the aiming and lowering gun sounds to edit on Audacity.
Matching sound to the animation
I then had to match the sound to the animations. I had to crop the sounds using Audacity to help fit with the animations, however I also had to make sure the sounds didn’t suddenly end, especially the shot sound effect. I solved this by making sure the sounds faded out gradually to prevent a sudden lack of sound once the sound file finishes.
The biggest problem I faced was matching the sound for the reload sequence. I first wanted to try adding Animation Events for each reload segment however I felt by just creating variables for each sound clip and playing them once in code works just as well.
Animation problem between shooting and reloading
I also ran into a problem where shooting and trying to reload would cause the animation for reloading to wait until the shooting animation finishes. Without sound this wasn’t a big problem, however with sound the sound ended up being out of sync with the animation. I attempted to lock it so players cannot reload until the animation finishes by using animator state info. However I was facing problems of either the animation for reloading not working or the trigger wouldn’t activate.
As a temporary solution I’ve allowed the animation for shooting to run into reloading if the player presses the reload key (as shown below).
The rifle is almost complete. I want to add a particle effect to when the player shoots the rifle and I also need to fix a bug with the gun being able to shoot while reloading if the gun is loaded. I also want to look into adding recoil to the rifle which moves the camera slightly.
GAMEBANANA, (2017). Sounds (Day of Defeat: Source) – GAMEBANANA. [online] GAMEBANANA. Available at: http://gamebanana.com/sounds/games/10 [Accessed 14 Feb. 2017].
Newman, G. (2017). Free Garry’s Mod addons and downloads | garrysmods.org. [online] Garry’s Mod Downloads | garrysmods.org. Available at: https://garrysmods.org/ [Accessed 14 Feb. 2017].
Soundsnap. (2017). 30 06 caliber Springfield model 1903 sounds (5). [online] Available at: https://www.soundsnap.com/tags/30_06_caliber_springfield_model_1903 [Accessed 14 Feb. 2017].