# How do gun noises work?

**URL:** <https://discourse.cataclysmdda.org/t/how-do-gun-noises-work/14709>\
**Category:** The Garage\
**Created:** [December 26, 2017, 10:30pm UTC](https://discourse.cataclysmdda.org/t/how-do-gun-noises-work/14709 "2017-12-26T22:30:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![DeWolf](https://avatars.discourse-cdn.com/v4/letter/d/df705f/32.png) [@DeWolf](https://discourse.cataclysmdda.org/u/DeWolf)\
**Post date:** [December 26, 2017, 10:30pm UTC](https://discourse.cataclysmdda.org/t/how-do-gun-noises-work/14709/1 "2017-12-26T22:30:40Z")

</div>

More specifically what determines that an ar-15 firing 223 is louder than the pneumatic assault rifle? I can see that the pneumatic assault rifle has a loudness stat of 5 and pebble has a loudness stat of 0 but those don’t exist in the example I provided so what determines the example I have given?

---

<div class="post-metadata">

**Author:** ![druidniam](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/druidniam/32/1368_2.png) [@druidniam](https://discourse.cataclysmdda.org/u/druidniam)\
**Post date:** [December 26, 2017, 10:39pm UTC](https://discourse.cataclysmdda.org/t/how-do-gun-noises-work/14709/2 "2017-12-26T22:39:09Z")

</div>

Muzzel Velocity + barrel length + propellant in a really vague nutshell. You’d have to look at bullet grain to reall get an idea of volume, but generally, the bigger the barrel diameter the louder the noise. Pneumatic weapons just have a slight hiss from the momentary release of stored compressed air. A bow should technically have a noise of 5 as well.

Edit: an exception to that rule: a 40mm grenade launcher is actually pretty quiet. The resulting explosion on the other hand…

---

<div class="post-metadata">

**Author:** ![pisskop](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/pisskop/32/1327_2.png) [@pisskop](https://discourse.cataclysmdda.org/u/pisskop)\
**Post date:** [December 26, 2017, 10:46pm UTC](https://discourse.cataclysmdda.org/t/how-do-gun-noises-work/14709/3 "2017-12-26T22:46:27Z")

</div>

bang bang  
i shot you down . . .  
bangbang  
all your friends  
came around . . .

seriously you use guns you prepare for wanderer hordes. shotties and revolvers (my favorite guns) especially.

---

<div class="post-metadata">

**Author:** ![DeWolf](https://avatars.discourse-cdn.com/v4/letter/d/df705f/32.png) [@DeWolf](https://discourse.cataclysmdda.org/u/DeWolf)\
**Post date:** [December 26, 2017, 10:57pm UTC](https://discourse.cataclysmdda.org/t/how-do-gun-noises-work/14709/4 "2017-12-26T22:57:26Z")

</div>

I guess I should have been more specific.  
What stats in game for both guns and ammo determine how much noise they make and in what formula?

---

<div class="post-metadata">

**Author:** ![druidniam](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/druidniam/32/1368_2.png) [@druidniam](https://discourse.cataclysmdda.org/u/druidniam)\
**Post date:** [December 26, 2017, 11:48pm UTC](https://discourse.cataclysmdda.org/t/how-do-gun-noises-work/14709/5 "2017-12-26T23:48:30Z")

</div>

To be honest, i think its hard coded somewhere. I could find “loudness” entries for only a fraction of weapons, an most guns don’t appear to make noise based on a lack of that tag in the json. This is definitly a question for @kevin.granade.

---

<div class="post-metadata">

**Author:** ![kevin.granade](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/kevin.granade/32/1316_2.png) [@kevin.granade](https://discourse.cataclysmdda.org/u/kevin.granade)\
**Post date:** [December 27, 2017, 6:20am UTC](https://discourse.cataclysmdda.org/t/how-do-gun-noises-work/14709/6 "2017-12-27T06:20:00Z")

</div>

Method that calculates gun noise:

> <https://github.com/CleverRaven/Cataclysm-DDA/blob/7ee93bc46d19f23a44f80fb948796ee702f7d5a7/src/ranged.cpp#L1477>

Here’s the code that handles ammo types (The primary source of loudness) when loudness isn’t specified:

> <https://github.com/CleverRaven/Cataclysm-DDA/blob/master/src/item_factory.cpp#L171>

Tl;Dr damage + pierce + range \* 2

---

<div class="post-metadata">

**Author:** ![DeWolf](https://avatars.discourse-cdn.com/v4/letter/d/df705f/32.png) [@DeWolf](https://discourse.cataclysmdda.org/u/DeWolf)\
**Post date:** [December 27, 2017, 7:00am UTC](https://discourse.cataclysmdda.org/t/how-do-gun-noises-work/14709/7 "2017-12-27T07:00:46Z")

</div>

Thank you sir. It looks like I will be forced to use the loudness stat for my purpose of making an as val or vinotrez.
