How NetWars Works Chapter 15 of 21, plus appendices

15. Radar, cockpit instruments and messages

Everything drawn on top of the 3-D view, specified to the pixel: where each instrument sits on the 640 × 350 screen, which line is drawn from where to where in which colour, how a value becomes a bar length, how a position in space becomes a radar blip (with the original integer arithmetic, and a demo that runs it), and every message that can appear during flight: its text, its trigger, its place and how many frames it stays.

Chapter 1 shows what the instruments mean to a player, chapter 9 how the 3-D picture under them is made. This chapter is the reference a rebuild draws from. Words used here: a frame is one pass of the main loop (18.2 per second in single player, about 70 per second in our multiplayer measurements, chapter 2); a world unit is the middle word of a 64-bit coordinate (chapter 3); Q14 numbers have 16384 = 1.0; the camera axes are a (forward), b (right) and c (c points toward the bottom of the screen; the source calls it "up", chapter 3).

Screen coordinates and drawing order

The screen is EGA mode 10h: 640 × 350 pixels, 16 colours, pixels about 1.37 times as tall as wide (chapter 9). All overlay drawing uses coordinates relative to the screen centre (320, 175): x to the right, y downward. To get the screen pixel, add 320 to x and 175 to y. In this chapter "rel" means centre-relative and "screen" means absolute pixels; every table gives both where it helps.

The drawing tools are few (src/graphics.asm):

Exact rules: text placement

For draw_text(x, y, colour, s, centre) (rel coordinates):

column = (x + 320) >> 3                  // x is rounded DOWN to a multiple of 8
if centre: column = column - ((min(strlen(s), 80) + 1) >> 1)   // the length scan stops after 80
left pixel = column * 8;  top row = y + 175;  each character 8 x 8, next character 8 pixels right
'_' moves back one column first (it underlines the letter before it; no flight text uses it)

Example: "COLLISION" (9 characters) centred at x = 0: column 40 − 5 = 35, so it covers screen x 280..351. A centred text is therefore half a character left of true centre when its length is odd. No clipping: a text that runs off the right edge continues on the next row's left side D (no flight text is long enough to do so).

What is drawn, in which order, every frame

The whole page is redrawn every frame from an empty background (chapter 2), so every instrument is updated every frame, at the frame rate. Within a frame, later items cover earlier ones (main, src/main.c):

#StepCondition
1Clear the page to the flash colour (normally 0 black; see "Hit flash")always
2Simulation; very far objects are drawn at once as white pluses (chapter 9)always
3Stars, then the sorted 3-D draw listalways
4Score textnot spectating
5Radar (grid, then blips)shields > 0
6Instruments (draw_hud): sight, mouse marks, V gauge, S gauge, velocity indicator, status linesshields > 0
7The current message, then its frame counter − 1shields > 0 and counter > 0
5′Instead of 5–7: the death textshields = 0

The mouse pointer (in flight a small 8 × 8 box in colour 15) is not part of this: it is drawn directly onto the page being shown, between frames (chapter 9).

Screen layout

The positions come from fixed variables (src/globals.c); nothing moves them during flight.

ElementAnchor variableAnchor, relAnchor, screenOccupies (screen)
Sight(screen centre)(0, 0)(320, 175)x 272..368, y 135..215
Radar centreg_radar_cx/cy(232, 110)(552, 285)grid x 472..632, y 257..317
Velocity gauge "V" (zero mark)g_vgauge_x/y(−288, 118)(32, 293)x 6..48, y 221..349
Shield gauge "S" (top of scale)g_sgauge_x/y(−240, 46)(80, 221)x 54..96, y 221..349
Velocity indicator (centre)g_attitude_x/y(−232, −100)(88, 75)x 16..160, y 11..139
Score and status linesg_score_x/y(160, −160)(480, 15)x 480..608, y 15..~76
Message line(fixed)(0, −80), centredrow 95y 95..102
Death text(fixed)(0, 0) and (0, 32), centredrows 175, 207y 175..182, 207..214
SCORE: 1250 MISSILES: 16 EXTRA FIRE POWER COLLISION velocity indicator (88, 75) Polygons mode only sight (320, 175) message line, row 95 V gauge: zero at row 293 S gauge: base at row 349 radar, centre (552, 285) score + status lines from (480, 15)
The flight screen drawn from the code's coordinates (single player, no target, throttle 0x60 and body velocity (40, −20, 96), shields 20, extra fire power 0x50, one alien and one pod on the radar at zoom 2). Colours are the original EGA ones. The picture is 640 × 350 with square pixels, so it looks flatter than the real screen.

Colours

All instruments use colour roles, entries of a 12-word table (g_colors), so that the /M switch can make everything grey. The game never changes the EGA palette, so the colours are the standard ones.

RoleUsed for hereColourRGB/M
[0] frameradar grid, gauge scales, velocity indicator axes, V and S4 red#AA00008
[1] HUDplain sight, mouse marks, score, status texts, death text12 light red#FF55557
[2] HUD highlightlocked sight, gauge bars, indicator lines, status bars, messages10 light green#55FF5515
[3] alienalien blips10 light green#55FF557
[4] enemy missileenemy missile blips14 yellow#FFFF5515
[5] satellitesatellite blips (own and other players')15 white#FFFFFF15
[6] podpod blips13 light magenta#FF55FF7
[7] collision flashbackground after a collision10 light green#55FF557
[8] hit flashbackground after a hit12 light red#FF55557
[9] powered-hit flashbackground after a powered hit (multiplayer)14 yellow#FFFF5515
player blipsother players' ships: slots 1–2 / 3–410 / 9 light blue#55FF55 / #5555FF7

The player colours are set when a multiplayer session starts (net_start_session, src/net.c): a ship's colour depends on its slot only, not on who is watching. Roles [10] and [11] are the title logo's.

The radar

The radar (draw_radar and radar_blip, src/radar.c) is a small picture of the plane of your ship's wings, seen from behind and above. Objects ahead of you appear above the centre, objects behind you below it; left is left. Each object is a vertical stalk standing on that plane and a 5-pixel plus at the object's end of the stalk: the stalk's length and direction tell how far the object is above or below your wing plane.

Grid geometry

Ten lines in colour 4, always the same; the centre is C = (232, 110) rel = (552, 285) screen. The outline is a trapezoid: a wide near edge 32 pixels below the centre and a narrow far edge 28 pixels above it, which makes the grid look like a floor in perspective.

#LineFrom (C-relative)To (C-relative)Screen
1near (front) edge(−80, +32)(+80, +32)(472,317)–(632,317)
2far (back) edge(−50, −28)(+50, −28)(502,257)–(602,257)
3left side(−80, +32)(−50, −28)(472,317)–(502,257)
4right side(+80, +32)(+50, −28)(632,317)–(602,257)
5centre line (straight ahead)(0, +32)(0, −28)(552,317)–(552,257)
6cross line through you(−64, 0)(+64, 0)(488,285)–(616,285)
7left half line(−40, +32)(−25, −28)(512,317)–(527,257)
8right half line(+40, +32)(+25, −28)(592,317)–(577,257)
9near cross line(−72, +16)(+72, +16)(480,301)–(624,301)
10far cross line(−57, −15)(+57, −15)(495,270)–(609,270)
(−80,32)(80,32) (−50,−28)(50,−28) (−64,0)(64,0) (−72,16)(72,16) (−57,−15)(57,−15) (−40,32)(40,32) −2525 ahead ↑behind ↓ dashed: where blips of objects straight to the side / ahead / behind can reach
The radar grid, coordinates relative to its centre (y downward). The dashed box is not drawn by the game: it marks the ±64 × ±32 pixel area that blips of objects along your own axes can reach (see the cut-off below); objects in diagonal directions can land outside it.

From a position in space to a blip

The radar does no 3-D work of its own. Every frame, when an object is moved and measured for drawing (render_object, src/render.c, chapter 9), three things are stored in it, and the radar reuses them later in the same frame:

  1. Distance exponent dist_exp and direction dir: the vector from your ship to the object, in world axes, block-normalised (chapter 3): start with the exponent equal to the model's scale (1 for ships, aliens, the mutant and pods; 0 for missiles and satellites); halve the whole vector (exponent − 1) while any component is outside −16385..16384; double it (exponent + 1) while all components are inside −8192..8191, testing after each doubling whether the exponent now equals 8 and stopping if so. dir = the three middle words.
  2. Camera coordinates cam_x, cam_y, cam_z = dir dotted with the camera axes b (right), c (toward the bottom of the screen) and a (forward), with the Q14 dot product.

In short: n tells how many times the offset was doubled to fill 16 bits; the radar undoes that and then divides by 28 − zoom. Precisely: let n = dist_exp − scale. It is the number of doublings the vector got (negative: halvings), so cam = the true camera-space offset × 2n. The radar then needs only shifts:

// radar_blip(cam, n, colour) -- all values 16-bit signed integers
if n < zoom: return                      // too far for this zoom: not drawn at all
s  = n + 8 - zoom                         // 8..22
bx = cam_x >> s                           // arithmetic shift = floor division by 2^s
by = cam_y >> s                           // height off the wing plane, same downward screen axis (+ = down)
bz = cam_z >> (s + 1)                     // distance ahead, at HALF scale
x      = 232 + bx                         // rel coordinates; screen = +320, +175
plane  = 110 - bz                         // the row where the object's foot is on the plane
blip_row = 110 - bz + by                  // the row of the object itself
draw_line(x, plane, x, blip_row, colour)  // the stalk (a single pixel when by = 0)
put_plus_dot(x, blip_row, colour)         // the 5-pixel plus, only if fully on screen

Because cam is the true offset × 2n, shifting by n + 8 − zoom leaves offset ÷ 28 − zoom: one radar pixel = 28 − zoom world units sideways and vertically, and twice that ahead/behind. Every object gets the same scale, whatever its model.

Exact rules: the integer details

Worked example

An alien (scale 1) is at offset (300, −500, 2000) world units from you; your ship has the start orientation (forward = +z, right = +x, c = +y). Zoom 2.

  1. Normalise: exponent starts at 1. No component is too big. All are inside −8192..8191, so double: (600, −1000, 4000), exp 2; again (1200, −2000, 8000), exp 3; again (2400, −4000, 16000), exp 4; now 16000 ≥ 8192, stop. dir = (2400, −4000, 16000), dist_exp = 4, n = 3.
  2. Camera coordinates with the start axes: cam = (2400, −4000, 16000).
  3. n = 3 ≥ zoom 2: drawn. s = 3 + 8 − 2 = 9. bx = 2400 >> 9 = 4; by = −4000 >> 9 = −8 (−7.8 rounded down); bz = 16000 >> 10 = 15.
  4. x = 236, plane row = 110 − 15 = 95, blip row = 95 − 8 = 87 (rel). On screen: a green stalk from (556, 270) up to (556, 262) and a plus centred on (556, 262), as in the layout figure.

The same alien at zoom −1 (the start zoom): s = 3 + 8 + 1 = 12, bx = 0, by = −1, bz = 1: a two-pixel stalk (552, 284)–(552, 283) and the plus centred on (552, 283), on the centre line.

Zoom levels and the cut-off

The zoom (g_radar_zoom) is an integer from −6 to +2, 9 levels. It starts at −1 when the program starts and is never reset, not by a new game or a new level. Keypad + adds 1 (up to 2, magnifies), keypad − subtracts 1 (down to −6), one step per key make code, i.e. one per press and repeating while the key is held (keyboard auto-repeat; the keyboard handler latches every make code) D, read in the ship update (player_update, src/control.c) only during flight and even while dead.

An object is drawn only if n ≥ zoom. Working the normalisation rule backwards, that is the case exactly when every world-axis component r of the offset (in world units, with its fraction) lies in the range of the last column:

ZoomWorld units per radar pixel (sideways, height)… ahead/behindObject shown when each component r satisfies
+264128−4096 ≤ r < 4096
+1128256−8192 ≤ r < 8192
0256512−16385 ≤ r < 16385
−1 (start)5121024−32770 ≤ r < 32770
−210242048−65540 ≤ r < 65540
−320484096−131080 ≤ r < 131080
−440968192−262160 ≤ r < 262160
−5819216384−524320 ≤ r < 524320
−61638432768−1048640 ≤ r < 1048640

General form D: for zoom k ≥ 1 the range is −214−k ≤ r < 214−k; for k ≤ 0 it is −16385·2−k ≤ r < 16385·2−k (the normalisation's asymmetric limits). In radar pixels this is always about 64, so the visible region is a cube of about ±64 radar pixels: an object on one of your own axes reaches at most 64 pixels to the side, 64 pixels up or down (stalk) and 32 pixels ahead or behind on the plane. The numbers were checked by running the arithmetic (the demo's code) at the boundaries D.

Quirks of the radar

What appears on the radar

OrderObjectModeConditionn usedColour
1gridbothalways–4
2aother player's ship, peer i = 0..2 (3 for a spectator)multirecord in use (type ≠ 0) and not exploding (state ≠ −1); cloaked includeddist_exp − 1slot 1–2: 10, slot 3–4: 9
2bthat player's satellite (right after its ship)multitype > 0 (not exploding)dist_exp15
3aliens 0..7 (incl. the mutant)singletype > 0 and state ≥ 0dist_exp − 110
4enemy missiles 0..3singletype > 0 and state ≥ 0dist_exp14
5pods 0..5singletype > 0 and state ≥ 0 (also while being towed)dist_exp − 113
6your own satellitebothtype > 0dist_exp15

Not on the radar: your own ship (it is the centre), laser shots (yours, the aliens', other players'), your homing missiles, explosions, stars. Order matters only where blips overlap: later ones are drawn over earlier ones. The radar is drawn only while your shields are above 0, so it disappears on the death screen.

Exact rules: draw_radar
draw the 10 grid lines (table above) in colour[0]
if multiplayer:
    for i in 0 .. num_peers-1:                 // 3 peers, or 4 when spectating
        if peer_ship[i].type != 0 and peer_ship[i].state != -1:
            radar_blip(peer_ship[i].cam, peer_ship[i].dist_exp - scale(peer_ship[i].model), player_colour[i])
        if peer_item[i].type > 0:
            radar_blip(peer_item[i].cam, peer_item[i].dist_exp, colour[5])
else:
    for each alien (8):          if type > 0 and state >= 0: radar_blip(cam, dist_exp - scale, colour[3])
    for each enemy missile (4):  if type > 0 and state >= 0: radar_blip(cam, dist_exp, colour[4])
    for each pod (6):            if type > 0 and state >= 0: radar_blip(cam, dist_exp - scale, colour[6])
if my_item.type > 0: radar_blip(my_item.cam, my_item.dist_exp, colour[5])

Try the radar

Place one object relative to your ship (in world axes) and turn the ship. The script performs the original integer steps: 64-bit block normalisation, the Q14 dot products, the shifts and the pixel-exact line and plus routines, and paints the screen area around the radar (x 420..639, rows 160..349) enlarged, stretched to the real pixel shape. With heading 0, x is right, y is "c" (positive = drawn below you on the radar), z is ahead.


The sliders are cubic (fine near 0, up to ±1.5 million units); type exact values into the boxes. The heading is applied as one rotation of the start orientation with the game's own rotation routine (including its length correction) and cross-product routine (including the lost borrow, chapter 3) and the sine table formula (16384 · sin, truncated toward zero). In play the axes come from many small rotations, so their low bits differ; this does not change the rules.

Cockpit instruments

All drawn by draw_hud (src/hud.c) in this order, every frame while the shields are above 0. All coordinates below are rel unless marked "screen". Every bar is drawn as lines, never filled.

1. Sight

Without a target, a cross of four arms with an open middle, colour [1] (12):

ArmLine (rel)Screen
up(0, −40)–(0, −12)(320,135)–(320,163)
down(0, 40)–(0, 12)(320,215)–(320,187)
right(48, 0)–(16, 0)(368,175)–(336,175)
left(−48, 0)–(−16, 0)(272,175)–(304,175)

With a target (g_have_target ≠ 0) a bracket of four triangles instead, colour [2] (10). For each sign pair (sx, sy) in the order (−,−), (+,−), (−,+), (+,+) three lines: P–Q, P–R, Q–R with P = (40·sx, 15·sy), Q = (20·sx, 30·sy), R = (10·sx, 7·sy). Top-left triangle on screen: (280,160), (300,145), (310,168).

Target lock (missile lock): g_have_target is cleared at the start of aliens_update (src/aliens.c) and set when any alien that was not already dying when the loop reached it (an alien set exploding by your ramming earlier in the same pass is still tested) has cam_z > 0 and |cam_x| < L and |cam_y| < L, with L = 0xC0 << dist_exp (or 0xC0 >> −dist_exp when negative), all in 16-bit arithmetic, so at dist_exp 8 L is negative and the test fails. Details: chapter 6. Only single player computes it.

Left: the sight without a target (colour 12). Middle: with a target (colour 10). Right: the mouse marks around the pointer box (mouse steering only).

2. Mouse marks

Only with mouse steering (g_mouse_enabled, set by both mouse options of the Controls menu, "reversed" included). With the pointer's screen position (mx, my) (its 8 × 8 box has its top-left pixel there), let X = mx − 320 + 4, Y = my − 175 + 4. Four diagonal strokes, colour [1]: (X−36, Y−12)–(X−28, Y−20), (X+36, Y−12)–(X+28, Y−20), (X+36, Y+12)–(X+28, Y+20), (X−36, Y+12)–(X−28, Y+20). The mouse driver keeps the pointer inside screen x 44..587, y 28..313 during flight.

3. Velocity gauge "V" (throttle)

Shows the throttle (the forward speed you asked for), not the actual speed. Anchor (x, y) = (−288, 118), screen (32, 293). The throttle changes by 8 per frame while Shift / Ctrl is held and lies in −0x70..+0x90 (−112..144).

t = throttle >> 1                                  // −56..72 (arithmetic shift of the low word)
line (x−16, y−72)–(x−16, y+56)   colour[0]          // scale, screen (16,221)–(16,349)
line (x−16, y)–(x+16, y)         colour[0]          // zero mark, screen (16,293)–(48,293)
if t > 0:  outline in colour[2]: (x+8, y−1)–(x+8, y−t), (x−8, y−1)–(x−8, y−t),
                                 (x−8, y−1)–(x+8, y−1), (x−8, y−t)–(x+8, y−t)
if t < 0:  the same with y+1 instead of y−1 (y−t is below the zero mark)
stroke letter 'V' at (x−26, y−72), colour[0], half size

So the bar is a 17-pixel-wide rectangle (screen x 24..40) from just above (forward) or just below (reverse) the zero mark; full forward throttle reaches the scale's top (row 221), full reverse its bottom (row 349). Throttle 0: no bar.

4. Shield gauge "S"

Not drawn for a spectator. Anchor (x, y) = (−240, 46), screen (80, 221). Shields are 0..32.

t = shields << 2                                   // 0..128
line (x−16, y)–(x−16, y+128)       colour[0]        // scale, screen (64,221)–(64,349)
line (x−16, y+128)–(x+16, y+128)   colour[0]        // base, screen (64,349)–(96,349)
if t > 0: outline in colour[2]: (x+8, y+127)–(x+8, y+128−t), (x−8, y+127)–(x−8, y+128−t),
                                (x−8, y+127)–(x+8, y+127), (x−8, y+128−t)–(x+8, y+128−t)
stroke letter 'S' at (x−26, y), colour[0], half size

Full shields: a rectangle from screen row 221 to 348, x 72..88. One shield = 4 rows.

Exact rules: the stroke letters

A stroke letter is one polyline through points on a 16 × 16 grid; the routine draw_vector_char(x, y, colour, shift, ch) shifts every coordinate right by shift (left for a negative one) and adds the anchor (x, y) (top-left). The HUD always passes shift 1, "half size". V: (0,0) (8,16) (16,0) → screen (6,221)–(10,229)–(14,221). S: (16,4) (12,0) (4,0) (0,4) (4,8) (12,8) (16,12) (12,16) (4,16) (0,12) → at (54, 221) the points (62,223) (60,221) (56,221) (54,223) (56,225) (60,225) (62,227) (60,229) (56,229) (54,227). Full font: src/tables.c, routine src/effects.c.

5. Velocity indicator (three axes)

Only in Polygons mode (not in Lines mode). The variable names say "attitude", but it shows the ship's velocity in its own axes (g_vel_body, world units per frame, computed in the ship update: velocity's middle words dotted with b, c, a). Centre (x, y) = (−232, −100), screen (88, 75).

vx = vel_body[0] >> 2     // sideways (right +)
vy = vel_body[1] >> 2     // along c (+ = down on screen)
t  = vel_body[2] >> 3     // forward
line (x−72, y)–(x+72, y)         colour[0]     // screen (16,75)–(160,75)
line (x, y−64)–(x, y+64)         colour[0]     // screen (88,11)–(88,139)
line (x−64, y+32)–(x+64, y−32)   colour[0]     // oblique "depth" axis, screen (24,107)–(152,43)
line (x, y)–(x+vx, y)            colour[2]
line (x, y)–(x, y+vy)            colour[2]
line (x, y)–(x+2t, y−t)          colour[2]     // forward speed along the oblique axis

One pixel = 4 world units per frame sideways or vertically; forward, t = speed ÷ 8, drawn 2t across and t up. Full throttle (forward speed 0x90 = 144) gives t = 18, a line to (124, 57); with extra thrust (speed 288) t = 36 reaches (160, 39), past the end of the drawn axis. A line of zero length is still one pixel, so the centre pixel is always green.

6. Score and status lines

Anchor (sx, sy) = (160, −160), screen (480, 15). All texts are left-aligned at column 60 (screen x 480), colour [1] (12); bars colour [2] (10). A "bar of t" is a line from x = 480 to 480 + t, so it has t + 1 pixels.

Text / barShown whenText top row (screen)Bar row(s) and length
"SCORE: %6ld" (e.g. "SCORE: 1250", 13 characters)not spectating; also on the death screen (drawn before the shields test)15–
"CLOAK ACTIVE" (cloak switched on) or "CLOAK READY"cloak time > 0 (multiplayer only)31row 41: t = cloak_time >> 2 (0x200 after pick-up = 128)
"MISSILES: %d"missiles > 0 (single player only)31 (same row as the cloak; never both)–
"EXTRA FIRE POWER"fire power > 0 (0..0x100 powered shots)47from row 57: stacked, see below, 0x40 per row
"EXTRA THRUST"extra thrust > 0 (0..0x1000 units)63from row 73: stacked, 0x400 per row
// stacked bar, used for fire power (U = 0x40, R(v) = (v mod 0x40) * 2)
//                     and thrust   (U = 0x400, R(v) = (v mod 0x400) / 8, floor)
r = R(value); if value mod U == 0: r = 128      // an exact multiple shows a full last row
row = first row
for k in 1, 2, 3:                               // thresholds U, 2U, 3U
    if value > k*U: line (480, row)–(608, row); row = row + 1
line (480, row)–(480 + r, row)

Examples: fire power 0x100 → four full rows (57..60); 0x41 → one full row and a 3-pixel line (r = 2); 0x40 → one full row. Thrust 0x400 → one full row; 0x401 → one full row and a 1-pixel line (r = 0). The numbers are not shown, only the bars. Why cloak and missiles never show at once D: cloak time is only given by the multiplayer cloak satellite, and the missile count is set to 0 before every multiplayer round and raised in flight only by the single-player missile satellite.

Exact rules: the status lines

Calls in this order, each in colour [1], not centred, x = sx = 160 (rel) O (src/hud.c):

if cloakTime > 0:  draw_text(160, −144, "CLOAK ACTIVE" or "CLOAK READY"); bar on rel row −134
if missiles > 0:   draw_text(160, −144, "MISSILES: %d")        // two separate tests: if both
                                                                 // held, both are drawn, missiles on top
if firePower > 0:  draw_text(160, −128, "EXTRA FIRE POWER");    bars from rel row −118
if extraThrust > 0: draw_text(160, −112, "EXTRA THRUST");       bars from rel row −102

Rel row + 175 = the screen rows of the table above. Only the S gauge (4) is skipped for a spectator; the other instruments of this section follow their own conditions alone.

Quirks of the instruments

Messages

The game has one message slot: a text pointer and a frame counter (g_message_ptr, g_message_timer). Whoever sets it replaces the current message and restarts the counter; there are no priorities and no queue. The text is drawn at (0, −80) centred, colour [2] (light green), top row 95, steady (no blinking), every frame while the counter is above 0; after drawing, the counter goes down by 1.

Text (table entry)Shown whenModeFramesSet by
"WARNING: MISSILE LAUNCH DETECTED" (0x5C)an alien launches a missile (a free enemy missile slot existed); sound 3single16enemy_missile_launch
"No Target" (0x62)Enter / Caps Lock without a lock (every make code: holding the key repeats it)single16player_fire_missile
"Missile Launched" (0x5A)Enter / Caps Lock with a lock, a missile in stock and a free slot (of 4)single16player_fire_missile
"WARNING: POD IN DANGER" (0x6A)a Pirate reaches a pod and starts towing it; sound 3single16ai_abductor
"POD DESTROYED" (0x6C)a Pirate escapes with its pod (both vanish), or a Commander reaches a pod (pod explodes, alien becomes the mutant; sound 0)single16ai_abductor, ai_pod_killer
"COLLISION" (0x12)you ram an alien or another ship and survive itboth48player_bump
"EXTRA SHIELDS" (0x20), "MISSILES" (0x4E), "EXTRA THRUST" (0x88), "EXTRA FIRE POWER" (0x22)satellite collected (kind 1, 2, 3, 4); sound 2single32apply_pickup
"SHIELDS RESTORED" (0x7C)any satellite collected (every kind restores shields; cloak, thrust or fire power come silently)multi32apply_pickup
"%s has been killed" (0x72), with the player's nameanother player's ship starts exploding; sound 0multi64remote_players_update
"Cloak Destroyed!" (0x0C)you are hit while you have cloak time; the cloak time is lostmulti48net_sync_frame

At 18.2 frames per second 16 frames are 0.88 s, 32 are 1.76 s, 48 are 2.64 s, 64 are 3.5 s; at the multiplayer frame rate the same counts last about a quarter as long.

Exact rules: the message slot

Hit flash

Events store a colour in g_flash_color; the next frame clears its page with that colour instead of black and resets it to 0. The whole background (under stars, models and instruments) is then that colour for exactly one frame. Because the page drawn in frame N+1 is shown from the flip of frame N+2, the flash appears one frame after the message of the same event. Hits found in the multiplayer network step (after drawing) set both at once, so their flash and "Cloak Destroyed!" appear together.

EventColour
Collision: ramming an alien (single player, also when it kills you), or a ship you survive (multiplayer; a fatal ship-to-ship ram sets no flash)[7] 10 light green
Hit by an alien shot or an enemy missile (single player), by a normal laser shot (multiplayer)[8] 12 light red
Hit by a powered laser shot (multiplayer, 2 shields)[9] 14 yellow

Death screen texts

While the shields are 0, player_dead_screen (src/screens.c) replaces radar, instruments and message; the world keeps running behind it and the score stays.

TextModePositionColourWhen
"Game Over" (0x28)single(0, 0) centred: screen x 280..351, rows 175..182[1] 12every dead frame
"You were killed by %s" (0x46), the killer's namemulti(0, 0) centred[1] 12every dead frame
"Press ENTER to restart" (0x6E)both(0, 32) centred: screen x 232..407, rows 207..214[1] 12after the 64-frame countdown, unless a single player's score enters the high-score table (then the game goes straight to the initials entry)

During the 64-frame countdown Enter and the mouse button are swallowed. Details of what follows: chapters 4, 8 and 17.

For a rebuild

Compute in the original pixel space, then scale. Keep a virtual 640 × 350 screen with the centre at (320, 175) and use every number in this chapter unchanged. To draw at W × H, map x → x · W/640 and y → y · H/350 separately (the pixels were 1.37 times taller than wide; for a 4:3 area H = 0.75 W). This keeps every shape: the radar trapezoid, the gauges, the bracket. Draw lines with a width of about W/640 and the 8 × 8 font as a bitmap scaled by W/640 × H/350 (nearest-neighbour keeps it crisp); align text to the 8-pixel column grid before scaling.

Keep the radar arithmetic in integers (normalisation, Q14 dot, shifts), as in the demo's code: the cut-off cube and the rounding of blip positions follow from it. A smooth modern radar may compute bx = offset ÷ 28−zoom in floating point and place it at sub-pixel positions in the scaled space; keep the half scale ahead, the n ≥ zoom test (or decide to replace the world-aligned cube by a ship-aligned one, and say so), the colours and the order.

Decide the quirks: clip the radar stalk (the original wraps it to the left edge), reset the target lock in multiplayer, and decide whether the grid should match the blip mapping (the original's does not). Messages: one slot, last writer wins, counts in frames; if your frame rate differs from 18.2 per second, convert the counts (chapter 20) so that they last as long in seconds.