GitHub - neuromancer/wc2-re: Wing Commander 2 source reconstruction and SDL2 port

GitHub

7 min read Original article ↗

This project recreates the source of Wing Commander II as shipped in Wing Commander: The Kilrathi Saga (1996). The rebuilt WC2.EXE matches the original byte for byte.

It also provides a native port for Windows, Linux, and macOS that plays the Kilrathi Saga version, both Special Operations, and the original DOS release, with saved games the original can read.

No original game data is included.

Browse the reconstructed source, with assembly listings and searchable references.

Players and modders are invited to discuss wc2-re in the #wc1-re channel of the Wing Commander Dev Discord.

If you find this project useful, you can support its development through GitHub Sponsors.

Supported releases

  • Wing Commander: The Kilrathi Saga (1996), with Special Operations 1 and 2
  • Wing Commander II: Vengeance of the Kilrathi: 35th Anniversary Edition, from GOG and Steam: both its Kilrathi Saga and DOS versions
  • Wing Commander II for DOS (1991), with both Special Operations, the speech pack and the German translation patch

Screenshots

With the enhanced renderer and the double-resolution HUD text.

Wing Commander II and Special Operations 2

A Kilrathi pilot's taunt over the radio, in a Broadsword's cockpit The Morningstar's cockpit in Special Operations 2, with a Gothri locked near a ringed planet The rear view from a Rapier, with fighters on its tail

Download and play

Get the package for your platform from GitHub Releases:

  • macOS 15 or later: open the .dmg for Apple Silicon (arm64) or Intel (x86_64) and drag Wing Commander II into Applications.
  • Windows: run the -setup.exe installer.
  • Steam Deck / Linux: install the .flatpak with flatpak install --user ./downloaded.flatpak, then add Wing Commander II to Steam as a non-Steam game.
  • Portable ZIPs for Windows, macOS and Linux: extract and run.

Game data is not included. Open the app, pick a detected installation or use Add path… to select the game's folder (a Steam or GOG copy's main folder, or any folder containing GAMEDAT), then select Start WC2.

  • Special Operations: Start SO1 and Start SO2 appear when the expansions are installed. Each keeps its own saved game (SAVEGAME.SO1, SAVEGAME.SO2), and a new campaign offers to bring over the pilot of the previous game's Continue checkpoint.
  • Languages: Español and Polski are in the launcher's Language menu, with both Special Operations in Polish; see translations. A DOS installation patched with the German translation plays in German.
  • Music and sound: the Kilrathi Saga's digital music and effects, or the DOS ones on an AdLib or a Roland MT-32; the expansions play the DOS scores. For the MT-32, select a folder with your own ROM files under MT-32 ROMs…. The DOS speech pack plays when it is installed.
  • Wing Commander I pilots: as in the original, a new game can transfer a WC1 pilot, from the saved games of wc1-re, or of a Kilrathi Saga or DOS WC1 installed beside this one.
  • Continue: the game saves a Continue checkpoint by itself, and a new campaign asks before overwriting it.

Improvements

  • A resizable window, fullscreen, aspect-correct 4:3 presentation, and screenshots.
  • Gamepads, flight sticks and the Steam Deck, with rumble and WCAT-style four-button controls; the launcher shows every binding, changes them, and calibrates the joystick.
  • Fixes to the original's bugs, such as the Kilrathi Saga's missing planets, cloaked ships that never decloak, and a death during a jump that left the controls dead; see the Original bugs.
  • Subtitles for spoken radio messages, captions in voiced cutscenes, sound effects panned with the camera, the mouse wheel on the throttle, and WC2's orchestral startup, restored.
  • A game speed choice: Normal (20 FPS), Slow (15 FPS, the Kilrathi Saga's pace), or [ and ] in flight.
  • Optional extras: an enhanced renderer that draws ships at full resolution and the HUD's text at double resolution, in Trov's double-resolution cockpit font for English; Smooth spaceflight; EGA colours; a balanced difficulty; and a cheat mode.

Controls

Shortcut Action
Cmd+Enter (macOS), Alt+Enter (Windows, Linux) Toggle fullscreen
Cmd+S (macOS), Alt+S (Windows, Linux) Save a screenshot: to the Desktop on macOS, else to Wing Commander Screenshots in Pictures
Cmd+Q (macOS) Quit the game
Esc (spaceflight) Close communications, or pause
Esc (autopilot fly-by) Skip the fly-by
[ / ] (spaceflight) Slow the game down / speed it up
Mouse wheel (spaceflight) Change speed
Gamepad Start / Back (spaceflight) Pause / cycle the views
Ctrl+J or Alt+C (menus, spaceflight) Calibrate the joystick

The launcher's Joystick and Keyboard and mouse tabs show every binding and change them. In the Custom control mode, any gamepad or flight stick input can take any flight action. The Steam Deck mode follows the layout from #66, with the rear buttons mirroring the D-pad.

Command line

With any option, the game starts at once from the folder it is run in; --gui opens the launcher first.

Option Effect
--gui Open the launcher first
--fullscreen, --windowed Display mode
--campaign=so1, so2 Start a Special Operations campaign
--language=es, pl Spanish or Polish text
--music= and --sound= with default, adlib or mt32 Music and sound effects
--mt32-roms=DIR, --mt32-model=ID, --mt32-check MT-32 ROM folder and set, and a report of what the folder holds
--flight-fps=N Spaceflight frame rate, 8 to 32
--enhanced, --hires-hud, --interpolate, --ega Enhanced renderer, double-resolution HUD text, Smooth spaceflight, EGA colours
--balanced-difficulty, --cheats Balanced difficulty, cheat mode
--joystick-mode=original, 4button-2axis, 4button-4axis, custom, steam-deck Joystick layout
--joystick-axes=twin-stick-roll, twin-stick-yaw, hotas-yaw, hotas-roll, linear-throttle, rudder-yaw, rudder-roll Joystick axes
--joystick-dead-zone=N, --joystick-rumble, --joystick-debug Dead zone (0 to 33%), rumble, and diagnostics on stderr
-f, -c The original's frame-rate counter and cockpitless view

Build from source

git submodule update --init --recursive
make -j modern-gui

This needs Python 3, a C/C++ compiler, the SDL2 and LZO2 development packages, CMake 3.21+, Rust 1.92+, and a C++20 compiler; the game is written to out-modern/. make -j rebuilds the original WC2.EXE with Microsoft Visual C++ 4.1 under wibo, and fails unless it matches the original.

On Debian and Ubuntu, the packages are:

sudo apt install build-essential cmake python3 pkg-config libsdl2-dev \
    liblzo2-dev libfontconfig1-dev libdbus-1-dev        # make modern-gui
sudo apt install clang lld libclang-dev ninja-build curl  # make (WC2.EXE)

make check-fuzz fuzzes spaceflight (fuzz/README.md), and make site builds the source browser (Doxygen 1.18.0, unifdef and Pygments).

Acknowledgements

Special thanks to:

  • Origin Systems, who created Wing Commander II and developed its Kilrathi Saga port;
  • Electronic Arts for publishing Wing Commander: The Kilrathi Saga and releasing Wing Commander II: Vengeance of the Kilrathi: 35th Anniversary Edition;
  • digital game stores (GOG and Steam) for keeping Wing Commander II 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;
  • L@Zar0 for creating the Spanish translation and darkpadawan for reviewing its text, shared under the upstream GPL v3.0 notice; their Spanish version was also the base of the Polish translation;
  • paxiu1984 for creating the Polish translation of Wing Commander II and both Special Operations, shared under its upstream GPL v3.0 notice, and the clandlan.net and wcnews.com communities that tested it;
  • Aaron Giles for the DREAMM emulator, used to run and study the original release, and ymfm, which powers the SDL2 port's AdLib emulation;
  • the Munt project, whose libmt32emu (LGPL-2.1 or later) emulates the Roland MT-32 and CM-32L;
  • the ScummVM project, whose code inspired the SDL2 port's patterns, code quality and formatting;
  • Trov for the double-resolution cockpit font (CC BY 4.0) that the hi-res HUD shows cockpit text in; and
  • DaisenryakuFan for providing very advanced source reconstructions for the DOS releases of several Wing Commander titles.

License

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