Cite as
3D Realms, duke3dsource.zip
Original
https://github.com/commercial-game-sources/duke_nukem_3d
Pinned
commercial-game-sources/duke_nukem_3d @ e75bb067c0d3eba8f716b7781a5c5b6ec93cc2d4
Accessed
2026-10-22
Licence
Game code: GPL-2.0 or later. README.TXT says “The code is licensed under the terms of the GPL (gnu public license)”, GNU.TXT is the GNU General Public License, version 2, and each source file's header (and the CON scripts' in testdata/) says “either version 2 of the License, or (at your option) any later version”. README.TXT keeps the game's data files under 3D Realms' original terms. Build engine: the release links Ken Silverman's engine as object files (source/ENGINE.OBJ and others) and ships its source in BuildEngine.zip, whose files say “See the included license file "BUILDLIC.TXT" for license info”. BUILDLIC.TXT is not in 3D Realms' archive; the copy in Ken Silverman's KENBUILD.ZIP (advsys.net/ken/buildsrc, dated 06/20/2000) permits modifying and distributing the source, but derivative works “may be distributed ONLY through the INTERNET”, “completely FREE of charge - no commercial exploitation whatsoever”, with his copyright notice and the license file. It doesn't address quoting. The atlas quotes only the GPL game code and CON scripts; no Build engine source code is quoted.
Credit
3D Realms released the source on 2003-04-01; README.TXT thanks Charlie Wiederhold for preparing it, and Ken Silverman (the Build engine) and Jim Dosé (the audio library) for letting their code be included. Mirrored on GitHub unchanged by the commercial-game-sources project (2022).
Notes
The canonical copy is 3D Realms' own archive, ftp://ftp.3drealms.com/source/duke3dsource.zip, linked from legacy.3drealms.com/downloads.html (“Source code to Atomic Edition of Duke Nukem 3D”). The Wayback Machine captured it on 2015-11-30 (https://web.archive.org/web/20151130230650id_/ftp://ftp.3drealms.com/source/duke3dsource.zip; 4,017,201 bytes, sha256 09ab111d4e2dc641f93cdf445a0014ee011ae6d06e8c1cdb6cccc8e7e69a7038). Its unpacked files match this mirror's byte for byte apart from line endings (the archive has CRLF, the mirror LF; line numbers agree), and the mirror adds only README.md; compared 2026-10-22 from a download of that Wayback capture, which the cache doesn't keep, so the comparison can't be redone from the cache alone. Claims cite the mirror because the gate re-reads code at pinned lines in a repo. README.TXT calls it “Duke Nukem 3D (v1.5 CD Version)”, and the CON headers say “Duke Nukem 3D version 1.5 - Atomic Edition”. testdata/ holds the 1.5 CON scripts (GAME.CON, USER.CON, DEFS.CON), which set weapon strengths and other constants the C code reads. `paths` leaves out the zips, the extras folder, and the object files.

Cited on

Claims (13)

The Duke Nukem 3D source 3D Realms released on 2003-04-01 is version 1.5, the Atomic Edition: README.TXT calls it the "v1.5 CD Version" and "the complete source code for Duke Nukem 3D version 1.5", and the CON scripts in testdata/ call themselves part of "Duke Nukem 3D version 1.5 - Atomic Edition".README.TXT L2README.TXT L11testdata/USER.CON L5Code
Duke Nukem 3D schedules its timer with TS_ScheduleTask at a rate of TICRATE, 120, which the atlas reads as counts per second (the task manager's source isn't in the release), and faketimerhandler reads the player's input and queues one move every TICSPERFRAME counts, TICRATE/26, which integer division makes 4; domovethings runs once per queued move, so on that reading the game runs 30 tics a second (computed), where Doom runs 35.source/DUKE3D.H L92–93source/GAME.C L106–114source/TASK_MAN.H L56source/GAME.C L643–652source/GAME.C L659–673source/GAME.C L7973–7978Code
Duke Nukem 3D's pistol, shotgun, and chaingun are hitscan: shoot traces each shot with the Build engine's hitscan within the same call and spawns a SHOTSPARK1 sprite at the point hit, which carries the damage; the RPG instead spawns a rocket sprite with a velocity of 644. Doom's guns likewise trace a line with P_LineAttack in the tic they fire.source/PLAYER.C L481–483source/PLAYER.C L546–560source/PLAYER.C L796–801source/PLAYER.C L843–846source/GAME.C L2994source/GAME.C L3021Code
Each shot a Duke Nukem 3D player fires from the pistol, shotgun, or chaingun carries the strength its actor declares in the CON script plus TRAND%6 (0 to 5): 6 to 11 for the pistol (SHOTSPARK1), 10 to 15 for each of the shotgun's 7 pellets, and 9 to 14 for the chaingun; a monster's shot carries the strength alone. Each bullet from Doom's pistol, chaingun, or shotgun deals 5, 10, or 15.source/PLAYER.C L557–561source/PLAYER.C L674–675source/GAMEDEF.C L849–881testdata/GAME.CON L3165–3166testdata/GAME.CON L3200testdata/USER.CON L148testdata/USER.CON L163–164source/PLAYER.C L3647–3650source/PLAYER.C L3690–3702source/PLAYER.C L3759Code
A Duke Nukem 3D sprite's pending damage (hittype[].extra) is set to −1 when the sprite is created and again each time ifhitbyweapon takes it; a shot that checkhitsprite handles in its default branch adds its damage to the pending total, and ifhitbyweapon subtracts the total from the target's health, so a target hit once between checks loses 1 less than the shot carries, and several hits between checks take 1 less than their sum (computed). An explosion's hitradius sets the pending damage outright for the targets it rolls for, so those lose the full roll.source/GAME.C L3038source/GAME.C L3143source/SECTOR.C L2329–2335source/ACTORS.C L994–1018source/ACTORS.C L1063–1073source/ACTORS.C L538–541Code
A Duke Nukem 3D player's shotgun and chaingun turn every shot by 16-(TRAND&31), −15 to +16 of the 2,048 angle units in a turn (up to about 2.8°, computed), and add 128-(TRAND&255) to its vertical speed, with or without an autoaim target; the pistol does both only when autoaim found none, so a pistol shot at an autoaim target flies straight to it. Doom's shotgun turns each of its 7 pellets by up to about 5.6°.source/PLAYER.C L489source/PLAYER.C L511–525source/PLAYER.C L546–548Code
When a Duke Nukem 3D player fires the pistol, shotgun, or chaingun, aim looks for a target within AUTO_AIM_ANGLE, 48 of 2,048 angle units (about 8.4°, computed), to either side of the facing; of those in sight, more than 512 along the facing, and with a height difference over that distance (scaled by 10) within 100 of the view's pitch, it takes the nearest along the facing, searching the sprite lists 10, 13, 1, and 2 in that order and stopping at the first list with a match, and skipping fellow players in co-op. The shot then turns to the target's angle (getangle) and takes the slope to a point ((xrepeat × tile height) << 1) + (5 << 8) above the target's z. Doom's P_BulletSlope traces only straight ahead and 5.625° to each side, and its bullet keeps the player's facing.source/DUKE3D.H L62source/PLAYER.C L204–227source/PLAYER.C L230–246source/PLAYER.C L273–291source/PLAYER.C L489–508Code
A Duke Nukem 3D keyboard sets the forward and side moves to 40 walking or 80 running (NORMALKEYMOVE), each clamped apart to ±90 (MAXVEL, MAXSVEL); getinput turns the pair by the facing, and each tic processinput adds it to the player's velocity times TICSPERFRAME (4) and 64, doubled while steroids last and the jetpack is off, in the air as on the ground. A hard landing and a few other actions zero the velocity instead. Doom thrusts only on the floor, with moves of 25 or 50 forward and 24 or 40 sideways.source/PLAYER.C L1771–1773source/PLAYER.C L1913–1923source/PLAYER.C L1974–1983source/PLAYER.C L2004–2014source/PLAYER.C L2603source/PLAYER.C L3002–3013source/PLAYER.C L3117source/PLAYER.C L3156–3160Code
After the thrust, Duke Nukem 3D multiplies the player's velocity each tic by dukefriction, which the CON's gamestartup sets from RUNNINGSPEED, 53,200 of 65,536 (0.812; the C default is 0xcc00, 0.797): 0x2000 less when kicking or crouching on the ground, 0x1400 less underwater, and three quarters of it again while shrunk; the velocity drops to 0 once both axes are under 2,048. A steady run moves 4.31 times the per-tic thrust (0.812 / 0.188, computed), and a released run falls under half its speed within 4 tics (computed). Doom keeps 0.90625 of its momentum each tic.source/GLOBAL.C L156testdata/USER.CON L112testdata/USER.CON L134–136source/GAMEDEF.C L105source/GAMEDEF.C L1328–1354source/PLAYER.C L1833source/PLAYER.C L3162–3190source/PLAYER.C L3193–3205Code
Duke Nukem 3D clamps the forward and side moves apart and adds them as perpendicular pushes, so running forward (80) while running sideways (80) gives √2 ≈ 1.41 times the forward run alone (computed); holding the strafe modifier with a turn key and a strafe key together reaches the side move's cap of 90, about 1.51 times. Doom's diagonal run, 50 forward and 40 sideways, is 1.28 times its forward run.source/PLAYER.C L1925–1934source/PLAYER.C L1965–1983source/PLAYER.C L2004–2008Code
A Duke Nukem 3D pipe bomb that goes off passes its strength, 140 (HANDBOMB_WEAPON_STRENGTH), to hitradius with the radius PIPEBOMBRADIUS, 2,500; each sprite in lists 1, 6, 10, or 12 (not flammable) with extra of 0 or more that is a tripbomb, a monster (badguy), a QUEBALL, a STRIPEBALL, a DUKELYINGDEAD, or solid (cstat&257), within that dist and in sight of the blast, takes 105 to 139 inside a third of the radius, 70 to 104 inside two thirds, and 35 to 69 beyond: three quarters, a half, or a quarter of the strength plus TRAND modulo the next band's gap, 35 (computed). A monster in sprite list 2, which the hit wakes into list 1, goes through checkhitsprite instead unless a sight test at a random height fails, and loses 139 at any distance in the radius, the bomb's 140 added to its pending −1; a bomb set off by a hit first loses that hit's damage from its strength. A Doom rocket's blast falls off linearly, 128 minus the distance.testdata/USER.CON L127testdata/USER.CON L149testdata/GAME.CON L3168source/GAMEDEF.C L1358source/GAME.C L3048–3050source/ACTORS.C L3988–3998source/ACTORS.C L4076–4093source/ACTORS.C L486–506source/ACTORS.C L433source/ACTORS.C L519–523source/ACTORS.C L536–552source/SECTOR.C L2282–2335Code
Perfect Dark's standard autoaim, for a gun whose autoaim is on, scores each character on screen and takes the highest score. It skips teammates, the dead and dying, and anyone not holding a gun (unless flagged CHRCFLAG_FORCEAUTOAIM). A candidate needs a clear line from the player, its screen center in the middle half of the screen's width, and its height reaching into the band from 17.5% to 82.5% of the screen's height; the screen's center must lie within 1.5 of its screen widths of its middle, times a solo scale (perfect-dark/autoaim-scale). The score is 1 when the screen's center x lies between the target's left and right screen edges, and otherwise falls off with the gap over that margin. The walk runs from the end of a list props_sort orders by prop->z, largest first, which the decompilers' comment calls "furthest first"; since a score of 1 ends the walk, the nearest such target wins on that reading. Doom traces ahead and 5.625° to each side for a target, and Duke Nukem 3D's aim takes the target within 8.4° of the facing that is nearest along it.source/DUKE3D.H L62source/PLAYER.C L273–291Code
Perfect Dark's autoaim moves the crosshair, not the view: once a target is picked, bmove_update_autoaim_x_prop and _y_prop set the aim point to the target's screen center (clamped to the window), and a new target replaces the old only after a 30/60 s hold; bgun_swivel then eases the crosshair toward the point, keeping a fraction crossdamp of the gap each 1/240 s (a unit the decompilers' comments give). On NTSC that fraction, autoaimdamp, falls by 0.00032 a 60th of a second while autoaim holds a target, from at most 0.979 (it climbs back there while none is held) to 0.963, so the pull strengthens over up to 50/60 s (computed); at 0.963 the crosshair closes 14% of the gap each 60th of a second (1 − 0.963⁴, computed). The shot leaves through the crosshair's position plus a random spread. Doom's bullet keeps the player's facing and takes only a vertical slope, and Duke Nukem 3D turns the shot itself to the target's angle in the call that fires it.source/PLAYER.C L489–508Code