16. Model and asset catalogue
Everything NetWars draws that is data rather than code: the 22 three-dimensional models, the 16 colours, the 8 × 8 font, the star and explosion directions and the three bitmap pictures. Each model can be turned with the mouse and drawn the way the original draws it, in Polygons or Lines mode. The numbers on this page are computed from the repository's assets/ files, so you can check your own copy of the data against them.
Chapter 9 explained how a model becomes a picture. This chapter is the reference you need when you load the data into your own program: what each model is for, how big it really is in the world, which colours it uses, and what is special about it. Words used here: a model is a list of corner points (vertices) and flat faces; a world unit is the distance unit of chapter 3 (pods sit 1000 units from the centre): a position is three 64-bit numbers, and one world unit is one step of the middle 16-bit word of each; model units are the small numbers stored in a model file (at most 96 in size); the scale of a model says how many world units one model unit is.
Where the data lives and what it looks like
The program keeps all 22 models in one block of its data segment, each in a fixed-size record of
0x4A6 = 1190 bytes O. The repository has each model twice, with the same
values (tests/test_assets.py checks this): as C source that the byte-identical build
uses, src/data/model_<name>.h, and as a
readable text file, assets/models/<name>.model.
The model names are ours; the original names were lost.
| Offset | Size | Field |
|---|---|---|
| 0x000 | 16-bit | scale: one model unit = 2scale world units. Stored as 0 in every record; the game raises it at start-up (below). |
| 0x002 | 16-bit | number of vertices in use (at most 48) |
| 0x004 | 16-bit | number of faces in use (at most 64) |
| 0x006 | 48 × 3 × 16-bit | vertices (x, y, z): x along the object's right axis, y along its up axis (which the camera draws downward, chapter 3), z along its forward axis. Signed whole numbers, all within −96..96. Unused slots are zero. |
| 0x126 | 64 × 7 × 16-bit | faces: colour (EGA index 0..15), n (2..5), then 5 vertex numbers (the first n are used). n = 2 is a line face (a single line: antennas, spikes, outlines); n ≥ 3 is a flat convex polygon. Polygon corners are listed clockwise as seen from the outside, as they appear on the screen: that order decides which side is the front (back-face culling). |
The text form (.model), line by line:
# NetWars 2.06 model "pod" — DGROUP:86D0, 0x4A6-byte record ... (comments start with #;
# ... the first names the record address)
scale 0 the stored scale (always 0)
vertices 12 number of vertices in use
v 0 0 72 one line per vertex: x y z, in vertex-number order from 0
...
faces 14 number of faces in use
f colour 5 n 4 idx 0 1 4 0 0 colour, n, then all 5 index slots (only the first n count)
...
Unused vertex and face slots are left out (in the record they are zero). Text after # is a
comment.
The scale is the only value the game changes. At start-up, before the title screen,
main (src/main.c) sets it to 1 for the four
player ships, the four aliens, the mutant and the pod, and to 2 for title model A; all other models keep
0 O. So ships, aliens and pods are twice as big in the world as their numbers
say, and satellites and missiles are not. The scale also counts in every distance test that uses the object's distance exponent (chapter 3:
the exponent starts at the scale, so a scale-1 object is "near" at twice the distance): a collision with
you (exponent ≥ 7), a missile reaching its target (≥ 6), the switch to the far "+" mark (exponent < 0,
chapter 9), and the hit sizes of shots (chapter 6). The radar removes it again: blips do not depend on
the scale (chapter 15). The cards below give each model's size after this scaling.
Load the .model files as they are and apply the scales of the table below
yourself (do not edit the files: they mirror the original data). Keep each face one flat colour from
the 16-colour palette, keep the corner order (it is your front-face rule), and draw line faces as
1-pixel lines. Title model B also needs the start-up shift described on its card.
The models
Each card shows a model turning slowly about its up axis. Drag on the picture to turn it yourself (sideways: about the up axis; up and down: tip it forward or back). The picture is a 360 × 260-pixel window of the original 640 × 350 screen, drawn with its tall pixels, using the original rules from chapter 9:
- Polygons mode: every face is one solid colour; faces whose first three corners appear anticlockwise on the screen are skipped (back-face culling, tested on whole-pixel screen points; a zero cross product is kept); the rest are painted farthest first, each face at the depth of its farthest corner, faces of equal depth in model order (the painter's algorithm).
- Lines mode: back faces are skipped the same way, then every remaining polygon edge is drawn once per object (an edge shared by two faces only once) in the bright version of the face's colour: colour c below 8 becomes c + 8, and 8 becomes 7. Line faces keep their own colour. Nothing is sorted: the list is drawn in reverse order of queuing, so the edges simply overlap.
- Monochrome (the
/Mswitch): in Polygons mode and for line faces, colours above 8 become white (15), below 8 light grey (7), and 8 stays dark grey; in Lines mode every polygon edge is white.
Projection: screen x = 512 · x ÷ z, screen y = 384 · y ÷ z, both truncated toward zero (chapter 9). The distance from the eye is chosen per card so that the model fills the window; in the game it varies. Our polygon fill is a simple scan-line fill and may differ from the original (src/polygon.c) by a pixel at the edges.
Player ships (4)
One ship per multiplayer slot: the table of ship models (g_ship_models,
src/globals.c) is indexed by slot. In flight you never see
your own ship (the view is from the cockpit); you see the other players' ships. Ships 1 and 2 are
green, ships 3 and 4 blue (their face colours, O), all four with some red (4) faces.
Aliens (4) and the mutant
Single player only. The alien type table (g_alien_types,
src/tables.c) gives each type its model; their behaviour is
chapter 7. The same models spin on the instructions screen (one row of four) and on the level
introduction (one row per type).
Pod
Satellites (5)
Satellites are the pick-ups (chapter 7). Every new satellite takes the next kind in a fixed cycle: a counter
(g_satellite_counter) starts at 0 when the program starts, is increased by one before
each satellite and is never reset, and the counter modulo 4 picks 1 → thrust, 2 → fire power,
3 → shields, 0 → missiles or cloak. So the first satellite of a program run is thrust, then fire
power, shields, missiles/cloak, thrust …, and a new game continues the cycle where the last one stopped; kind 2 is missiles in single player
and cloak in multiplayer, with a model each, so there are five satellite models for four kinds
(satellite_spawn, src/satellite.c)
O. All keep scale 0.
Missiles (3)
Enemy missiles come in two kinds; the alien's type decides which (the missile field of the type
table: Pirates launch kind 1, Commanders kind 2; Fighters and Guardians never launch,
enemy_missile_launch in src/aliens.c). All three
missiles keep scale 0 and explode with 12 sparks.
Title logo (2 models, and how they are combined)
The title screen (game_mode_menu, src/screens.c)
shows a turning 3-D logo 2500 world units ahead, under the "NetWars" bitmap. It is built from two
models: title model A is a diagonal half of the striped Novell "N" square: drawn once as stored and once
turned upside down, the two halves make the full square. Each frame the game draws A,
then B, then A again rolled half a turn about its forward axis (x → −x, y → −y), all in one
depth-sorted draw list, so the two copies of A make the full square O. The
object turns by 16/2048 of a turn per frame about its up axis. The last card shows the three parts
together, as on the title screen; a recorded title screen shows the same picture (runtime #1,
evidence/runtime/boot_t003.0.png)
O.
Unused: "Net" and "Wars"
Two models that nothing in the program refers to O: flat outline letters
spelling Net and Wars, red (12) fills with yellow (14) outlines, all z = 0. A routine that
draws a model flat, ignoring z (draw_model_2d,
src/render.c), is never called either; it was probably
meant for them H. They are turned here with the 3-D rules like any other
model; seen from behind, the filled faces are culled and only the outlines remain.
All models at a glance
Sizes are the extent along each model axis (right × up × forward) in world units, after the start-up scale: (largest − smallest coordinate) × 2scale. "Lines" counts the line faces among the faces. Addresses are the record offsets in the data segment (DGROUP).
| Model | DGROUP | Scale | Vertices | Faces (lines) | Colours | Size (world units) |
|---|
- Title model B is stored centred, but at start-up
mainadds 464 (0x1D0) to x and 384 (0x180) to y of each of its vertices, once O; why the data was not stored that way is unknown ?. The shift puts the ® at a corner of the logo. - The "drawn once" bookkeeping of Lines mode is a 32 × 32 bit table indexed by vertex numbers, without a bounds check. Every model the game draws has at most 30 vertices; the unused "Wars" model has 43 and would overrun it if it were ever drawn in Lines mode D. (Our viewer has no such limit.)
- Some models have two-sided fins stored as two faces with opposite corner order (for example the
fins of player ship 3,
player_ship_2), so culling must stay on or both are painted.
The 16 colours
The game runs in EGA/VGA mode 10h with the standard 16-colour palette, which the BIOS sets when the mode is switched on; the game never changes it (a palette routine in the program is never called, chapter 12) O. Each channel has four levels, 0x00, 0x55, 0xAA and 0xFF; on a VGA card the same colours come from the DAC values 0, 21, 42, 63 of 63. Colour 6 is brown (not dark yellow): the EGA default palette gives it half green.
Monochrome (/M)
The /M command-line switch does not change the palette. It replaces colour
numbers as they are drawn O:
| What | Normal | With /M |
|---|---|---|
| Model faces (Polygons mode) and line faces | own colour | colour > 8 → 15, colour < 8 → 7, 8 stays 8 (so black 0 would become light grey; no model uses 0) |
| Polygon edges in Lines mode | bright version (c < 8 → c + 8, then 8 → 7) | 15 |
| Explosion sparks | 14 (even), 12 (odd) | 15 |
| Laser shots | 15, powered 14 | 15 (no powered colour) |
| Ring of an exploding shot (a hit) | 12 | 15 |
The colour roles of the interface (g_colors, chapter 15) | 4, 12, 10, 10, 14, 15, 13, 10, 12, 14, 12, 14 | 8, 7, 15, 7, 15, 15, 7, 7, 7, 15, 15, 7 |
The twelve roles, in order: frames and scales, instruments, highlight / locked target, alien, enemy missile, satellite, pod, collision flash, hit flash, powered-hit flash, logo faces, logo extrusion (src/globals.c, src/main.c).
The 8 × 8 font
All text on the screen (menus, messages, numbers on the instruments) is drawn with one font of 256
characters, 8 × 8 pixels each, stored in the program (tbl_font8x8,
src/graphics.asm; readable form
assets/fonts/font8x8.txt). Each glyph is 8 bytes,
one per row from the top; bit 7 is the leftmost pixel. The character codes follow the IBM PC character
set (code page 437): 0x03 is a heart, 0xB3 a box-drawing bar, 0xDB a full block, 0xE1 the German ß
D. The program does not use the BIOS font for its own text, although it loads it
O. Point at a character to see its code.
- Text is placed on whole bytes of the screen: x and y are measured from the screen centre, and the first cell starts at byte column (x + 320) ÷ 8, rounded down (a multiple of 8 pixels); y + 175 is the top row of the 8-row cell. 1-bits are painted, 0-bits leave the background (transparent text).
- There is no clipping: text that runs past the screen edge is written into the next rows of video memory.
- A negative colour draws the absolute colour with inverted glyphs: the cell around the glyph is painted instead (used for highlighted menu items).
- An underscore
_does not take a cell: it moves back one cell, so it underlines the character before it ("G_ame" shows a G with a line under it: the menu hotkey). - Centred text starts (length + 1) ÷ 2 cells left of x; the length counts the underscores too and is counted only up to 80 characters.
- On a 4:3 monitor a pixel of the 640 × 350 screen is about 1.37 times as tall as wide, so a glyph looks taller than it does in this square-pixel picture.
The large digits on some screens and the letters on the gauges use a second font made of lines (26
letters and 10 digits, draw_vector_char in
src/effects.c, tables in
src/tables.c); chapter 15 covers it.
Star directions
The star field is a table of 256 fixed directions (g_stars,
src/globals.c): vectors in Q14 (16384 = 1.0) of length
very nearly 1, in world axes. Stars are infinitely far away: they turn with your ship but never move
when you fly O. The map below shows all 256 as seen from the centre of the
world: across, the angle around the y axis (0 = the +z direction); up and down, the angle from the x–z
plane, with +y drawn downward as the game's camera does. The first 64 (the only ones Lines mode
uses) are bright, the others grey; the dashed frame is roughly the screen when you look along +z.
- Count: 256 stars in Polygons mode, the first 64 in Lines mode.
- For star i: z = the Q14 dot product of your forward axis with it (sum of the three products, shifted right by 14, rounded down). If z < 12000 (0x2EE0, a cosine of 0.73: within about 43° of the view direction) the star is skipped.
- Otherwise x and y are the dot products with your right and up axes, and the star is a pixel of colour 15 at (320 + 512 · x ÷ z, 175 + 384 · y ÷ z), truncated toward zero. Even-numbered stars (i = 0, 2, 4 …) get a second pixel just right of it.
- Stars are drawn after the far "+" marks and before the draw list, so every model covers them (chapter 9).
Explosion spark directions
An explosion is a cloud of small discs (sparks) flying apart from the exploding object's centre
(draw_explosion, src/effects.c). Each spark
follows one fixed direction from the table g_particle_dirs
(src/globals.c): 70 small vectors of length 18.5 to 20;
the first six point along ±x, ±y and ±z. An object uses the first N of them: N = 38 for aliens, pods
and other players' ships in Polygons mode, 12 in Lines mode, and always 12 for missiles and
satellites. Entries 38 to 69 are never used D. The left picture shows the
directions seen along z; the right one plays an explosion with the original rules, seen from a
distance you choose.
- The age counts frames from the explosion; it is increased by one before each drawing. The start
value depends on what exploded and how (the object's
dist_expfield holds the age):The slot is freed once the age passes 64 (pods: once it reaches 64), so a later start means a shorter explosion.Object, cause Start age Source alien killed by your laser 1 src/shots.c alien killed by your missile its scale (1) src/missiles.c alien killed by ramming you its scale (1) src/aliens.c your missile on reaching its target 1 src/missiles.c enemy missile shot down, or hitting you 0 src/shots.c, src/missiles.c pod shot by you 0 src/shots.c pod destroyed by a Commander not reset: the pod's current distance exponent src/aliens.c your satellite shot 0 src/shots.c, src/satellite.c another player's ship (reported killed) 3 src/net.c, src/players.c - Nothing is drawn when the centre is behind you (camera z ≤ 0), or outside the cone |x| ÷ 2 ≤ z and |y| ÷ 2 ≤ z (about ±63°, wider than the screen). This test is made on the centre only; single sparks get no cone test of their own.
- Spark i is drawn while age ≤ 64 − i: spark 0 is drawn up to age 64, spark 37 only up to 27, so the cloud thins out from the end of the list.
- Its centre is the explosion centre plus 4 · age · direction[i] world units; its radius is 16 world units. The disc's vertical radius on the screen is r = 512 · 16 ÷ z rows (truncated) and its half-width 4/3 of that (the tall-pixel correction): a disc looks 4/3 larger than a ball of radius 16 would. r ≤ 1 draws a 5-pixel "+", r > 128 draws nothing.
- Colour: even i yellow (14), odd i light red (12); white in monochrome.
- Sparks nearer than 512 units in depth are skipped. In Polygons mode they are sorted into the draw list at twice their depth, so faces behind them can cover them; in Lines mode nothing is sorted (each record goes to the front of the list). Farther explosions (largest coordinate difference 16,384 to 32,768 units) are drawn the same size but sort as nearest, over everything; beyond that they are not drawn (chapter 9).
The bitmaps
Three 1-bit pictures, each 600 × 100 pixels, are stored in their own far data segments
(src/bmp_face.c,
src/bmp_extr.c,
src/bmp_dos7.c; readable as
assets/bitmaps/*.pbm). Each starts with
its width and height (16-bit words), then the rows, 75 bytes each, bit 7 = leftmost pixel.
draw_bitmap paints the 1-bits in one colour and leaves the 0-bits alone, so two bitmaps can
be laid over each other in two colours.
The title logo
The title screen draws the letter faces in colour 12 (light red), then the extrusion in colour 14
(yellow) on top, both with their top-left corner at (−300, −174) from the screen centre, i.e. screen
pixel (20, 1); draw_bitmap rounds x down to a whole byte, so the picture starts at pixel
column 16 D. Below, drawn with tall pixels as on a 4:3 monitor:
The two parts separately (letter faces, then extrusion), in white:
The unused wordmark
The third bitmap is the "Novell DOS 7" wordmark; no code refers to it O (chapter 12: a credits screen that never runs). Drawn here in white:
Everything on this page can be loaded straight from assets/: models as text, the font
as a picture per glyph, the bitmaps as PBM images (any image library reads them). The star and spark
tables are only in src/globals.c; this page's data file,
catalogue-data.js, holds them in JavaScript form. The
Novell logo models and the Novell pictures are Novell's artwork: a published rebuild should not use
them without permission (chapter 12); the "Net" and "Wars" models and the NetWars bitmaps are the
game's own logo.