Diving Into Chaos: Duke Nukem's Code Shouldn't Work (but it does?)

Tariq10x June 27, 2025
Video Thumbnail

About

Software Architect / Software Lead with experience in embedded systems and industries like aerospace, medical, and automotive. I’ve worked for companies in the USA and Europe, leading teams from around the world. Author of a peer-reviewed paper on optimization algorithms in physical optics. On this channel, I share coding insights, software engineering experiences, and the occasional dose of sarcasm. I am solely writing, recording and editing all these videos while also working full time. So, enjoy some genuine human insights! (c) Tariq10x 2024 Please don’t reupload or archive my videos without permission. Reaction videos and other transformative content are absolutely welcome! If you're interested in licensing a video for commercial purposes, feel free to reach out via email. For business and sponsor inquiries use my channel email. Try out Scrimba and get 20% OFF the Pro plans with my link: https://scrimba.com/?via=Tariq10x Thanks for supporting the channel and keeping it fun!

Video Description

This video was sponsored by Brilliant. To try everything Brilliant has to offer—free—for a full 30 days, visit https://brilliant.org/Tariq10x/ . You’ll also get 20% off an annual premium subscription. In this video, I’m taking you deep inside the Duke Nukem 3D source code—a wild mix of brilliant hacks, questionable practices, and pure 90s ingenuity. You’ll see exactly how this code shouldn’t work…but somehow powered one of the most iconic shooters of all time. About Duke Nukem 3D: Released in 1996 by 3D Realms, Duke Nukem 3D became famous for its over-the-top humor, fast-paced action, and highly interactive environments. Built on the Build Engine, created by 17-year-old programming prodigy Ken Silverman, the game pushed the limits of PC hardware and set new standards for first-person shooters. What You’ll See in This Analysis: The insane use of global variables and monolithic code structures How a “shouldn’t work” codebase ended up dominating gaming history Why Duke Nukem 3D still inspires developers today If you enjoy seeing how classic games were really built, make sure to subscribe, like, and drop a comment telling me what game source code you’d like to see next! Help me get better equipment: https://www.patreon.com/tariq10x/ https://x.com/realtariq10x My Equipment: Keyboard: https://amzn.to/4nnCw6V Drawing Tablet: https://amzn.to/3FY1BEM Microphone: https://amzn.to/4emo9vn Sources: id as Super-Ego: The Creation of Duke Nukem 3D: https://fabiensanglard.net/duke3d/id%20as%20Super-Ego-%20The%20Creation%20of%20Duke%20Nukem%203D.pdf Fabien Sanglard's Blog: https://fabiensanglard.net/duke3d/ Duke Nukem3D source code: https://github.com/videogamepreservation/dukenukem3d If you like the content hit subscribe to support the channel. 00:00 Duke Nukem 3D 02:26 Software Architecture 08:23 Genius Chaos 18:14 Rendering Basics 19:37 Main Loop 22:16 Rendering Detailed 24:50 Ray Crossing Method 25:59 Point Inside? 28:58 Inside Function Breakdown 34:18 Draw Rooms 39:00 Occlusion Arrays 41:42 Game Module Source Code 44:21 Build Info TXT 48:55 Conclusion Song Credits: ------------------------------------------------------------------------------------------------------------------- All songs Licensed under Creative Commons: By Attribution 4.0 License ------------------------------------------------------------------------------------------------------------------- "Rising Tide" Kevin MacLeod (incompetech.com) "Intuit 256" Kevin MacLeod (incompetech.com) "Hard Boiled" Kevin MacLeod (incompetech.com) "Dispersion Relation" Kevin MacLeod (incompetech.com) "Spy Glass" Kevin MacLeod (incompetech.com) "Mesmerizing Galaxy Loop" Kevin MacLeod (incompetech.com) "Lightless Dawn" Kevin MacLeod (incompetech.com)

You May Also Like

Revive Gaming: Essential Picks

AI-recommended products based on this video

Loading...
Retro Game Console, Wireless Retro Game Console, Plug & Play Video TV Game with 24500+ Built-in Games, 4K HD Output, and 2.4GHz Wireless Controller, 9 Classic Emulators(Black)
Best Seller

Retro Game Console, Wireless Retro Game Console, Plug & Play Video TV Game with 24500+ Built-in Games, 4K HD Output, and 2.4GHz Wireless Controller, 9 Classic Emulators(Black)

(19)
$59.99
FREE delivery Mon, Jul 7
Loading...
eXtremeRate ABXY Buttons for Xbox Core Wireless Controller, Two-Tone Carmine Green & Clear Classic Symbols Action Buttons Replacement Prats for Xbox One S/X, Elite Series 2 Core & 1 Controller

eXtremeRate ABXY Buttons for Xbox Core Wireless Controller, Two-Tone Carmine Green & Clear Classic Symbols Action Buttons Replacement Prats for Xbox One S/X, Elite Series 2 Core & 1 Controller

(7)
$13.99
FREE delivery Sun, Aug 24 on your first order
Loading...
eXtremeRate ABXY Buttons for Xbox Series X & S Controller, Three-Tone Black & Clear with Carmine Red Classic Symbols Replacement Action Buttons for Xbox One S/X, Elite Series 2 & 1 Wireless Controller

eXtremeRate ABXY Buttons for Xbox Series X & S Controller, Three-Tone Black & Clear with Carmine Red Classic Symbols Replacement Action Buttons for Xbox One S/X, Elite Series 2 & 1 Wireless Controller

(127)
$13.99
FREE delivery Sun, Aug 24 on your first order
Loading...
Retro Game Console, Wireless Retro Game Console, Plug & Play Video TV Game with 24500+ Built-in Games, 4K HD Output, and 2.4GHz Wireless Controller, 9 Classic Emulators(Black)
Best Seller

Retro Game Console, Wireless Retro Game Console, Plug & Play Video TV Game with 24500+ Built-in Games, 4K HD Output, and 2.4GHz Wireless Controller, 9 Classic Emulators(Black)

(19)
$59.99
FREE delivery Mon, Jul 7
Loading...
Retro Game Console, Wireless Retro Game Console, 24500+ Games Built-in, 4K HDMI Output, 9 Emulators, Dual 2.4GHz Wireless Game, Plug and Play Video Games, Deep Black(64G)
Best Seller

Retro Game Console, Wireless Retro Game Console, 24500+ Games Built-in, 4K HDMI Output, 9 Emulators, Dual 2.4GHz Wireless Game, Plug and Play Video Games, Deep Black(64G)

(11)
$49.59
FREE delivery Wed, Jul 2
50+ bought in past month
Loading...
Retro Game Console, Wireless Retro Game Console, 24500+ Games Built-in, 4K HDMI Output, 9 Emulators, Dual 2.4GHz Wireless Game, Plug and Play Video Games, Black(64G)

Retro Game Console, Wireless Retro Game Console, 24500+ Games Built-in, 4K HDMI Output, 9 Emulators, Dual 2.4GHz Wireless Game, Plug and Play Video Games, Black(64G)

(36)
$39.59
PrimeFREE delivery Sat, Jun 14
300+ bought in past month
Loading...
Retro Game Console, Wireless Retro Game Console, Plug & Play Video TV Game with 24500+ Built-in Games, 4K HD Output, and 2.4GHz Wireless Controller, 9 Classic Emulators(Black)
Best Seller

Retro Game Console, Wireless Retro Game Console, Plug & Play Video TV Game with 24500+ Built-in Games, 4K HD Output, and 2.4GHz Wireless Controller, 9 Classic Emulators(Black)

(19)
$59.99
FREE delivery Mon, Jul 7
Loading...
Retro Game Console, Wireless Retro Game Console, 24500+ Games Built-in, 4K HDMI Output, 9 Emulators, Dual 2.4GHz Wireless Game, Plug and Play Video Games, Deep Black(64G)
Best Seller

Retro Game Console, Wireless Retro Game Console, 24500+ Games Built-in, 4K HDMI Output, 9 Emulators, Dual 2.4GHz Wireless Game, Plug and Play Video Games, Deep Black(64G)

(11)
$49.59
FREE delivery Wed, Jul 2
50+ bought in past month
Loading...
Retro Game Console, Wireless Retro Game Console, 24500+ Games Built-in, 4K HDMI Output, 9 Emulators, Dual 2.4GHz Wireless Game, Plug and Play Video Games, Black(64G)

Retro Game Console, Wireless Retro Game Console, 24500+ Games Built-in, 4K HDMI Output, 9 Emulators, Dual 2.4GHz Wireless Game, Plug and Play Video Games, Black(64G)

(36)
$39.59
PrimeFREE delivery Sat, Jun 14
300+ bought in past month
Loading...
eXtremeRate EDGE Sticks Interchangeable Thumbsticks for Xbox Core Controller, Carmine Red Swappable Analog Stick Joystick for Xbox One S/X, Xbox Elite V1 Controller, for Nintendo Switch Pro Controller

eXtremeRate EDGE Sticks Interchangeable Thumbsticks for Xbox Core Controller, Carmine Red Swappable Analog Stick Joystick for Xbox One S/X, Xbox Elite V1 Controller, for Nintendo Switch Pro Controller

(23)
$23.99
FREE delivery Tue, Aug 26 on your first order
Loading...
eXtremeRate ThumbsGear V3 Interchangeable Thumbsticks for Xbox Core Controller, 4 Height Adjustable Convex and Concave Grip Joysticks for Xbox One S/X/Elite, for Nintendo Switch Pro Controller - Black

eXtremeRate ThumbsGear V3 Interchangeable Thumbsticks for Xbox Core Controller, 4 Height Adjustable Convex and Concave Grip Joysticks for Xbox One S/X/Elite, for Nintendo Switch Pro Controller - Black

(31)
$20.99
FREE delivery Sun, Aug 24 on your first order
Loading...
STARTRC GAMES Hard Carrying Case for Nintendo Switch 2, Professional Deluxe IP67 Waterproof, Soft Lining Hard Travel Case for Nintendo Switch 2 Console Pro Controller & Accessories (Black)

STARTRC GAMES Hard Carrying Case for Nintendo Switch 2, Professional Deluxe IP67 Waterproof, Soft Lining Hard Travel Case for Nintendo Switch 2 Console Pro Controller & Accessories (Black)

(2)
$65.99
PrimeFREE delivery Sun, Jun 15
Loading...
Deruitu Carrying Case for Nintendo Switch/OLED Model Case, Portable Travel Protective Hard Messenger Bag Soft Lining 18 Games for Switch Console Pro Controller & Accessories Black

Deruitu Carrying Case for Nintendo Switch/OLED Model Case, Portable Travel Protective Hard Messenger Bag Soft Lining 18 Games for Switch Console Pro Controller & Accessories Black

(1,637)
$27.99
FREE delivery Sun, Jun 15 on your first order
Loading...
8BitDo Ultimate C Wired Controller for Xbox with RGB Lighting Fire Ring, Hall Effect Triggers and Joysticks, Compatible with Xbox Series X|S, Xbox One, Windows 10/11 - Officially Licensed (Dark Gray)

8BitDo Ultimate C Wired Controller for Xbox with RGB Lighting Fire Ring, Hall Effect Triggers and Joysticks, Compatible with Xbox Series X|S, Xbox One, Windows 10/11 - Officially Licensed (Dark Gray)

(888)
$49.99
PrimeFREE delivery Sat, Jun 14
Loading...
8Bitdo Wireless USB Adapter 2 for Switch, Windows, Mac & Steam Deck - Compatible With Xbox Series X & S, Xbox One Bluetooth, Switch Pro and PS5 Controllers (Black)

8Bitdo Wireless USB Adapter 2 for Switch, Windows, Mac & Steam Deck - Compatible With Xbox Series X & S, Xbox One Bluetooth, Switch Pro and PS5 Controllers (Black)

(5,446)
$26.99
FREE delivery Sat, Jun 14 on your first order
200+ bought in past month
Loading...
8BitDo Charging Dock for Xbox Wireless Controllers, Xbox Charging Station with Magnetic Secure Charging for Xbox Series X|S and Xbox One Controller - Officially Licensed (Black)

8BitDo Charging Dock for Xbox Wireless Controllers, Xbox Charging Station with Magnetic Secure Charging for Xbox Series X|S and Xbox One Controller - Officially Licensed (Black)

(281)
$34.99
FREE delivery Sat, Jun 14 on your first order
Loading...
Retro Game Console, Wireless Retro Game Console, Plug & Play Video TV Game with 24500+ Built-in Games, 4K HD Output, and 2.4GHz Wireless Controller, 9 Classic Emulators(Black)
Best Seller

Retro Game Console, Wireless Retro Game Console, Plug & Play Video TV Game with 24500+ Built-in Games, 4K HD Output, and 2.4GHz Wireless Controller, 9 Classic Emulators(Black)

(19)
$59.99
FREE delivery Mon, Jul 7
Loading...
Retro Game Console, Wireless Retro Game Console, 24500+ Games Built-in, 4K HDMI Output, 9 Emulators, Dual 2.4GHz Wireless Game, Plug and Play Video Games, Deep Black(64G)
Best Seller

Retro Game Console, Wireless Retro Game Console, 24500+ Games Built-in, 4K HDMI Output, 9 Emulators, Dual 2.4GHz Wireless Game, Plug and Play Video Games, Deep Black(64G)

(11)
$49.59
FREE delivery Wed, Jul 2
50+ bought in past month
Loading...
Retro Game Console, Wireless Retro Game Console, 24500+ Games Built-in, 4K HDMI Output, 9 Emulators, Dual 2.4GHz Wireless Game, Plug and Play Video Games, Black(64G)

Retro Game Console, Wireless Retro Game Console, 24500+ Games Built-in, 4K HDMI Output, 9 Emulators, Dual 2.4GHz Wireless Game, Plug and Play Video Games, Black(64G)

(36)
$39.59
PrimeFREE delivery Sat, Jun 14
300+ bought in past month
Loading...
Retro Game Console, Wireless Retro Game Console, Plug & Play Video TV Game with 24500+ Built-in Games, 4K HD Output, and 2.4GHz Wireless Controller, 9 Classic Emulators(Black)
Best Seller

Retro Game Console, Wireless Retro Game Console, Plug & Play Video TV Game with 24500+ Built-in Games, 4K HD Output, and 2.4GHz Wireless Controller, 9 Classic Emulators(Black)

(19)
$59.99
FREE delivery Mon, Jul 7
Loading...
Retro Game Console, Wireless Retro Game Console, 24500+ Games Built-in, 4K HDMI Output, 9 Emulators, Dual 2.4GHz Wireless Game, Plug and Play Video Games, Deep Black(64G)
Best Seller

Retro Game Console, Wireless Retro Game Console, 24500+ Games Built-in, 4K HDMI Output, 9 Emulators, Dual 2.4GHz Wireless Game, Plug and Play Video Games, Deep Black(64G)

(11)
$49.59
FREE delivery Wed, Jul 2
50+ bought in past month
Loading...
Retro Game Console, Wireless Retro Game Console, 24500+ Games Built-in, 4K HDMI Output, 9 Emulators, Dual 2.4GHz Wireless Game, Plug and Play Video Games, Black(64G)

Retro Game Console, Wireless Retro Game Console, 24500+ Games Built-in, 4K HDMI Output, 9 Emulators, Dual 2.4GHz Wireless Game, Plug and Play Video Games, Black(64G)

(36)
$39.59
PrimeFREE delivery Sat, Jun 14
300+ bought in past month
Loading...
Fingic for Samsung Galaxy S25 Case Wallet for Women Girl[with 9 Card Holder]Marble Rose Gold PU Leather Detachable Wrist Strap Fullbody Slim Shockproof Flip Phone Case for Samsung Galaxy S25,6.2”,2025

Fingic for Samsung Galaxy S25 Case Wallet for Women Girl[with 9 Card Holder]Marble Rose Gold PU Leather Detachable Wrist Strap Fullbody Slim Shockproof Flip Phone Case for Samsung Galaxy S25,6.2”,2025

(9)
$18.99
FREE delivery Sat, Jun 14 on your first order