Cite as
id-Software/DOOM
Original
https://github.com/id-Software/DOOM
Pinned
id-Software/DOOM @ a77dfb96cb91780ca334d0d4cfd86957558007e0
Accessed
2026-10-21
Licence
GPL-2.0 (LICENSE.TXT is the GNU General Public License, version 2; README.TXT ends “Copyright (c) ZeniMax Media Inc. Licensed under the GNU General Public License 2.0.”). The source files' own headers still name the earlier “DOOM Source Code License as published by id Software”.
Credit
id Software's source for DOOM, released by John Carmack on 1997-12-23 (his README.TXT is signed “John Carmack 12-23-97”). The README thanks Bernd Kreimeier for cleaning up the project for release.
Notes
The pinned commit (“Add GPL information”) adds the license notice; the 1999 relicensing date is not in the repo. The game code is linuxdoom-1.10/, which `doomdef.h` numbers as version 110, and README.TXT says “this code only compiles and runs on linux. We couldn't release the dos code because of a copyrighted sound library we used”. The repo holds code only (no WAD data), so no `paths` are needed. Claims read the Linux 1.10 code, not the DOS 1.9 executable; behavior is assumed shared only where a claim says so.

Cited on

Claims (49)

In Descent 3's released source, which includes the unreleased "1.5" patch, the player ship's thrust is the sum of a forward, an up, and a sideways push along the ship's own axes, each the control's value times full_thrust, the whole scaled by the player's movement_scalar and by 1.3 outdoors; the physics then moves a thrusting object against a drag proportional to velocity, solved in closed form over the frame: v = (v₀ − F/d)·e^(−(d/m)·t) + F/d. Computed from that formula, drag acts while the ship thrusts too, and speed levels off at F/d, as in Doom, whose floor friction multiplies momentum by 0.90625 each tic thrust or not; Quake's ground acceleration instead stops at the wish speed.linuxdoom-1.10/p_mobj.c L238–239linuxdoom-1.10/p_mobj.c L112Code
Descent 3's input code clamps the forward, up, and sideways thrust controls to ±1 each, separately, and the released source adds the three pushes along the ship's perpendicular axes, so all three held at once push √3 ≈ 1.73 times as hard as forward alone, and, computed from the linear drag, the ship settles at 1.73 times the speed; Doom does the same with two axes, clamping its forward and side moves apart and thrusting them at 90°.linuxdoom-1.10/p_user.c L160–164linuxdoom-1.10/g_game.c L413–420Code
In the Linux 1.10 source, a Doom demo starts with a 13-byte header: the version (110), skill, episode, map, the deathmatch, respawn, fast, and no-monsters options, the recording player's number, and one in-game flag for each of the 4 players. Then, for every tic and every player in the game, come 4 bytes: forward move, side move, the high byte of the turn, and the buttons. A byte of 0x80 ends it. A one-player demo takes 140 bytes a second at 35 tics a second (computed).linuxdoom-1.10/g_game.c L1549–1567linuxdoom-1.10/g_game.c L1488–1513linuxdoom-1.10/g_game.c L660–669linuxdoom-1.10/g_game.c L1677–1680linuxdoom-1.10/doomdef.h L33linuxdoom-1.10/doomdef.h L119–122Code
Playback goes through the same path as play. Each tic, G_Ticker copies every player's command (ticcmd_t) from the network buffer, then, during a demo, overwrites its move, turn, and buttons from the demo; the player code then acts on that command as on a live one.linuxdoom-1.10/g_game.c L654–667linuxdoom-1.10/g_game.c L1491–1503Code
A demo keeps only the turn's high byte, rounded, so a recorded turn moves in steps of 1/256 of a full circle, about 1.4 degrees (computed). While recording, the game writes the command and reads it straight back ("make SURE it is exactly the same"), so the recording player also plays with the rounded turn and the recording matches what the player saw.linuxdoom-1.10/g_game.c L1506–1522linuxdoom-1.10/g_game.c L1501linuxdoom-1.10/d_ticcmd.h L40linuxdoom-1.10/tables.h L69Code
Playing a demo restores the recorded skill, episode, map, and options from its header and starts the level through G_InitNew, which resets both random indices to 0, as a recording started from the command line also does. A demo whose version byte isn't 110 is refused with "Demo is from a different game version!".linuxdoom-1.10/g_game.c L1586–1615linuxdoom-1.10/g_game.c L1414linuxdoom-1.10/m_random.c L69–72linuxdoom-1.10/d_main.c L1127–1132linuxdoom-1.10/d_main.c L1161–1164Code
Playback ends at the 0x80 byte. A demo given with -playdemo then quits the game, and one given with -timedemo reports the tics and the real time taken. Otherwise the attract loop moves on: the title picture, demo1, the credits, demo2, a third page, demo3, and, in the retail Ultimate Doom only, demo4. During an attract demo, a key press that the menu doesn't take first, or a mouse or joystick button, opens the menu, and the demo keeps running behind it.linuxdoom-1.10/g_game.c L1493–1497linuxdoom-1.10/g_game.c L1651–1674linuxdoom-1.10/d_main.c L1135–1146linuxdoom-1.10/d_main.c L462–518linuxdoom-1.10/g_game.c L520–530linuxdoom-1.10/d_main.c L173–175linuxdoom-1.10/p_tick.c L138–144Code
Recording (-record) ends when the player presses Q, when the buffer, 128 KiB unless -maxdemo sets another size in KiB, is within 16 bytes of full, when a player leaves a net game, or when the game stops on an error (I_Error); the game then writes the 0x80 byte and the file <name>.lmp, and exits with "Demo <name>.lmp recorded".linuxdoom-1.10/g_game.c L1508–1518linuxdoom-1.10/g_game.c L1536–1543linuxdoom-1.10/i_system.c L162–177linuxdoom-1.10/d_net.c L289–293linuxdoom-1.10/g_game.c L1677–1683Code
id Software's released Doom source is version 1.10 of the Linux port: doomdef.h sets VERSION to 110, and John Carmack's README, signed 1997-12-23, says the code "only compiles and runs on linux" because the DOS code's sound library could not be released.linuxdoom-1.10/doomdef.h L33README.TXT L12–14README.TXT L77–78Code
Doom's game logic runs in tics of 1/35 second (TICRATE 35).linuxdoom-1.10/doomdef.h L121–122Code
Doom's random numbers come from rndtable, a fixed table of 256 bytes, walked by two indices: each call to P_Random or M_Random adds 1 to its own index, wraps it at 256, and returns that table entry.linuxdoom-1.10/m_random.c L31–32linuxdoom-1.10/m_random.c L53–67Code
Doom's play code (weapon damage, aim spread, pain) rolls P_Random, and M_Random serves the rest: the screen wipe, sound pitch, intermission animations, and the status bar.linuxdoom-1.10/p_pspr.c L633–637linuxdoom-1.10/p_inter.c L894linuxdoom-1.10/f_wipe.c L159linuxdoom-1.10/s_sound.c L326–330linuxdoom-1.10/wi_stuff.c L523linuxdoom-1.10/st_stuff.c L992Code
G_InitNew resets both of Doom's random indices to 0, and it runs when a new game starts, when a saved game loads, when a demo starts playing, and when the command line starts a game directly (a warp or autostart, or a net game).linuxdoom-1.10/m_random.c L69–72linuxdoom-1.10/g_game.c L1414linuxdoom-1.10/g_game.c L1345–1356linuxdoom-1.10/g_game.c L1226–1227linuxdoom-1.10/g_game.c L1613–1615linuxdoom-1.10/d_main.c L1161–1164Code
Doom's rndtable is not a permutation: its 256 entries hold 166 distinct values, 101 of them once, 45 twice, 16 three times, 3 four times, and 1 five times; the value 145 appears 5 times and the value 0 twice.linuxdoom-1.10/m_random.c L31–51Code
Each bullet from Doom's pistol, chaingun, or shotgun deals 5*(P_Random()%3+1), so 5, 10, or 15; the shotgun fires 7 such pellets. Over one pass of the table the multipliers 1, 2, and 3 come up 75, 88, and 93 times.linuxdoom-1.10/p_pspr.c L625–639linuxdoom-1.10/p_pspr.c L660–661linuxdoom-1.10/p_pspr.c L684–687linuxdoom-1.10/p_pspr.c L751–753linuxdoom-1.10/m_random.c L31–51Code
Doom's fist deals (P_Random()%10+1)<<1, 2 to 20, multiplied by 10 while the player has the berserk strength power; the chainsaw deals 2 to 20.linuxdoom-1.10/p_pspr.c L476–479linuxdoom-1.10/p_pspr.c L510Code
A Doom projectile that hits a shootable thing, other than a monster of its shooter's species, deals ((P_Random()%8)+1) times its type's damage value: a rocket's 20 gives 20 to 160, a plasma ball's 5 gives 5 to 40, a BFG ball's 100 gives 100 to 800, and an imp's fireball's 3 gives 3 to 24.linuxdoom-1.10/p_map.c L290–291linuxdoom-1.10/p_map.c L322–324linuxdoom-1.10/info.c L1966–1986linuxdoom-1.10/info.c L1992–2012linuxdoom-1.10/info.c L2018–2038linuxdoom-1.10/info.c L1914–1934linuxdoom-1.10/p_enemy.c L931Code
A Doom rocket's explosion deals 128 minus the distance to each shootable thing in sight of the blast, measured as the larger of the x and y gaps less the thing's radius, and the Cyberdemon and Spider Mastermind take none.linuxdoom-1.10/info.c L1966–1979linuxdoom-1.10/info.c L263linuxdoom-1.10/p_enemy.c L1598–1600linuxdoom-1.10/p_map.c L1173–1194Code
When a Doom BFG ball's explosion reaches its third frame, 40 traces fan across 90° around the ball's heading, each starting from the player who fired it and reaching 1,024 units, and each trace that finds a target deals the sum of 15 rolls of 1 to 8, so 15 to 120.linuxdoom-1.10/info.c L253–255linuxdoom-1.10/p_pspr.c L789–809Code
Doom's monster attacks use the same multiple-of-a-base form: a zombieman's bullet deals ((P_Random()%5)+1)*3, 3 to 15; an imp's claw (P_Random()%8+1)*3, 3 to 24; a demon's bite ((P_Random()%10)+1)*4, 4 to 40; and a Baron of Hell's claw (P_Random()%8+1)*10, 10 to 80, an attack function (A_BruisAttack) the code shares with Doom II's Hell Knight (MT_KNIGHT).linuxdoom-1.10/p_enemy.c L802–818linuxdoom-1.10/p_enemy.c L913–925linuxdoom-1.10/p_enemy.c L935–945linuxdoom-1.10/p_enemy.c L979–989linuxdoom-1.10/f_finale.c L340–349linuxdoom-1.10/d_englsh.h L677–685linuxdoom-1.10/info.c L320–321linuxdoom-1.10/info.c L1134–1146linuxdoom-1.10/info.c L588–590linuxdoom-1.10/info.c L1394–1405linuxdoom-1.10/info.c L621–623linuxdoom-1.10/info.c L1420–1431linuxdoom-1.10/info.c L673–675linuxdoom-1.10/info.c L1498–1509linuxdoom-1.10/info.c L702–704linuxdoom-1.10/info.c L1550–1561linuxdoom-1.10/f_finale.c L348linuxdoom-1.10/f_finale.c L212–223Code
Damage to a Doom player is halved on the easiest skill (sk_baby), and then armor takes a share: a third with the armor pickup (type 1) and half with the MegaArmor (type 2), until its points run out; monsters have no armor or defense value.linuxdoom-1.10/p_inter.c L798–800linuxdoom-1.10/p_inter.c L854–869linuxdoom-1.10/p_inter.c L370–380linuxdoom-1.10/d_englsh.h L80–81linuxdoom-1.10/p_inter.c L886–887Code
Doom's bullets and melee are hitscan: P_LineAttack traces a line in the same tic, out to 2,048 units for guns and 64 for melee, and damages the first shootable thing whose height spans the shot's slope; rockets, plasma, and BFG balls are objects spawned by P_SpawnPlayerMissile that move each tic at their type's speed (20, 25, and 25 units per tic).linuxdoom-1.10/p_pspr.c L483–484linuxdoom-1.10/p_local.h L57–58linuxdoom-1.10/p_map.c L1063–1085linuxdoom-1.10/p_map.c L984–1014linuxdoom-1.10/p_pspr.c L556linuxdoom-1.10/p_mobj.c L973–984linuxdoom-1.10/info.c L1966–1982linuxdoom-1.10/info.c L1992–2008linuxdoom-1.10/info.c L2018–2034Code
Doom aims vertically for the player: P_BulletSlope traces 1,024 units straight ahead, then 5.625° (1<<26) to the left, then to the right, and takes the slope to the middle of the first shootable thing's visible part, within ±100/160; a bullet keeps the player's facing and takes only that slope, but a player's rocket, plasma, or BFG ball also turns to the side trace that found the target and flies level when none did.linuxdoom-1.10/p_pspr.c L601–619linuxdoom-1.10/p_map.c L1038–1053linuxdoom-1.10/p_map.c L882–892linuxdoom-1.10/p_pspr.c L633–639linuxdoom-1.10/p_mobj.c L948–984linuxdoom-1.10/tables.h L69Code
Doom's shotgun turns each of its 7 pellets by (P_Random()-P_Random())<<18, up to about 5.6° either side, at one shared vertical slope; the pistol and chaingun turn their shots the same way except while player->refire is 0, which covers the pistol's first shot and the chaingun's first two in a burst of held fire, and those fly straight.linuxdoom-1.10/p_pspr.c L626–639linuxdoom-1.10/p_pspr.c L684–687linuxdoom-1.10/p_pspr.c L661linuxdoom-1.10/p_pspr.c L753linuxdoom-1.10/p_pspr.c L350–359linuxdoom-1.10/info.c L149–152linuxdoom-1.10/info.c L188–190linuxdoom-1.10/tables.h L69Code
Each tic a Doom player stands on the floor, P_MovePlayer adds a thrust of the command's forward and side moves times 2,048 (1/32 unit per tic for each step of move), the side thrust at 90° to the facing; a keyboard sets the forward move to 25 walking or 50 running and the side move to 24 or 40, and the player gets no thrust in the air.linuxdoom-1.10/p_user.c L156–164linuxdoom-1.10/p_user.c L64–67linuxdoom-1.10/g_game.c L175–176Code
After a Doom thing moves on the floor, its momentum is multiplied by FRICTION (0xe800, 0.90625) each tic, and set to 0 once both axes are under STOPSPEED (1/16 unit per tic) with no move commanded; friction skips missiles, a charging lost soul, anything in the air, and a corpse halfway off a step still moving faster than 1/4 unit per tic on an axis, and the no-momentum cheat stops a player outright. Each axis of momentum is capped at 30 units per tic.linuxdoom-1.10/p_mobj.c L111–112linuxdoom-1.10/p_mobj.c L137–140linuxdoom-1.10/p_local.h L54linuxdoom-1.10/p_mobj.c L193–198linuxdoom-1.10/p_mobj.c L201–240Code
Computed from the thrust and friction, not measured: with a thrust of a each tic and friction 0.90625, a Doom player on the floor settles at the speed v where a = 0.09375·v, about 16.7 units per tic (583 units/s) running forward and 8.3 walking; neither comes near the 30-unit cap.linuxdoom-1.10/p_tick.c L148–152linuxdoom-1.10/p_user.c L160–161linuxdoom-1.10/p_mobj.c L147–163linuxdoom-1.10/p_mobj.c L238–239linuxdoom-1.10/g_game.c L175linuxdoom-1.10/doomdef.h L122Code
Doom applies forward and side thrust at 90° to each other and caps each move separately, so running forward (50) while running sideways (40) gives √(50² + 40²) ≈ 64, 1.28 times the forward run alone.linuxdoom-1.10/p_user.c L160–164linuxdoom-1.10/g_game.c L413–420linuxdoom-1.10/g_game.c L171–176Code
Holding Doom's strafe modifier makes the turn keys add a side move, and the strafe keys add theirs on top, so a turn key and a strafe key pressed together reach 80, clamped to MAXPLMOVE (50); a run then moves at √(50² + 50²) ≈ 70.7, 1.41 times the forward run alone.linuxdoom-1.10/g_game.c L277–289linuxdoom-1.10/g_game.c L322–325linuxdoom-1.10/g_game.c L413–420linuxdoom-1.10/g_game.c L171–176Code
When damage with a source hits a Doom monster and the monster survives, it makes that source its target, player or monster alike, unless the source is the monster itself or Doom II's Arch-vile (MT_VILE), or the monster's threshold from an earlier switch is still above 0; a damaged Arch-vile ignores its own threshold. Damage with no source never retargets. Each switch sets the threshold to 100; A_Chase lowers it by 1 per call and clears it at once when the target is gone or dead.linuxdoom-1.10/p_inter.c L886–915linuxdoom-1.10/p_local.h L60–61linuxdoom-1.10/p_enemy.c L680–689linuxdoom-1.10/f_finale.c L354linuxdoom-1.10/d_englsh.h L690linuxdoom-1.10/f_finale.c L212–223linuxdoom-1.10/doomdef.h L42Code
A Doom projectile that touches a monster of its shooter's own type explodes without dealing damage, so those projectiles can't start infighting within a species; a hitscan attack has no such check.linuxdoom-1.10/p_map.c L299–313linuxdoom-1.10/p_map.c L974–1011Code
A Doom monster that survives a hit enters its pain state when P_Random() is below its pain chance, out of 256, unless it is a lost soul in mid-charge; the table gives the zombieman and imp 200, the demon 180, the shotgun guy 170, the cacodemon 128, the Baron of Hell 50, the Spider Mastermind 40, and the Cyberdemon 20, and the lost soul's 256 always succeeds. The pain sets MF_JUSTHIT, so the monster's next missile-range check passes at once if it can see its target.linuxdoom-1.10/p_inter.c L887–900linuxdoom-1.10/p_enemy.c L197–209linuxdoom-1.10/info.c L1134–1143linuxdoom-1.10/info.c L1160–1169linuxdoom-1.10/info.c L1394–1403linuxdoom-1.10/info.c L1420–1429linuxdoom-1.10/info.c L1472–1481linuxdoom-1.10/info.c L1498–1507linuxdoom-1.10/info.c L1576–1585linuxdoom-1.10/info.c L1602–1611linuxdoom-1.10/info.c L1654–1663linuxdoom-1.10/f_finale.c L341–356linuxdoom-1.10/d_englsh.h L677–692Code
A Doom monster spawns with its type's reactiontime (8 for the zombieman) except on Nightmare, where it stays 0; each call of A_Chase lowers it by 1, and while it is above 0 the missile-range check refuses a ranged attack, unless the monster has flinched from a hit (its pain-chance roll, which sets MF_JUSTHIT) since the check last ran. Melee attacks don't check it.linuxdoom-1.10/p_mobj.c L491–504linuxdoom-1.10/info.c L1134–1140linuxdoom-1.10/p_enemy.c L676–677linuxdoom-1.10/p_enemy.c L203–213linuxdoom-1.10/p_inter.c L894–897Code
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.linuxdoom-1.10/doomdef.h L121–122Code
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.linuxdoom-1.10/p_pspr.c L625–639Code
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.linuxdoom-1.10/p_pspr.c L625–639Code
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°.linuxdoom-1.10/p_pspr.c L626–639linuxdoom-1.10/p_pspr.c L684–687Code
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.linuxdoom-1.10/p_pspr.c L601–619linuxdoom-1.10/p_pspr.c L626–639Code
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.linuxdoom-1.10/p_user.c L156–164linuxdoom-1.10/g_game.c L175–176Code
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.linuxdoom-1.10/p_mobj.c L111–112Code
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.linuxdoom-1.10/p_user.c L160–164linuxdoom-1.10/g_game.c L175–176Code
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.linuxdoom-1.10/p_enemy.c L1598–1600linuxdoom-1.10/p_map.c L1180–1194Code
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.linuxdoom-1.10/p_pspr.c L601–619Code
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.linuxdoom-1.10/p_pspr.c L633–639Code
Perfect Dark's chr_damage scales a hit by the body part (hitpart) it struck: a head hit is multiplied by 4 and a torso hit doubled, the limbs and pelvis keep the damage, and a hit on the held gun or a hat deals none. Outside normal multiplayer a gun shot fired by a player multiplies a head hit by a further 25 (headshotdamagescale), 100 in all, unless a shield took it; a Skedar's head is only doubled, and its tail takes 10 times. A hit with no part (HITPART_GENERAL, as when a guard's bullet hits the player) is halved and then doubled as the torso, so it keeps its damage. Doom's P_LineAttack passes a bullet's damage to the thing it hits with no body part.linuxdoom-1.10/p_map.c L1004–1011Code
The Falcon 2's single shot in Perfect Dark carries a damage of 1 (invfunc_falcon2_singleshot), read by gset_get_damage. A guard adds each hit to its damage against a maxdamage that chr_allocate sets to 4 (a level's AI script can set another), and chr_react_to_damage starts its death once damage reaches it; so on Perfect Agent a default guard takes 4 Falcon 2 shots to a limb, 2 to the torso, or 1 to the head (computed). The player's health starts at 1, and a hit takes damage × 0.125 from it, so a guard's Falcon 2 bullet takes an eighth on Perfect Agent (computed). Each Doom pistol bullet deals 5, 10, or 15 against a zombieman's 20.linuxdoom-1.10/p_pspr.c L633linuxdoom-1.10/info.c L1134–1137Code
Solo Perfect Dark scales damage by difficulty in lv_update_solo_handicaps, which runs every tick: a guard's hit on the player is multiplied by 0.5 on Agent, 0.6 on Special Agent, and 1 on Perfect Agent (and on the Perfect Dark difficulty, times its own enemy-damage setting); the player's shots are doubled on Agent; and explosions hurt the player 0.25 times on Agent and 0.75 times on Special Agent. On Agent the scales for the damage the player takes, from guards and from explosions, shrink further once health plus shield is at or below 0.6, falling linearly to half at 0.125, so 0.25 for a guard's hit (computed); the player's ×2 on its own shots stays fixed. Doom halves all damage to the player on its easiest skill, sk_baby.linuxdoom-1.10/p_inter.c L798–800Code
A Perfect Dark combat simulant keeps a shootdelaytimer60 per target: it resets to 0 when the simulant picks a new target, counts up in 60ths of a second while the target is in sight, and counts back down to 0 while it isn't. Unless a burst or the Cyclone's secondary discharge is already under way (burstsdone above 0 or cyclonedischarging), which keeps it firing without the test, the simulant opens fire only once the timer reaches its difficulty's shootdelay60: 90 (1.5 s) for Meat, 60 for Easy, 30 for Normal, 15 for Hard, and 0 for Perfect and Dark, on NTSC; the target must also be within 45/256 of a turn (63°, computed) of its facing, unless the simulant is dizzy. Doom gives each monster a reactiontime at spawn (8 for the zombieman, 0 on Nightmare), counted down once per A_Chase call, and refuses a ranged attack until it reaches 0, unless the monster has been hit since it last checked (MF_JUSTHIT).linuxdoom-1.10/p_mobj.c L503–504linuxdoom-1.10/info.c L1134–1140linuxdoom-1.10/p_enemy.c L672–677linuxdoom-1.10/p_enemy.c L204–213Code
Doom's rndtable holds the same 256 values in the same order as Wolfenstein 3D's (compared entry by entry, computed); Doom walks it with two indices (prndindex for P_Random, rndindex for M_Random), where Wolfenstein 3D uses one (rndindex).linuxdoom-1.10/m_random.c L31–33linuxdoom-1.10/m_random.c L50–51linuxdoom-1.10/m_random.c L53–67Code