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
Authentic NetWars reproduces the behaviour of NetWars 2.06 as the reconstructed source describes it, bugs included, at the original step rates:
- 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).
- 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).
- Multiplayer: at most 70.09 steps per second, and each step waits for a packet from every
live peer, exactly as
net_sync_framedoes (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. - 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).
- Every behaviour in the table below with "keep" in the Authentic column.
- 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.
- 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
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":
- fix: the behaviour breaks play or the network (a hit counted many times, two players in one slot, a tilted start, a stalled game). Modern always applies the fix; it is not an option.
- option: an oddity that some players like and others do not (tunnelling lasers, the axis-aligned collision push, the painter's sort errors). Modern has a default for each, written in the table; the player may change it (rules for options below).
- keep: the behaviour is part of how NetWars plays. Modern keeps it exactly as Authentic does.
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.
- keep: Modern behaves as the original.
- fix: Modern always applies the change in the last column.
- option (keep): a player can switch the change on; by default Modern behaves as the original.
- option (fix): a player can switch the change off; by default Modern applies it.
A. Combat and collisions
| # | Behaviour | Cause | Authentic | Modern | Exact change for Modern |
|---|---|---|---|---|---|
| A1 | Your laser skips over a target: about 1 in 8 shots at full throttle, 1 in 4–5 with extra thrust D | the 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) | keep | option (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. |
| A2 | Your 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. |
| A3 | Alien lasers pass through you about half the time when aimed straight at you O / D | alien shot box 513 units deep, step
1,024 (ch. 6, alien_shots_update) | keep | option (keep): same switch as A1 | When on: alien shots use n = ⌈L ÷ 512⌉ parts per move. |
| A4 | Aliens cannot hit you within about 768 units in front of them D | alien shot moves before its first test | keep | option (keep): same switch as A2 | When on: test an alien shot once at its start position in the frame it is fired. |
| A5 | Your shots are tested against where the aliens were at the end of the previous frame | frame order: player shots before aliens (ch. 2, 6) | keep | keep | — |
| A6 | Extra damage against aliens follows your fire-power stock at the moment of the hit, not the shot O | player_shots_update tests g_fire_power > 0, not the
shot's powered bit (ch. 6) | keep | option (keep) | When changed: damage 2 if the shot's own powered flag (state bit 0x100) is set, else 1. |
| A7 | Missile lock works far outside the view (a beam ±0xC0 · 2e, no view test) O | aliens_update marks "targeted" with cam_z > 0
only (ch. 6) | keep | keep | — (a rule players learn) |
| A8 | A missile homes on the first locked alien in slot order, not the nearest | loop in player_fire_missile | keep | keep | — |
| A9 | Nearness is a cube: contacts reach about 1.7 times farther along diagonals | distance exponent tests the largest coordinate (ch. 3) | keep | keep | — |
| A10 | A 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 D | contact tested once per frame
(render_object, exponent ≥ 7) | keep | keep | — |
| A11 | Ramming an alien scores nothing and costs a shield | aliens_update |
keep | keep | — |
| A12 | Aliens' lasers, missiles and rams no longer count once your shields are 0 | g_shields > 0 tests | keep | keep | — |
| A13 | Collision push along a fixed world axis per slot (+z in single player), whatever you hit O | player_bump copies g_vel_presets[slot]
(ch. 4) | keep | option (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). |
| A14 | An alien missile hit gives no bump and ignores bump immunity | enemy_missiles_update | keep | keep | — |
| A15 | No satellite pick-up for 8 frames after a bump | render_object
reports contact only with immunity 0 | keep | keep | — |
B. Motion
| # | Behaviour | Cause | Authentic | Modern | Exact change for Modern |
|---|---|---|---|---|---|
| B1 | Drift below one unit per frame in a positive direction is never corrected | the velocity is measured in whole units, rounded down (ch. 4) | keep | option (keep) | When changed: measure the body-axis velocity without rounding and correct any non-zero error (same step table). |
| B2 | Single-player levels start with the view rolled by an unpredictable angle (about 180° in run #35) O | level_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) | fix | When 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. |
| B3 | Shift and Ctrl held together at the top limit turn 144 into 136 | order of the two throttle tests (ch. 4) | keep | keep | — |
| B4 | The left-Ctrl test is written twice; right Ctrl brakes too | player_update, keyboard handler (ch. 11) | keep | keep | — (map both Ctrl keys) |
| B5 | A dead ship keeps its velocity but does not move | early return in
player_update | keep | keep | — |
| B6 | Cross 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 effect | Floating point, exact normalisation: the difference is invisible, so this is not an option. |
C. Single-player rules
| # | Behaviour | Cause | Authentic | Modern | Exact change for Modern |
|---|---|---|---|---|---|
| C1 | An escaped Pirate counts as destroyed; a level can end while pods are carried off | ai_abductor decrements g_aliens_left (ch. 7) | keep | keep | — |
| C2 | A Pirate's escape is measured from you (more than 32,768 units on the largest axis) | exponent < 0 (ch. 7) | keep | keep | — |
| C3 | A new alien keeps the dead alien's orientation | slots are reset only at
level start (aliens_clear) | keep | keep | — |
| C4 | Tapping fires faster than holding | release clears the cooldown (ch. 6) | keep | keep | — |
| C5 | Esc on "Level completed" keeps the score; Esc in flight sets it to 0 | ch. 11 | keep | keep | — |
| C6 | The score wraps: above 1,000,000 it drops by 1,000,000 | add_score
(src/screens.c) | keep | option (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). |
| C7 | The level bonus shown on screen wraps from level 33 (the added bonus is right) | (level+1)*1000 formatted as a 16-bit int | keep | fix | Format the shown value as a 32-bit number. |
| C8 | An 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_update | keep | keep | — |
| C9 | A pod is removed at explosion age ≥ 64, aliens and missiles at > 64 | pods_update | keep | keep | — |
| C10 | A missile's explosion is drawn in the frame it hits (its slot is processed twice) | i-- in player_missiles_update | keep | keep | — |
| C11 | Guardians always head for the world origin | g_rally_point is
never written | keep | keep | — |
| C12 | The satellite cycle continues across games of a session | g_satellite_counter is never reset | keep | keep | — |
D. Multiplayer and network
| # | Behaviour | Cause | Authentic | Modern | Exact change for Modern |
|---|---|---|---|---|---|
| D1 | Repeated 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) | keep | fix | Apply hit and satellite events only once: either only from packets that arrived since the last step, or by event id (chapter 18). |
| D2 | The same after the shooter presses Esc right after a hit | the name screen keeps sending the last event record | keep | fix | As D1, and clear the outgoing event record when leaving the flight. |
| D3 | Hit reports still land on a player who is already dead | no shield test
in net_sync_frame | keep | fix | Ignore hit events while my shields are 0. |
| D4 | A stale "your satellite was taken / shot" event is applied every frame | same buffer as D1 (satellite_update) | keep | fix | As D1. |
| D5 | Taking 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 | keep | fix | Give 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). |
| D5b | While 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 events | keep | fix | The owner drops its satellite when it leaves flight (chapter 18). |
| D6 | Two players can take the same satellite in the same moment and both get it D | each machine decides its own pick-ups | keep | keep | — (a design proposal for an owner-confirmed pick-up is possible but changes the feel: the reward would arrive a round trip later) |
| D7 | Two players in one slot when both take it within a frame or two | no claim message in the lobby (ch. 8) | keep | fix | Claim slots with a message and arbitrate (chapter 18). |
| D8 | Hits merge or get lost: one hit word per victim per frame; a packet not sent (previous send busy) or not received is gone | the event record has 5 words (3 hit words, one per victim; the status word; the satellite event word), sent once, never repeated (ch. 8) | keep | fix | Send 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). |
| D9 | Collisions disagree: each machine judges its own from slightly old positions | "collisions judged locally" (ch. 8) | keep | keep | — (design of the game) |
| D10 | A vanished player slows everyone: each frame lasts until the 5th tick after its start, for 4 frames (about 1 s of stutter) O | net_sync_frame
wait | keep | fix | Fixed step clock; never wait for peers; show remote ships from their latest state. |
| D11 | A 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 wait | keep | fix | Drop a peer after about 1 second without a message, measured as a time. This keeps the original's real timing without the stutter. |
| D12 | The 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). |
| D13 | Another player's shot explosion lasts until that player frees the slot; a powered copy counts 0x118 frames | remote_shots_update | keep | fix | A copy's explosion lasts 7 steps, like the shooter's own; the copy is computed from the shot record (chapter 18). |
| D14 | A cloaked ship still shows on everyone's radar and can be hit | cloak changes only the status word (ch. 8) | keep | keep | — |
E. Drawing
| # | Behaviour | Cause | Authentic | Modern | Exact change for Modern |
|---|---|---|---|---|---|
| E1 | Faces sometimes painted in the wrong order | painter's sort with one depth per face, its farthest vertex (ch. 9) | keep | option (fix): "depth buffer" | When on: draw with a per-pixel depth buffer; the draw order no longer matters. |
| E2 | No clipping at the near plane: close faces vanish whole | ch. 9 | keep | option (fix): same switch as E1 | When on: clip faces against a near plane (e.g. 1 unit in front of the eye) instead of dropping them. |
| E3 | Explosion sparks sorted as if twice as far; drawn over everything at 16,384–32,768 units; not drawn beyond | spark depth rules (ch. 9) | keep | option (fix): same switch as E1 | When on: sparks at their true depth; drawn up to the explosion's normal limit. |
| E4 | Discs (shots, sparks) drawn 4/3 too large | ch. 9 | keep | keep | — (part of the look) |
| E5 | A big object near the top or bottom edge vanishes whole | "in view" test on the centre only (ch. 9) | keep | option (fix) | When fixed: test the model's bounding sphere against the view. |
| E6 | Mouse cursor race can corrupt the font or crash | ch. 12 | not reproduced | not reproduced | — |
F. Sound
| # | Behaviour | Cause | Authentic | Modern | Exact change for Modern |
|---|---|---|---|---|---|
| F1 | Held fire warbles (single player) or buzzes on one 233 Hz tone (multiplayer) D/O | each 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) | keep | option (keep): "whole pews" | When on: a shot starts the laser effect only if no laser effect is playing. |
| F2 | An explosion can be cut before it is heard | a new effect replaces the running one | keep | keep | — |
| F3 | Choosing "None" while a tone sounds leaves it sounding | the tick handler stops, the speaker stays on | keep | fix | Silence the oscillator when sound is switched off. |
| F4 | The hit sound repeats every frame during a repeated hit | D1 | keep | fixed with D1 | — |
G. Input, menus and screens
| # | Behaviour | Cause | Authentic | Modern | Exact change for Modern |
|---|---|---|---|---|---|
| G1 | Space, Caps Lock or keypad +/− pressed on the level introduction act in the first frame of the flight | only Esc and Enter latches are cleared (ch. 11) | keep | fix | At the start of every flight, clear every latch whose key is not held now. |
| G2 | Each 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_h | keep | fix | Popup height = 12 × number of items, recomputed, not added. |
| G3 | A hidden spot at the lobby's left edge makes you a spectator O | loop reads one entry past the slot positions | keep | fix | Remove the spot; spectate through the menu item. |
| G4 | The click that closes the help page stays latched | ch. 11 | keep | fix | Clear the click when the help page closes. |
| G5 | The name editor starts at length 0 whatever name is there | name_entry_screen | keep | option (fix) | When fixed: start editing at the end of the current name. |
| G6 | A mouse setting without a mouse leaves you unable to steer | ch. 11 | keep | fix | Offer only devices that are present. |
| G7 | F2 pause shows no text and ends by itself on key repeat | ch. 11 | keep | fix | Toggle on key-down without repeats; show "PAUSED" (design proposal). |
| G8 | Reversed Mouse draws the pointer mirrored, moving against your hand | ch. 11 | keep | keep | — |
| G9 | The mouse handler stays active after you choose Keyboard | the handler is installed at start and never removed until exit (ch. 12) | keep | fix | Ignore pointer events while Keyboard is chosen. |
| G10 | Alt is always taken by the game and never used (blocks Ctrl+Alt+Del) D | keyboard handler (ch. 11) | keep where a page can | fix | Do not capture Alt. |
| G11 | The Pause key does nothing in flight; in menus the BIOS's own pause applies D | src/input_math.asm (ch. 12) | keep | keep | — (F2 is the pause key) |
H. Timing
| # | Behaviour | Cause | Authentic | Modern | Exact change for Modern |
|---|---|---|---|---|---|
| H1 | Menus, the level introduction and the level-complete screen animate at the refresh rate (about 70 per second), not at 18.2 | those loops wait only for the retrace
(flip_pages) | keep (70.09) | keep | — (B2 removes the only effect on play) |
| H2 | Multiplayer runs about 3.85 times as fast as single player (same per-frame numbers, more frames) D | see Part 2 | keep | keep by default | — (the session's step rate is a choice, Part 2) |
| H3 | On a slow machine single player slows down | a frame longer than a tick is not compensated | not reproduced | not reproduced | — |
Options: how to expose them
- 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. - 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.
- 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.
- 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.
- 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).
- 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:
- Authentic must pass every reference test, including the ones that pin a bug: a shot that tunnels through a target at full throttle, a target at 400 units that cannot be hit, a silent shooter whose hit takes 20 shields in 20 frames, the camera roll after a given number of introduction frames, the score wrap, the popup growth.
- Modern must pass the same tests except those whose row says "fix" or whose option is changed, and each fix has its own test showing the new behaviour.
- The step clock is tested too: 60 seconds of single player give 1,092 steps (18.2065 × 60); 60 seconds of multiplayer at the chosen rate give that rate × 60.
- The helpers that must match the original bit for bit (distance exponent, dot products of
whole-unit vectors, the box tests) are compared with the original code run in an emulator
(
tools/doccheck/, chapter 13). - Runs with recorded inputs and the same random seed must give the same states every time;
a per-step hash of the state makes differences easy to find. Identical runs against the original
also need its random number generator, Borland C++ 2.0's
rand()O (docs/simulation.md §11):
The game seeds it withsrand(s): seed = s // s is 16 bits; the high word of the 32-bit seed becomes 0 rand(): seed = (seed * 0x015A4E35 + 1) mod 2^32 return (seed >> 16) & 0x7FFFsrand((unsigned)time(0))at start (src/main.c), so a reference run must force a known seed.
Part 2. Units and step rates
The units again
| Quantity | Unit | Example |
|---|---|---|
| distance | world unit (the middle word of a 64-bit coordinate, chapter 3) | pods 1,000 units from the centre |
| direction | Q14 axes (16384 = 1.0) | forward (0, 0, 16384) |
| angle | steps of 1/2048 turn (0.176°) | keyboard turn rate up to 24 |
| ship and shot speed | units per frame | throttle up to 144 |
| alien, missile and pod speed | the stored number ÷ 4 = units per frame | Guardian 1,100 → 275 units per frame |
| time | frames (most rules) or timer ticks (sound, network wait, attract screens) | tumble 48 frames; network wait 5 ticks |
The original rates
| Where | Rate | Why | Mark |
|---|---|---|---|
| single-player flight | 18.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 tick | O (code) / D (exactly one) |
| multiplayer flight | about 70 per second in our runs | frames 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 60000 | O (DOSBox-X) |
| menus, intro, level complete, lobby, name screen | about 70 per second | refresh only; the level intro's ~705 frames in ~10 s (run #35) | O (DOSBox-X) |
| sound, network wait, attract screens | 18.2065 ticks per second | timer interrupt | O |
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 frame | Single player, 18.2/s | Multiplayer, 70/s |
|---|---|---|---|
top speed, throttle 144 (player_update) | 144 units | 2,622 units/s | 10,080 units/s |
| with extra thrust (288) | 288 | 5,243 | 20,160 |
| reverse, throttle −112 | 112 | 2,039 | 7,840 |
| throttle ramp +8 per frame, 0 → 144 | 18 frames | 0.99 s | 0.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°) | 24 | 77°/s | 295°/s |
| keyboard turn ramp 2 per frame, 0 → 24 | 12 frames | 0.66 s | 0.17 s |
| mouse turn rate: pitch up to about 35 (6.15°), yaw about 33 (5.80°) | 35 / 33 | 112 / 106°/s | 431 / 406°/s |
| laser shot speed (beyond your own) | 1,024 units | 18,643 units/s | 71,680 units/s |
laser shot life (player_fire) | 24 frames | 1.32 s | 0.34 s |
| fire while held: every 3rd frame | 3 frames | 6.1 shots/s | 23.3 shots/s |
collision push (player_bump) | 64 units | 1,165 units/s | 4,480 units/s |
| bump immunity | 8 frames | 0.44 s | 0.11 s |
| tumble (decay 1 per frame from ±48) | 48 frames | 2.64 s | 0.69 s |
| "COLLISION" message | 48 frames | 2.64 s | 0.69 s |
death text before input counts (player_dead_screen) | 64 frames | 3.52 s | 0.91 s |
| explosion length | 64 frames | 3.52 s | 0.91 s |
satellite spawn period (main) | 128 frames | 7.03 s | 1.83 s |
| pick-up message | 32 frames | 1.76 s | 0.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 period | 64 frames | 3.52 s | — |
| alien speeds 125 to 275 units (Pirate 125–250, Fighter 175, Commander 225, Guardian 275) | 125–275 | 2,276–5,007 units/s | — |
| missile speed (stored 1,600) | 400 units | 7,283 units/s | — |
| alien turn rates 24 / 32; missiles 8, 32, 128 | 4.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 / 1 | 4.6 / 9.1 / 18.2 shots/s | — |
| warning messages ("MISSILE LAUNCH", "No Target") | 16 frames | 0.88 s | — |
| a sound table entry | 1 tick, not a frame | 55 ms | 55 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:
- laser range: 1,024 units × 24 frames = 24,576 units beyond your own drift, at any rate (24 × 1,168 = 28,032 units in all when you fly at full throttle);
- drift during a tumble: 64 units × 48 frames ≈ 3,000 units;
- a tumble's total turn: 47 + 46 + … + 1 = 1,128 steps ≈ 198° in pitch and the same in roll (each ±48 by its own coin toss; yaw is 0);
- the speed lag of the velocity controller: about 10 units per frame behind the throttle.
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.
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.
| Class | What it is | Rule | Example at k = 3.2955 |
|---|---|---|---|
| V | distance per frame (a speed) | divide by k | throttle limit 144 → 43.70 units per step |
| A | change 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 k | keyboard 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 |
| N | a number of frames: a period, a lifetime, a timer | convert 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 |
| G | a 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 |
| L | a distance, angle or exponent that does not involve time (hit boxes, thresholds, positions, cones, ranges) | unchanged | box ±512; spawn offset 16,384; contact exponent ≥ 7; cone ±0x80 |
| C | a count of things (hit points, shields, missiles, powered shots, points) | unchanged | 16 missiles; fire power 64 shots |
| E | an event per key press (latches) | unchanged: once per press | Enter / Caps Lock (missile or cloak toggle), keypad +/− (radar zoom), Esc, F2 |
| T | already measured in timer ticks or seconds | unchanged | sound 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
| Constant | Value | Source | Class |
|---|---|---|---|
| Your ship | |||
| throttle limits | +144, −112 units per frame | src/control.c | V |
| throttle step | ±8 per frame | src/control.c | A |
| extra thrust: wanted speed × 2 | ×2 | src/control.c | (ratio, unchanged) |
| controller error bands | 2, 4, 8, 16, 32 units per frame | src/control.c | V (compared in original units) |
| controller corrections | 0.5, 1, 2, 4, 8, 16 per frame | src/control.c | A |
| 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 frame | src/satellite.c, src/control.c | N (stock × k, −1 per step and axis) |
| keyboard turn limit, ramp, decay | 24; 2; 2 | src/control.c | Ω; α; α |
| mouse gains and dead zone | dy ÷ 4, dx ÷ 8; zero band 8 pixels | src/control.c | G; L (pixels) |
| tumble length; start rates; decay | 48 frames; pitch and roll ±48 (a coin toss each), yaw 0; 1 per frame | src/players.c, src/control.c | N; Ω; α |
| bump immunity | 8 frames | src/players.c | N |
| collision push | 64 units per frame | src/players.c | V |
| fire cooldown | every 3rd frame while held | src/control.c | N |
| cloak time | 512 frames, −1 per frame while on | src/satellite.c, src/control.c | N |
| death input delay | 64 frames | src/aliens.c, src/missiles.c, src/net.c | N |
| respawn offset; start corners | 1,024 along "up"; 2,048 apart | src/screens.c, src/players.c | L |
| Lasers | |||
| shot speed (yours: plus your velocity) | 1,024 units per frame | src/shots.c, src/pods.c | V |
| shot life; hit ring | 24 frames; 7 frames | src/shots.c, src/pods.c | N |
| shot start offset | 64 units along "up" | src/shots.c | L |
| your shot's box | ±512 forward, ±192 sideways (model scale 1) | src/shots.c | L |
| alien shot's box | ±1,024 along right, ±256 forward and up | src/pods.c | L |
| shots in flight | 8 yours, 8 for all aliens | src/shots.c, src/pods.c | C |
| alien fire periods | Fighter every 4th, Guardian every 2nd, mutant every frame while aimed | src/aliens.c | N |
| fire power | 64 powered shots per pick-up (at most 256) | src/satellite.c | C |
| Aliens, missiles, pods (single player) | |||
| alien speeds (stored) | Pirate 500–1,000, Fighter 700, Guardian 1,100, Commander 900 | src/tables.c, src/main.c | V |
| speed changes | +50 / −50 (Pirate), −100 (Commander, Guardian), accel 50 (mutant, kind-2 missile), 100 (your missile) | src/aliens.c, src/steer.c | A |
| braking floor | 200 (stored) | src/steer.c | V |
| turn limits | 24, 32 (aliens); 8, 32 (alien missiles); 128 (your missiles, pods) | src/tables.c, src/aliens.c, src/pods.c | Ω |
| steering rate | floor(dot ÷ 128) (arithmetic shift); a result of 0 becomes +1, −1 stays; clamped to ±max_turn | src/steer.c | G |
| aim cones; distance bands | ±0x80, ±0x100; exponents 1–7 | src/steer.c, src/aliens.c | L |
| missile speed; damage; contact | 1,600 stored; 16 hit points; exponent ≥ 6 | src/aliens.c, src/missiles.c | V; C; L |
| alien spawn period; spawn offset | 64 frames; 16,384 units to the side | src/main.c, src/aliens.c | N; L |
| explosion length | 64 frames | src/aliens.c, src/missiles.c, src/pods.c | N |
| pod spin; return speed; home | 32 per frame; 200 stored; exponent ≥ 7 | src/pods.c | Ω; V; L |
| Pirate escape; missile expiry | exponent < 0 (32,768 units) | src/aliens.c, src/missiles.c | L |
| crosshair window | 0xC0 · 2e | src/aliens.c | L |
| Satellites, messages, network, screens | |||
| satellite spawn period; area; spin; expiry | 128 frames; ±10,000; 32 per frame; exponent < −1 | src/main.c, src/satellite.c | N; L; Ω; L |
| message times | 16, 32, 48, 64 frames | src/aliens.c, src/satellite.c, src/players.c, src/net.c | N |
| peer absent after | 4 frames without a packet | src/net.c | N (Modern: a time) |
| wait for peers | the frame ends by the 5th tick after its start | src/net.c | T |
| lobby slot heard | 32 lobby frames | src/net.c | N (of the 70.09 rate) |
| level intro roll; menu spin | −16; 32 per refresh | src/screens.c, src/players.c | Ω (of the 70.09 rate) |
| attract screens switch | 200 ticks | src/screens.c | T |
| sound | one table entry per tick | src/sound.asm | T |
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:
- 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.
- 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.
- 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.
- 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).
- 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.
- 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).
- 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.
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
- 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.
- 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).
- 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)