Doom Code Example
Weapon Base Code
Weapon Mod Code
This is a code example in which I reverse engineered all weapons and most weapon mods from Doom (2016), later replicating their behavior in Unreal Engine 4.
During this exercise, which took a few weeks of moonlighting, I used many basic programming principles to create simple, highly reusable and readable code in order to share the acquired knowledge easily.
I have written about some of the amazing combat design techniques used by id Software in a gamasutra article, and hereunder you can find the entire code base as an Unreal Engine 4 project for your perusal.
Please note that the code is behind a password; if you would like to request it, please email me at firstname.lastname@example.org. However, only eligible recruiters / industry experts will receive the code!
Gamasutra Article: Coming soon!
- 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…