Skip to content

Vehicle and space simulations ​

Flight simulators, space combat and space trading games: the player flies something through a large world simulated in 3D. They mix a stream with controls (combat, landing) with an environment the player moves through (a galaxy, a theatre of war), and often with docked screens that wait for the player (trading, missions, ship fitting).

Reference games ​

GameYear, platformWhy it is a good example
Elite1984, BBC MicroA galaxy of eight times 256 systems generated from one seed with a small generator
Frontier: Elite II1993, DOSReal orbits, a whole galaxy generated, a software 3D engine in overlays (case study)
Wing Commander1990, DOSScaled sprite ships, a branching campaign, cut scenes in the engine
X-Wing1993, DOSFlat-shaded 3D, mission scripts with goals and triggers
Falcon 3.01991, DOSA full flight model and a dynamic campaign
Descent1995, DOSSix degrees of freedom inside portal-connected cubes

Projects to learn from ​

ProjectGameApproach
Elite, fully documented (bbcelite.com, by Mark Moxon)Elite (BBC Micro and others)the original source code, commented line by line, with articles on how each part works
JJFFEFrontier: First Encountersreverse engineered from the DOS program into portable code
GLFrontier (by Tom Morton)Frontier: Elite IIthe Amiga program's 68000 code translated to C
fs2_openFreeSpace 2source port
DXX-RebirthDescent 1 and 2source port

The rule set ​

What must be exact. The maths core: fixed-point or float formats, multiply and divide helpers, square roots, trigonometry tables, matrix and vector routines, and 64-bit positions where the world is large. Orbits and physics integration (the step and its order). Generation of the world from a seed: one wrong draw changes the whole galaxy. Players remember the names of the systems, so a wrong name is noticed.

Where the rules live. Mostly in code, often hand-written assembly for the maths. Ships, weapons and goods are tables. Mission scripts and campaign trees are data. A generated world is stored only as a seed, so the generator code must be exact.

Inputs. Joystick axes, mouse flight, keyboard. Throttle and view controls. Time acceleration is an input that changes how many steps a frame runs: record it.

Interface. Cockpit instruments, radar and scanners are drawn by the game, often by the same 3D engine. Docked screens (markets, ship fitting) are software that waits. Star maps are 3D views with their own picking.

Time and determinism. A fixed step multiplied by time acceleration. Far objects may be updated less often than near ones. Orbits are often computed in closed form from time, not integrated. The positions then depend on the clock's format and precision.

How to verify. Emulate the maths routines on millions of random inputs and compare bit for bit. These routines are small and pure. Generate the galaxy or star systems from many seeds and compare every field. Compare frames of the 3D view from the same state.

Pitfalls.

  • Routines that pass values in registers or register pairs rather than by the calling convention: emulate with the exact register set (DOS games).
  • Overlays: code loaded on demand into the same addresses. Know which overlay is loaded when you read an address.
  • Custom float formats in software (16-bit mantissa plus exponent), with their own rounding.
  • Perspective and clipping that differ by screen size.

Connections ​

Code: Apache 2.0. Content: CC0 1.0. No game material: bring your own copy.