Doom Code Example

Code Example: Doom (2016) Weapons

In this project, I reverse engineered the weapons and most weapon mods from Doom (2016) and replicated their behavior in Unreal Engine 4.

This process took several weeks of coding in my free time and required the use of basic programming principles to create simple, highly reusable, and readable code.

The resulting codebase is presented here as an Unreal Engine 4 project for your perusal, as well as explanations in the form of YouTube videos above.

Since I released these videos, hundreds of people have asked me for information on how to create it, and so as of 2023 I am making the code publicly available hereunder!


  • Usage of weapons with or without mods
  • Proper weapon switching including empty weapon ignore (except when not ignored in DOOM)
  • Proper ammo type & amount usage both with or without mods
  • Autoshooting and going into mod mode automatically when LMB or RMB is still pressed when switching weapons as per in DOOM
  • Game instance retains all info for player and weapon / ammo states
  • Closely approximated damages, damage variation, recoils, trace variances…
  • Faked animations and simple UI for basic feedback for behaviour checking
  • Weapons may not have trace variance on the first shot when in auto mode as per in DOOM
  • Easily modified static data holds weapon variables instead of being hardcoded
  • Approximated movement to Doom Slayer
  • Very cheap event-based systems, only 2 tick events amongst all weapon / player classes
  • Damage unification for multiple damages within a short timespan (shotguns, etc)
  • Smooth functions transition between normal shooting and mod shooting
  • Proper usage of encapsulation, inheritance, polymorphism…