How NetWars Works Chapter 20 of 21, plus appendices

20. Authentic and Modern modes, units and step rates

A rebuild has to decide two things that the original never had to: which of its oddities to keep, and how fast to run the simulation. This chapter defines two modes, Authentic and Modern, lists every known oddity with the exact choice for each mode, and then explains what the step rate does to the game: which numbers are "per frame", what they mean in seconds, and how to convert the game to another rate if you really must. Marks: O observed, D derived from the code, H hypothesis, ? unknown (chapter 0).

Two words used a lot below. A step is one run of the simulation: everything moves once, every test is made once. In the original one step is one frame (chapter 2). The step rate is how many steps run per second. A rebuild may draw pictures more often than it steps; the step rate is about the simulation only.

Part 1. Two compatibility modes

Authentic NetWars

Definition: Authentic

Authentic NetWars reproduces the behaviour of NetWars 2.06 as the reconstructed source describes it, bugs included, at the original step rates:

  1. Every rule of chapters 3 to 11 and 14 to 17, in the original frame order, with the original integer rules where the "Exact rules" boxes give them (floors, shifts, inclusive limits, whole-unit measurements).
  2. Single player: exactly one step per timer tick, 1,193,182 ÷ 65,536 = 18.2065 steps per second (54.925 ms). Menus, the title screen, the level introduction, the level-complete screen, the lobby and the name screen: one step per display refresh of the original, 70.09 per second (the VGA refresh of the 640 × 350 mode; see Part 2).
  3. Multiplayer: at most 70.09 steps per second, and each step waits for a packet from every live peer, exactly as net_sync_frame does (chapter 8). The tick counter is reset at the very start of the frame, before the page swap, so the wait bounds the whole frame: the frame ends no later than the 5th timer tick after its start (219.7–274.6 ms after it began, depending on where in a tick it started). A browser caps the rate with its own 70.09 Hz step clock, not with the display's refresh. This wait is part of Authentic: without it, the repeated-hit bug would fire in every step that misses a packet, far more often than it did on a LAN in 1993 D. Even with it, internet delays and jitter longer than 4–5 ticks still trigger the bug (D1) more often than a 1993 LAN did.
  4. Multiplayer receive buffer: per peer the original keeps one buffer holding the latest packet received, whether or not it has been used. It is read every frame. A packet that arrives while no listen is posted for that peer is lost. Emulate this single buffer, not a queue of packets D (src/net.c; that IPX drops a packet with no listen posted is the IPX API's documented behaviour, not something this program shows).
  5. Every behaviour in the table below with "keep" in the Authentic column.
  6. Drawing: the painter's sort with one depth per face, no near-plane clipping, the original disc sizes and colours (chapter 9). The resolution may be higher, with the same 4:3 view.
  7. Sound: the PC-speaker tables played one entry per tick, a new effect replacing the running one (chapter 10).

Authentic does not reproduce what is not a rule of the game: crashes and memory corruption (the mouse cursor race, chapter 12), the slowdown of a machine too slow to finish a frame within a tick, the write to port 0FDh at exit, and the never-shown leftovers (Novell credits, unused models).

Modern NetWars

Definition: Modern

Modern NetWars keeps the same physics, mechanics and models: all per-frame numbers, the frame order, the hit boxes, the alien behaviours, the levels, the scores, the 22 models and the 16 colours. It differs from Authentic only where the table says "fix" or "option":

Modern uses the same step rates as Authentic in single player (18.2065) and one fixed rate in multiplayer that every peer agrees on (default 70, see Part 2), and draws with interpolation between steps.

The behaviour table

Every bug and oddity found in chapters 3 to 12 and in the comments of src/ (searched for "quirk", "sic", "bug", "wrap"), one row each. "Cause" is one line; the chapter named in brackets explains it. The last column says exactly what Modern does differently; "—" means nothing.

Legend of the Modern column

A. Combat and collisions

#BehaviourCauseAuthenticModernExact change for Modern
A1Your laser skips over a target: about 1 in 8 shots at full throttle, 1 in 4–5 with extra thrust Dthe hit box is 1,025 units deep along the flight, the shot moves 1,024 + your speed per frame and is tested once per frame (ch. 6, shot_hits_object)keepoption (keep): "swept lasers" When on: split each frame's move of a player shot into n = ⌈L ÷ 1024⌉ equal parts (L = length of the move in units) and run the target tests after each part, against the targets' positions of this frame; stop at the first hit.
A2Your laser cannot hit anything closer than about 512 units straight ahead; between 256 and 512 an alien can be neither shot nor rammed D the shot moves before its first test; the box reaches 512 units back (ch. 6)keep option (keep): "point-blank lasers"When on: in the frame a shot is fired, test it once at its start position before its first move.
A3Alien lasers pass through you about half the time when aimed straight at you O / Dalien shot box 513 units deep, step 1,024 (ch. 6, alien_shots_update)keepoption (keep): same switch as A1 When on: alien shots use n = ⌈L ÷ 512⌉ parts per move.
A4Aliens cannot hit you within about 768 units in front of them Dalien shot moves before its first testkeep option (keep): same switch as A2When on: test an alien shot once at its start position in the frame it is fired.
A5Your shots are tested against where the aliens were at the end of the previous frameframe order: player shots before aliens (ch. 2, 6)keepkeep—
A6Extra damage against aliens follows your fire-power stock at the moment of the hit, not the shot Oplayer_shots_update tests g_fire_power > 0, not the shot's powered bit (ch. 6)keepoption (keep)When changed: damage 2 if the shot's own powered flag (state bit 0x100) is set, else 1.
A7Missile lock works far outside the view (a beam ±0xC0 · 2e, no view test) Oaliens_update marks "targeted" with cam_z > 0 only (ch. 6)keepkeep— (a rule players learn)
A8A missile homes on the first locked alien in slot order, not the nearest loop in player_fire_missilekeepkeep—
A9Nearness is a cube: contacts reach about 1.7 times farther along diagonals distance exponent tests the largest coordinate (ch. 3)keepkeep—
A10A fast alien can pass through you without ramming when the closing speed per frame exceeds the contact cube (about 512 units wide), e.g. a Guardian at 275 units per frame against you at 288 Dcontact tested once per frame (render_object, exponent ≥ 7)keepkeep—
A11Ramming an alien scores nothing and costs a shieldaliens_update keepkeep—
A12Aliens' lasers, missiles and rams no longer count once your shields are 0 g_shields > 0 testskeepkeep—
A13Collision push along a fixed world axis per slot (+z in single player), whatever you hit Oplayer_bump copies g_vel_presets[slot] (ch. 4)keepoption (keep): "push away"When on: velocity := 64 units per frame along the unit vector from the obstacle's position to the ship (the preset if the two positions are equal).
A14An alien missile hit gives no bump and ignores bump immunity enemy_missiles_updatekeepkeep—
A15No satellite pick-up for 8 frames after a bumprender_object reports contact only with immunity 0keepkeep—

B. Motion

#BehaviourCauseAuthenticModernExact change for Modern
B1Drift below one unit per frame in a positive direction is never corrected the velocity is measured in whole units, rounded down (ch. 4)keepoption (keep) When changed: measure the body-axis velocity without rounding and correct any non-zero error (same step table).
B2Single-player levels start with the view rolled by an unpredictable angle (about 180° in run #35) Olevel_intro rolls the camera −16 per refresh and nothing resets it (ch. 4)keep (the intro runs at 70.09 steps per second, so the roll depends on how long it is shown)fixWhen the level introduction returns "start" in single player, set the camera axes to forward (0, 0, 1), right (1, 0, 0), up (0, 1, 0). Position and velocity are already zero.
B3Shift and Ctrl held together at the top limit turn 144 into 136order of the two throttle tests (ch. 4)keepkeep—
B4The left-Ctrl test is written twice; right Ctrl brakes too player_update, keyboard handler (ch. 11)keepkeep— (map both Ctrl keys)
B5A dead ship keeps its velocity but does not moveearly return in player_updatekeepkeep—
B6Cross product loses a borrow (+4/16384); the length fix is approximate vec3_cross, vec3_rotate (src/input_math.asm)keep where bit-exact results are tested (chapter 21)keep in effectFloating point, exact normalisation: the difference is invisible, so this is not an option.

C. Single-player rules

#BehaviourCauseAuthenticModernExact change for Modern
C1An escaped Pirate counts as destroyed; a level can end while pods are carried offai_abductor decrements g_aliens_left (ch. 7)keepkeep—
C2A Pirate's escape is measured from you (more than 32,768 units on the largest axis)exponent < 0 (ch. 7)keepkeep—
C3A new alien keeps the dead alien's orientationslots are reset only at level start (aliens_clear)keepkeep—
C4Tapping fires faster than holdingrelease clears the cooldown (ch. 6) keepkeep—
C5Esc on "Level completed" keeps the score; Esc in flight sets it to 0 ch. 11keepkeep—
C6The score wraps: above 1,000,000 it drops by 1,000,000add_score (src/screens.c)keepoption (fix)When fixed: no wrap; the score is shown with 7 digits. High scores of a game with this option changed go to the Modern table (below).
C7The level bonus shown on screen wraps from level 33 (the added bonus is right)(level+1)*1000 formatted as a 16-bit intkeepfix Format the shown value as a 32-bit number.
C8An alien explosion starts at age = model scale = 1, one frame shorter than an explosion starting at 0 (enemy missile, pod shot, satellite; chapter 16 lists every start age) aliens_update, player_missiles_updatekeepkeep—
C9A pod is removed at explosion age ≥ 64, aliens and missiles at > 64 pods_updatekeepkeep—
C10A missile's explosion is drawn in the frame it hits (its slot is processed twice)i-- in player_missiles_updatekeepkeep—
C11Guardians always head for the world origing_rally_point is never writtenkeepkeep—
C12The satellite cycle continues across games of a session g_satellite_counter is never resetkeepkeep—

D. Multiplayer and network

#BehaviourCauseAuthenticModernExact change for Modern
D1Repeated hits: a hit is applied again in every frame without a new packet from the shooter O (run #24)net_sync_frame reads the receive buffer every frame (ch. 8)keepfixApply hit and satellite events only once: either only from packets that arrived since the last step, or by event id (chapter 18).
D2The same after the shooter presses Esc right after a hitthe name screen keeps sending the last event recordkeepfixAs D1, and clear the outgoing event record when leaving the flight.
D3Hit reports still land on a player who is already deadno shield test in net_sync_framekeepfixIgnore hit events while my shields are 0.
D4A stale "your satellite was taken / shot" event is applied every frame same buffer as D1 (satellite_update)keepfixAs D1.
D5Taking another player's satellite can apply the pick-up on several frames O (run satrep: 2 frames in flight)our copy keeps its type until the owner's packet clears it keepfixGive every satellite an id; after collecting a peer's satellite, ignore that copy until the owner's state shows a different satellite id (chapter 18).
D5bWhile the owner is on the name screen, its satellite can be collected every frame O (run satrep: 1,532 packets in 22.8 s)the name screen keeps sending the satellite but never handles eventskeepfixThe owner drops its satellite when it leaves flight (chapter 18).
D6Two players can take the same satellite in the same moment and both get it Deach machine decides its own pick-upskeep keep— (a design proposal for an owner-confirmed pick-up is possible but changes the feel: the reward would arrive a round trip later)
D7Two players in one slot when both take it within a frame or twono claim message in the lobby (ch. 8)keepfixClaim slots with a message and arbitrate (chapter 18).
D8Hits merge or get lost: one hit word per victim per frame; a packet not sent (previous send busy) or not received is gonethe event record has 5 words (3 hit words, one per victim; the status word; the satellite event word), sent once, never repeated (ch. 8)keepfixSend each hit and satellite event as its own message with an id on a reliable data channel (the transport retransmits it until the receiver acknowledges it) and apply each id once (chapter 18).
D9Collisions disagree: each machine judges its own from slightly old positions"collisions judged locally" (ch. 8)keepkeep— (design of the game)
D10A vanished player slows everyone: each frame lasts until the 5th tick after its start, for 4 frames (about 1 s of stutter) Onet_sync_frame waitkeepfix Fixed step clock; never wait for peers; show remote ships from their latest state.
D11A peer is dropped after 4 frames without a packet. Each of those frames waits for it until the 5th tick, so this takes 0.9–1.1 s at any frame rate D g_peer_alive counts frames, but the frames are slowed by the waitkeepfix Drop a peer after about 1 second without a message, measured as a time. This keeps the original's real timing without the stutter.
D12The game speed depends on the slowest machine and on the monitor no fixed clock in multiplayer (ch. 2)keep (70.09 cap and the peer wait)fix One fixed step rate per session, announced in the hello message (Part 2).
D13Another player's shot explosion lasts until that player frees the slot; a powered copy counts 0x118 framesremote_shots_updatekeepfix A copy's explosion lasts 7 steps, like the shooter's own; the copy is computed from the shot record (chapter 18).
D14A cloaked ship still shows on everyone's radar and can be hitcloak changes only the status word (ch. 8)keepkeep—

E. Drawing

#BehaviourCauseAuthenticModernExact change for Modern
E1Faces sometimes painted in the wrong orderpainter's sort with one depth per face, its farthest vertex (ch. 9)keepoption (fix): "depth buffer" When on: draw with a per-pixel depth buffer; the draw order no longer matters.
E2No clipping at the near plane: close faces vanish wholech. 9 keepoption (fix): same switch as E1When on: clip faces against a near plane (e.g. 1 unit in front of the eye) instead of dropping them.
E3Explosion sparks sorted as if twice as far; drawn over everything at 16,384–32,768 units; not drawn beyondspark depth rules (ch. 9)keepoption (fix): same switch as E1When on: sparks at their true depth; drawn up to the explosion's normal limit.
E4Discs (shots, sparks) drawn 4/3 too largech. 9keepkeep — (part of the look)
E5A big object near the top or bottom edge vanishes whole"in view" test on the centre only (ch. 9)keepoption (fix)When fixed: test the model's bounding sphere against the view.
E6Mouse cursor race can corrupt the font or crashch. 12not reproducednot reproduced—

F. Sound

#BehaviourCauseAuthenticModernExact change for Modern
F1Held fire warbles (single player) or buzzes on one 233 Hz tone (multiplayer) D/Oeach shot restarts the laser effect; a shot every 3 frames is 3 ticks in single player, under one tick at 70 frames per second (ch. 10) keepoption (keep): "whole pews"When on: a shot starts the laser effect only if no laser effect is playing.
F2An explosion can be cut before it is hearda new effect replaces the running onekeepkeep—
F3Choosing "None" while a tone sounds leaves it soundingthe tick handler stops, the speaker stays onkeepfixSilence the oscillator when sound is switched off.
F4The hit sound repeats every frame during a repeated hitD1 keepfixed with D1—

G. Input, menus and screens

#BehaviourCauseAuthenticModernExact change for Modern
G1Space, Caps Lock or keypad +/− pressed on the level introduction act in the first frame of the flightonly Esc and Enter latches are cleared (ch. 11)keepfix At the start of every flight, clear every latch whose key is not held now.
G2Each time the title screen is left, every pull-down's mouse area grows by its height; hovering below the last item selects an item past the end D menu_build does not reset popup_hkeepfix Popup height = 12 × number of items, recomputed, not added.
G3A hidden spot at the lobby's left edge makes you a spectator Oloop reads one entry past the slot positionskeep fixRemove the spot; spectate through the menu item.
G4The click that closes the help page stays latchedch. 11keep fixClear the click when the help page closes.
G5The name editor starts at length 0 whatever name is there name_entry_screenkeepoption (fix)When fixed: start editing at the end of the current name.
G6A mouse setting without a mouse leaves you unable to steerch. 11 keepfixOffer only devices that are present.
G7F2 pause shows no text and ends by itself on key repeatch. 11 keepfixToggle on key-down without repeats; show "PAUSED" (design proposal).
G8Reversed Mouse draws the pointer mirrored, moving against your hand ch. 11keepkeep—
G9The mouse handler stays active after you choose Keyboardthe handler is installed at start and never removed until exit (ch. 12)keepfixIgnore pointer events while Keyboard is chosen.
G10Alt is always taken by the game and never used (blocks Ctrl+Alt+Del) Dkeyboard handler (ch. 11)keep where a page can fixDo not capture Alt.
G11The Pause key does nothing in flight; in menus the BIOS's own pause applies Dsrc/input_math.asm (ch. 12)keepkeep — (F2 is the pause key)

H. Timing

#BehaviourCauseAuthenticModernExact change for Modern
H1Menus, the level introduction and the level-complete screen animate at the refresh rate (about 70 per second), not at 18.2those loops wait only for the retrace (flip_pages)keep (70.09)keep— (B2 removes the only effect on play)
H2Multiplayer runs about 3.85 times as fast as single player (same per-frame numbers, more frames) Dsee Part 2keepkeep by default— (the session's step rate is a choice, Part 2)
H3On a slow machine single player slows downa frame longer than a tick is not compensatednot reproducednot reproduced—

Options: how to expose them

Exact rules: options
  1. Each option has a stable identifier (for example lasers.swept, lasers.pointblank, damage.shotflag, bump.pushaway, drift.exact, score.nowrap, draw.depthbuffer, draw.spherecull, sound.wholepews, names.keep), one sentence for the player, and its Modern default from the table.
  2. Three presets: Authentic (everything original, all fixes off, original rates), Modern (fixes on, options at their defaults), Custom (Modern fixes plus any option changed). The title screen shows which preset is active.
  3. Options come in two groups. Rule options change outcomes: A1–A4, A6, A13, B1, C6. Presentation options change only what you see or hear: E1–E3, E5, F1, G5.
  4. In multiplayer the preset, every rule option and the step rate are session settings. They travel in the hello message; a peer with different values is refused (chapter 18). Presentation options are each player's own.
  5. High scores are kept per preset: an Authentic table and a Modern table. A Custom game with a rule option changed does not enter either table (or gets its own).
  6. Fixes are not options inside Modern. A player who wants a bug back chooses Authentic.

Is Authentic really authentic?

Saying "Authentic" is easy; checking it needs tests. Chapter 21 lists the reference cases; in short:

Part 2. Units and step rates

The units again

QuantityUnitExample
distanceworld unit (the middle word of a 64-bit coordinate, chapter 3)pods 1,000 units from the centre
directionQ14 axes (16384 = 1.0)forward (0, 0, 16384)
anglesteps of 1/2048 turn (0.176°)keyboard turn rate up to 24
ship and shot speedunits per framethrottle up to 144
alien, missile and pod speedthe stored number ÷ 4 = units per frameGuardian 1,100 → 275 units per frame
timeframes (most rules) or timer ticks (sound, network wait, attract screens) tumble 48 frames; network wait 5 ticks

The original rates

WhereRateWhyMark
single-player flight18.2065 frames per second (one per tick, at most)the frame loop waits until the tick counter, reset at the frame's start, reaches 1 (main); on a fast machine that is exactly one frame per tickO (code) / D (exactly one)
multiplayer flightabout 70 per second in our runsframes wait only for the display refresh (flip_pages) and for the peers' packets (the frame ends by the 5th tick after its start at the latest); median packet gap 14.1 ms in DOSBox-X at cycles=fixed 60000O (DOSBox-X)
menus, intro, level complete, lobby, name screenabout 70 per secondrefresh only; the level intro's ~705 frames in ~10 s (run #35)O (DOSBox-X)
sound, network wait, attract screens18.2065 ticks per secondtimer interruptO
What the author saw is not known

The 70 per second is a measurement in an emulator, not what players saw in 1993. A VGA card shows the 640 × 350 mode at 70.09 Hz, an EGA card at about 60 Hz H (hardware documentation, not this program), and a 386 or 486 drawing filled polygons for four ships, shots and stars may well have needed longer than one refresh per frame, so real multiplayer games may have run anywhere between about 18 and 70 frames per second H. Nothing in the program fixes the multiplayer rate. A rebuild has to choose one; 70 matches our recordings.

What changes with the rate

Every number below is per frame in the program. The table shows what it means in seconds at 18.2065 and at 70 frames per second. Aliens, missiles and pods exist only in single player, and the cloak only in multiplayer, so some cells are empty.

Rule (source)Per frameSingle player, 18.2/sMultiplayer, 70/s
top speed, throttle 144 (player_update)144 units2,622 units/s10,080 units/s
with extra thrust (288)2885,24320,160
reverse, throttle −1121122,0397,840
throttle ramp +8 per frame, 0 → 14418 frames0.99 s0.26 s
largest correction 8 units/frame per frame (16 with extra thrust)8 2,652 units/s²39,200 units/s²
keyboard turn rate, at most 24 steps (4.22°)2477°/s295°/s
keyboard turn ramp 2 per frame, 0 → 2412 frames0.66 s0.17 s
mouse turn rate: pitch up to about 35 (6.15°), yaw about 33 (5.80°)35 / 33 112 / 106°/s431 / 406°/s
laser shot speed (beyond your own)1,024 units18,643 units/s71,680 units/s
laser shot life (player_fire)24 frames1.32 s0.34 s
fire while held: every 3rd frame3 frames6.1 shots/s23.3 shots/s
collision push (player_bump)64 units1,165 units/s4,480 units/s
bump immunity8 frames0.44 s0.11 s
tumble (decay 1 per frame from ±48)48 frames2.64 s0.69 s
"COLLISION" message48 frames2.64 s0.69 s
death text before input counts (player_dead_screen)64 frames3.52 s0.91 s
explosion length64 frames3.52 s0.91 s
satellite spawn period (main)128 frames7.03 s1.83 s
pick-up message32 frames1.76 s0.46 s
cloak time (apply_pickup)512 frames—7.31 s
peer counted absent after (net_sync_frame)4 frames, each held until the 5th tick—0.9–1.1 s (at any rate)
alien spawn period64 frames3.52 s—
alien speeds 125 to 275 units (Pirate 125–250, Fighter 175, Commander 225, Guardian 275) 125–2752,276–5,007 units/s—
missile speed (stored 1,600)400 units7,283 units/s—
alien turn rates 24 / 32; missiles 8, 32, 1284.2° / 5.6°; 1.4°, 5.6°, 22.5° 77 / 102°/s; 26, 102, 410°/s—
Fighter fires every 4th frame, Guardian every 2nd, mutant every frame (while aimed) 4 / 2 / 14.6 / 9.1 / 18.2 shots/s—
warning messages ("MISSILE LAUNCH", "No Target")16 frames0.88 s—
a sound table entry1 tick, not a frame55 ms55 ms

So in the original, as measured in DOSBox-X, a multiplayer ship flies, turns and fires about 3.85 times as fast as a single-player ship, while its sounds last as long D. The two modes of one program are two quite different games in time, but the same game in frames.

What does not change with the rate: things measured in frames

Products of two per-frame numbers that cancel out do not depend on the rate at all, as long as both are per frame:

And every discrete test depends on the distance moved per step, not per second. The laser box is 1,025 units deep and the shot moves 1,168 units per frame at full throttle in both modes, so the 1-in-8 tunnelling is the same in single player and in multiplayer, although the multiplayer shot is 3.85 times faster in seconds. The point-blank blind spot (512 units for your laser, 768 for an alien's) is the same too. This is why "the same game in frames" is the right way to think about NetWars.

1. your laser, original step 1,168 (full throttle): skips hit slab, 1,025 units deep 2. the same shot at 70 steps/s with converted speed (304 per step): always hits (only the first red sample counts: the shot ends there) 3. alien laser, step 1,024 against a slab 513 deep: skips about half the time 513 units circles: where the shot is when it is tested; red: inside the box (a hit). Scale: 4,096 units across.
Hit tests are made once per step. With the original step a target on the line of fire can fall between two tests (rows 1 and 3). Converting the speed to a faster step rate makes the gaps smaller than the box, and the shot can no longer miss (row 2): a different game.

Converting to another step rate

You should not need this (see the recommendation at the end), but if a rebuild must step at a different rate, here is how to convert every number, and what will still differ.

Let f0 be the original rate the numbers were made for (18.2065 in single player; in multiplayer the rate you treat as original, 70 by default) and f1 the new rate. k = f1 ÷ f0 is the number of new steps per original frame. For 60 steps per second from single player, k = 60 ÷ 18.2065 = 3.2955: each original frame becomes about 3.3 shorter steps.

Why some numbers are divided by k and others by k². A speed says how far something moves in one step. If a step is k times shorter, the object must move k times less per step to cover the same distance per second: 144 units per frame becomes 144 ÷ 3.2955 = 43.70 units per step. A change of speed per step (the throttle rising by 8 each frame) is shrunk twice. The target it climbs to is already k times smaller, and there are k times more steps per second to climb in. So 8 becomes 8 ÷ k² = 8 ÷ 10.86 = 0.7366 per step. Check: the original needs 144 ÷ 8 = 18 frames (0.99 s) to reach full throttle; the converted game needs 43.70 ÷ 0.7366 = 59.3 steps, also 0.99 s. Turn rates and turn ramps follow the same two rules. Durations counted in frames go the other way: k times more steps.

Three words from chapter 3 appear in the table. A world unit is the "middle word" of a 64-bit coordinate, the whole-number part that the game mostly works in. Q14 means 16384 = 1.0 (for the axes). "Exponent ≥ 7" is a distance test: the distance exponent counts halvings of the largest coordinate difference, so a larger exponent means nearer, and ≥ 7 means within roughly 256 units ("touching", chapter 3). Tests like this involve no time, so they do not change.

Exact rules: conversion classes
ClassWhat it isRuleExample at k = 3.2955
Vdistance per frame (a speed)divide by kthrottle limit 144 → 43.70 units per step
Achange of a per-frame speed per frame (an acceleration)divide by k² throttle step 8 → 0.7366; alien braking 50 (stored) → 4.604
Ωangle per frame (a turn rate)divide by kkeyboard limit 24 → 7.283 steps of 1/2048
αchange of a turn rate per frame (a turn ramp)divide by k²ramp 2 → 0.1842; tumble decay 1 → 0.0921
Na number of frames: a period, a lifetime, a timerconvert the period (not the stored counter value): round(period · k), at least 1. A counter that is set to a stock and loses 1 per frame (cloak 512, death countdown 64, message times, explosion age, tumble 48, immunity 8) is set to round(stock · k) and still loses 1 per step. Stocks used up "1 per frame when something happens" (extra thrust) are handled the same way: stock × k, −1 per step. fire while held: period 3 (stored cooldown 2) → period 10 (cooldown 9); spawn every 64 → every 211; tumble 48 → 158; extra thrust pick-up 1,024 → 3,375
Ga gain that turns an error into a per-frame turn rate (steering, mouse) compute the original integer rate, then divide it by k; convert its limits as Ω alien steering: r = floor(dot ÷ 128), then 0 becomes +1 (−1 stays −1), clamp to ±max_turn, then ÷ k; mouse pitch (rate from dy) ÷ k
La distance, angle or exponent that does not involve time (hit boxes, thresholds, positions, cones, ranges)unchangedbox ±512; spawn offset 16,384; contact exponent ≥ 7; cone ±0x80
Ca count of things (hit points, shields, missiles, powered shots, points) unchanged16 missiles; fire power 64 shots
Ean event per key press (latches)unchanged: once per pressEnter / Caps Lock (missile or cloak toggle), keypad +/− (radar zoom), Esc, F2
Talready measured in timer ticks or secondsunchangedsound tables; the multiplayer wait (frame ends by the 5th tick after its start); attract screens 200 ticks

Ramps and limits. The original's ramps land exactly on their limits because the limits are whole multiples of the steps: 144 = 18 × 8, 24 = 12 × 2, 48 decays by 1, the Guardian brakes 1,100 in 11 steps of 100, the braking floor 200 is a multiple of 50 and 100. After conversion they are not (59.3 throttle steps, 39.5 turn-ramp steps, 36.25 Guardian braking steps), and the original's tests would overshoot: a throttle above 144 ÷ k, a turn rate that never decays to 0 (see the ±1 rule in src/control.c), a Guardian speed below 0 for one step (src/aliens.c, ai_turret). So a converted game must use these forms:

ramp up:    r = min(r + d, limit)          // instead of "if r < limit: r = r + d"
ramp down:  r = max(r - d, -limit)
decay:      r = sign(r) * max(|r| - d, 0)  // instead of "if r > 0: r -= d; if r < 0: r += d"
brake:      s = max(s - d, floor)          // Guardian: floor 0, then state 1 when s == 0
            // the original's "clear a rate of exactly ±1 when the keyboard takes over"
            // (it exists only because ±1 would flip between +1 and −1 forever under
            // the ±2 decay) is not needed with this decay form

One original pattern still differs: Shift and Ctrl held together at full throttle (B3). The original drops from 144 to 136 and climbs back each frame. With the forms above the converted throttle settles at 144 ÷ k − 8 ÷ k², which is 141.6 in original units, not 136 D.

Thresholds that compare a per-frame quantity (the velocity controller's error bands 2, 4, 8, 16, 32 units per frame) are compared in original units. The original measures the velocity first and then subtracts it from the target. It takes the whole-unit part (the middle word, so a floor) of each world component of the velocity, then dots that whole-unit vector with each Q14 axis (another floor). For example, with a forward speed of 143.5 and throttle 144, the measured speed is 143 and the error is 1, so the 0.5 correction is applied. A converted game must measure the same way:

// velocity controller at a converted rate; vel_step is the world velocity per step
w = (floor(vel_step.x * k), floor(vel_step.y * k), floor(vel_step.z * k))   // original whole units
for each (axis, target) in ((right, 0), (up, 0), (forward, wanted)):
    // wanted = throttle_orig, doubled while extra_thrust != 0 (src/control.c tests != 0)
    v = floor(dot(w, axis))            // original: hi16 of the Q14 dot product
    err = target - v                   // sideways and vertical targets are 0
    if err == 0: continue
    n = 1 + (|err| > 2) + (|err| > 4) + (|err| > 8) + (|err| > 16)
    if extra_thrust > 0 and |err| > 32:   // up to 3 units used per step, one per axis
        n = n + 1
        extra_thrust = extra_thrust - 1   // stock was scaled by k (class N), so it lasts as long
    vel_step = vel_step + sign(err) * (2^(n - 2) / k^2) * axis               // class A
// the throttle itself is kept in original units (wanted), ramped by 8 / k per step
// (that is 8 / k^2 per step in per-step units); extra_thrust stays a whole number,
// so the "!= 0" and "> 0" tests agree as in the original

Periods written as "every 64th frame" (g_frame_count & 63 == 0) become "every round(64 k)th step"; "every odd frame" (Guardian) becomes "every round(2 k)th step". The phase (which step of the period) is free. Keep the first event at the same time after the flight starts as in the original (frame 64 for aliens, frame 128 for satellites).

Every constant, classified

ConstantValueSourceClass
Your ship
throttle limits+144, −112 units per framesrc/control.cV
throttle step±8 per framesrc/control.cA
extra thrust: wanted speed × 2×2src/control.c(ratio, unchanged)
controller error bands2, 4, 8, 16, 32 units per framesrc/control.cV (compared in original units)
controller corrections0.5, 1, 2, 4, 8, 16 per framesrc/control.cA
extra thrust stock+1,024 per pick-up (single player, at most 4,096); set to 1,024 (multiplayer); −1 per axis with a hard correction, so up to 3 per framesrc/satellite.c, src/control.cN (stock × k, −1 per step and axis)
keyboard turn limit, ramp, decay24; 2; 2src/control.cΩ; α; α
mouse gains and dead zonedy ÷ 4, dx ÷ 8; zero band 8 pixelssrc/control.cG; L (pixels)
tumble length; start rates; decay48 frames; pitch and roll ±48 (a coin toss each), yaw 0; 1 per framesrc/players.c, src/control.cN; Ω; α
bump immunity8 framessrc/players.cN
collision push64 units per framesrc/players.cV
fire cooldownevery 3rd frame while heldsrc/control.cN
cloak time512 frames, −1 per frame while onsrc/satellite.c, src/control.cN
death input delay64 framessrc/aliens.c, src/missiles.c, src/net.cN
respawn offset; start corners1,024 along "up"; 2,048 apartsrc/screens.c, src/players.cL
Lasers
shot speed (yours: plus your velocity)1,024 units per framesrc/shots.c, src/pods.cV
shot life; hit ring24 frames; 7 framessrc/shots.c, src/pods.cN
shot start offset64 units along "up"src/shots.cL
your shot's box±512 forward, ±192 sideways (model scale 1)src/shots.cL
alien shot's box±1,024 along right, ±256 forward and upsrc/pods.cL
shots in flight8 yours, 8 for all alienssrc/shots.c, src/pods.cC
alien fire periodsFighter every 4th, Guardian every 2nd, mutant every frame while aimedsrc/aliens.cN
fire power64 powered shots per pick-up (at most 256)src/satellite.cC
Aliens, missiles, pods (single player)
alien speeds (stored)Pirate 500–1,000, Fighter 700, Guardian 1,100, Commander 900src/tables.c, src/main.cV
speed changes+50 / −50 (Pirate), −100 (Commander, Guardian), accel 50 (mutant, kind-2 missile), 100 (your missile)src/aliens.c, src/steer.cA
braking floor200 (stored)src/steer.cV
turn limits24, 32 (aliens); 8, 32 (alien missiles); 128 (your missiles, pods)src/tables.c, src/aliens.c, src/pods.cΩ
steering ratefloor(dot ÷ 128) (arithmetic shift); a result of 0 becomes +1, −1 stays; clamped to ±max_turnsrc/steer.cG
aim cones; distance bands±0x80, ±0x100; exponents 1–7src/steer.c, src/aliens.cL
missile speed; damage; contact1,600 stored; 16 hit points; exponent ≥ 6src/aliens.c, src/missiles.cV; C; L
alien spawn period; spawn offset64 frames; 16,384 units to the sidesrc/main.c, src/aliens.cN; L
explosion length64 framessrc/aliens.c, src/missiles.c, src/pods.cN
pod spin; return speed; home32 per frame; 200 stored; exponent ≥ 7src/pods.cΩ; V; L
Pirate escape; missile expiryexponent < 0 (32,768 units)src/aliens.c, src/missiles.cL
crosshair window0xC0 · 2esrc/aliens.cL
Satellites, messages, network, screens
satellite spawn period; area; spin; expiry128 frames; ±10,000; 32 per frame; exponent < −1src/main.c, src/satellite.cN; L; Ω; L
message times16, 32, 48, 64 framessrc/aliens.c, src/satellite.c, src/players.c, src/net.cN
peer absent after4 frames without a packetsrc/net.cN (Modern: a time)
wait for peersthe frame ends by the 5th tick after its startsrc/net.cT
lobby slot heard32 lobby framessrc/net.cN (of the 70.09 rate)
level intro roll; menu spin−16; 32 per refreshsrc/screens.c, src/players.cΩ (of the 70.09 rate)
attract screens switch200 tickssrc/screens.cT
soundone table entry per ticksrc/sound.asmT

Why naive scaling still changes the game

Dividing every speed by k keeps the speeds in seconds right, but some things cannot be kept by scaling numbers:

  1. Discrete hit tests. At k = 3.2955 your shot moves 310.7 units per step (354.4 at full throttle): far less than the 1,025-unit box, so it can never tunnel; and its first test is 311 units ahead with the box reaching 512 back, so the blind spot disappears. The alien shot moves 310.7 per step against a 513-unit box: no pass-through, and its blind spot shrinks from 768 to about 55 units. Aliens become more dangerous and you become more accurate. The same holds for the contact test of ramming (A10) and for missile contact.
  2. Tunnelling probabilities are not a smooth function of k. The skip chance of your laser is (s − 1025) ÷ s, where s is the shot's displacement per step relative to the target, and 0 once s ≤ 1,025. For a target at rest s = (1024 + your speed) ÷ k: at full throttle 12.2 % at k = 1 and 0 for every k above 1168 ÷ 1025 = 1.14; with extra thrust 21.9 % at k = 1 and 0 above 1312 ÷ 1025 = 1.28. A target flying toward the shot raises s, one flying away lowers it. You cannot "scale" a 1-in-8 chance: it is either there or not. Keeping it at a faster rate would mean testing only at the original frame instants, which works only when k is a whole number.
  3. Controller dynamics. The velocity controller corrects in power-of-two steps chosen from the error. With k times more, k² times smaller corrections it reacts sooner and settles more smoothly: the speed trails the throttle by a different amount and the small wobble around the target changes. Alien steering is a proportional turn of floor(dot ÷ 128) per frame, where a result of 0 becomes +1 (so it never stops turning); at finer steps aliens overshoot less, so they line up with you sooner, are "aimed" on more steps, and their aim cone tests (±0x80) are sampled more finely. Missiles hit sooner after a turn.
  4. Integer rounding. The original's rules are whole numbers: a throttle step of 8, a ramp of 2, rates up to 24. At k = 3.2955 they become 0.7366, 0.1842 and 7.283. A rebuild must keep fractions (floating point); rounding to integers would change the limits (24 ÷ 3.2955 rounds to 7, a 4 % slower turn) or freeze ramps entirely (0.18 rounds to 0). Durations rounded to whole steps are off by up to half a step (fire every 9.886 → 10 steps: 1 % slower fire).
  5. Order and sampling. Within a frame the ship turns pitch, then roll, then yaw; more, smaller turns follow a slightly different path. Periodic alien fire ("aimed and frame divisible by 4") samples the aim at different moments. Each machine's collision test in multiplayer sees positions fresher by a fraction of a frame.
  6. Multiplayer and menu timing. Rules counted in frames mean different times at different rates. The lobby shows a slot as Free 32 lobby frames after its last packet: 0.46 s at 70 frames per second, 1.76 s at 18.2. The 4-frame liveness rule is an exception in practice: each of those frames waits for the missing peer until the 5th tick, so it takes about 1 s at any rate D. Modern replaces it with a time anyway (D11).
  7. Sound against frames. Sound is in ticks; firing is in frames. The held-fire warble (F1) depends on how many ticks lie between two shots: 3 ticks at 18.2 frames per second, under one at 70. Converting the fire period as class N keeps it in seconds, so the sound stays as in single player.
What will differ after a conversion (summary)

Everything in classes V, A, Ω, α, N, G is the same in seconds; everything in L, C, T is the same as before. Different are: hits that the original misses (A1–A4, A10 disappear without an option to keep them), the controller's fine behaviour (speed lag, alien aim), small rounding of every frame count, the Shift+Ctrl pattern at full throttle (B3), and every effect of the frame order. Tests that pin these (chapter 21) will fail by design and must be listed as known differences.

Recommendation

For a rebuild
  1. Keep the per-frame rules and the original rates. Single player steps at exactly 18.2065 per second. Multiplayer steps at one fixed rate that every peer in the session agrees on (it travels in the hello message, chapter 18): 70 by default, which is how the original ran in our recordings; 18.2065 is a valid choice too and gives multiplayer single-player speeds, with no conversion at all, because the per-frame rules stay as they are.
  2. Draw with interpolation. Run the simulation on a fixed clock and draw each picture between the last two steps. Tests, hits and collisions use the stepped states, never the interpolated ones (except the remote-ship rule of chapter 18).
  3. Convert only if you must (for example a platform that can only step at the display rate), using the classes above, and list the differences of the previous box in the game's notes. A converted build is neither Authentic nor Modern; call it what it is.
STEP = 1 / rate                      // 1 / 18.2065 s in single player
acc = 0; last = clock()              // start of the flight
each display frame (time now):
    acc = acc + (now - last); last = now
    n = 0
    while acc >= STEP and n < 4:     // cap the catch-up (chapter 13)
        prev = state
        // held keys are read on every step; press latches (Space, Enter,
        // keypad +/-, Esc) are handed only to the first step of this display
        // frame and then cleared, as the original clears them once read
        state = step(state, held_keys, n == 0 ? latches : none)
        acc = acc - STEP; n = n + 1
    if n == 4 and acc >= STEP: acc = 0   // drop the rest after a long pause
    alpha = acc / STEP               // 0 .. 1
    draw(interpolate(prev, state, alpha))
// interpolate: positions linearly; axes blended, renormalised and made
// perpendicular with cross products in the original order (forward, right, up)