This project recreates the source of Wing Commander as shipped in Wing Commander: The Kilrathi Saga (1996). The reconstructed game core is C, the ix audio library is C++, and the reference build uses Microsoft Visual C++ 4.20 to reproduce the original Win32 executable as closely as possible.

A native SDL2 port is available for Windows, Linux, and macOS. It supports Kilrathi Saga data and has partial support for the original DOS game data.

No copyrighted game data is included.

Status

All 1,472 identified functions are accounted for: 1,470 have source implementations and the remaining two are compiler-generated jump thunks that must not be recreated manually.

make report calculates per-function machine-code similarity to the retail executable; those scores measure reconstruction fidelity, not gameplay completeness.

Similarity

Run make report for the current per-function results. Generated report output is not stored in this repository.

Screenshots

Mission briefing Tiger's Claw hangar
Mission briefing and flight path aboard the Tiger's Claw Fighter parked in the Tiger's Claw hangar
Title sequence Cockpit combat
Wing Commander title screen Cockpit combat targeting a Dralthi

Download and run the SDL2 port

Download the archive for your platform from GitHub Releases. Extract its contents into an installed Kilrathi Saga or DOS Wing Commander directory and keep the bundled runtime libraries beside the executable. Start it with that directory as the working directory:

# macOS or Linux
cd /path/to/WC1
./wc1-modern
# Windows PowerShell
cd C:\path\to\WC1
.\wc1-modern.exe

With DOS data, compressed packet resources, OriginFX/AdLib music, and synthesized sound effects work; other DOS-specific data or behavior may not.

Fixes and features

What the port adds on top of the reconstructed game. The first group is always active; the rest need a switch, and switches can be combined.

Fix or feature Enable with
Runs from either Kilrathi Saga or DOS game data, detected automatically always on
Resizable window, fullscreen toggle, and mouse capture always on
Aspect-correct 4:3 presentation and pointer mapping always on
Camera-relative left/right panning for in-flight sound effects always on
Kilrathi Saga sound effects balanced against streamed music always on
Background planets drawn with correct per-object scaling (WCDX fix) always on
Static on knocked-out cockpit displays, which the 1996 port dropped always on
Landing on the Tiger's Claw from any bearing; retail also required the Claw's bow to face you always on
Mouse wheel throttle control during spaceflight always on
Esc pauses during spaceflight, where the original left it inert always on
Pointer confined only during unpaused, focused spaceflight always on
Gamepad support with automatic SDL mappings and hot-plug always on
OpenGL renderer drawing space objects at output resolution --enhanced
Restored, music-synchronized startup intro --enhanced, or automatic with DOS data
OriginFX intro music --enhanced, or automatic with DOS data
Heavy-weapon, damage, collision, and afterburner rumble --joystick-rumble
WCAT-style four-button joystick layouts --joystick-mode=4button-2axis or 4button-4axis
Alternate twin-stick, HOTAS, throttle, and rudder axis layouts --joystick-axes=<layout>
Joystick diagnostics on stderr --joystick-debug
Frame-rate counter -f
Cockpitless view -c
./wc1-modern --enhanced --joystick-rumble

Enhanced renderer

The OpenGL renderer keeps the original indexed artwork, palettes, cockpit, and HUD; only space objects are redrawn at output resolution. The software renderer remains the default.

Output-resolution ships Cockpit combat
Enhanced renderer showing two ships at output resolution Enhanced renderer during cockpit combat

SDL2 port controls

Shortcut Action
Cmd+Enter (macOS) Toggle fullscreen
Alt+Enter (Windows and Linux) Toggle fullscreen
Cmd+Q (macOS) Quit the game
Ctrl+S (spaceflight) Toggle sound effects
Ctrl+M (spaceflight) Toggle music
Gamepad Start (spaceflight) Pause or resume
Gamepad Back Escape/back
Gamepad Y (Y/N prompts) Confirm Yes
Mouse wheel (spaceflight) Increase or decrease speed
Esc (spaceflight) Pause; press any key to resume

Esc pausing is a port addition. The original leaves it inert during spaceflight, and there is no in-flight quit or restart: a mission ends only by landing on the Tiger's Claw, ejecting, or dying. Quitting is done from the barracks menu (Quit Wing Commander), and retrying a mission means saving to a bunk beforehand and reloading it from there.

The default --joystick-mode=original keeps the original two-axis, two-button controls. Two WCAT-style layouts are also available:

Option Spaceflight controls
--joystick-mode=4button-2axis Buttons 1–4: fire, missile, afterburner, roll/throttle modifier
--joystick-mode=4button-4axis Buttons 1–4: fire, missile, afterburner, cycle target; extra axes control roll and throttle

On mapped controllers, buttons 1–4 correspond to A, B, X, and Y; hold X to engage the afterburner.

In either WCAT-style mode, LB/RB cycle guns and missiles, LT/RT or the left/right stick clicks open navigation/map and engage autopilot, and the D-pad provides full speed, stop, communications, and target lock.

With communications open, D-pad Up/Down moves the highlighted choice, Right selects it, and Left closes the list. Flight and weapon controls remain active.

The four-axis mode defaults to --joystick-axes=twin-stick-roll. Additional twin-stick, HOTAS, throttle, and rudder layouts are described in the SDL2 port documentation.

Build from source

Clone the submodules first:

git submodule update --init --recursive

SDL2 port

Install a C/C++ compiler plus the SDL2 and LZO2 development packages, then run:

make -j modern

The executable is written to out-modern/wc1-modern (or out-modern/wc1-modern.exe on Windows). make run-modern launches it with Kilrathi Saga data in data/full; make run-modern-dos uses DOS data in data/dos.

Reconstructed Win32 build

The default target builds WC1.EXE with the original MSVC 4.20 toolchain under wibo:

make -j

To run it, provide a Kilrathi Saga disc image. The Makefile extracts the game data, substitutes the reconstructed executable, downloads DREAMM when needed, and launches it in an emulated Windows 95 environment:

make run GAME_ISO=/path/to/kilrathi-saga.iso

Use make debug GAME_ISO=/path/to/kilrathi-saga.iso to start DREAMM's debugger.

Reconstruction workflow

binary-comp is required only for comparison and verification commands:

python3 -m pip install "binary-comp[all] @ git+https://github.com/gg-sl-oss/binary-comp.git"
make compare-func FUNC=perform_maneuver
make verify

These commands require the retail executable at data/full/WC1.ORI.EXE and the original-code exports under code-full/.

Contributor references are intentionally limited to:

Acknowledgements

Special thanks to:

  • Origin Systems who created Wing Commander and developed its Kilrathi Saga port;
  • Electronic Arts for publishing Wing Commander: The Kilrathi Saga;
  • GOG for keeping Wing Commander 1 + 2 readily available;
  • AllTinker for the W.C.A.T. overhaul, whose fixes and analysis of the DOS release have been valuable references;
  • the WCDX project for its pioneering compatibility work on the Kilrathi Saga release; and
  • Aaron Giles for the DREAMM emulator, used to run and study the original release, and ymfm, which powers the SDL2 port's AdLib emulation.

License

See LICENSE. OpenAI Codex and Anthropic Claude were used during the reconstruction.