< back to blog

Released: Galaga SDL2 Port

Released: Galaga SDL2 Port

Galaga is now in the games archive. It's a native C11/SDL2 port of the 1981 Namco arcade game for Linux handhelds through PortMaster, Linux desktops, the Steam Deck, Windows and macOS. Release 0.1.1 is on GitHub.

// THE GAME

Shigeru Yokoyama designed Galaga for Namco in 1981 as the sequel to Galaxian, and Midway brought it to North America. Waves of aliens fly in and form up at the top of the screen, then break off to dive at you. Every few waves there's a Challenging Stage, where nothing fires back and the aim is to hit every one. The Boss Galaga can capture your fighter with its tractor beam. Shoot the Boss down to win the ship back and fly two fighters at once.

// THE PORT

This one works differently from the Defender and Joust ports. There's still an emulated Galaga board, with three Z80s, the Namco 51xx and 54xx MCUs, the video, the starfield and the WSG sound. It's checked against MAME instruction for instruction and runs with --emulate. By default, though, the game runs in C. All five programs (the three Z80 programs and the two MCU programs) are rewritten in C on the board's scheduler. Their memory, latches and sound equal the emulated board's at every frame through a game. That means the default game needs only galaga.zip, not the device ROMs.

$ cat features.txt
GFX ........ 8 presets, from classic pixels to HD glow with CRT scanlines (F3/F4/F5)
PADS ....... every connected pad drives the one control panel, as on the upright
OPERATOR ... F2 opens the DIP switches over a paused game: difficulty, ships, bonus, coinage
SAVES ...... settings in galaga.cfg, the top five scores with initials in galaga.hiscore
COCKTAIL ... player two's turns flipped round, as on the cocktail table
PACKAGES ... Linux x86_64/aarch64, PortMaster, Windows, macOS

The main loop sleeps until the next frame is due, so it uses little CPU on handhelds and doesn't draw extra frames on 120/144 Hz displays.

// YOUR ROM SET

No ROM data is included. You need your own MAME galaga set (galaga.zip). The game finds it next to the program, through --rom, or through $GALAGA_ROM. Files are matched by CRC. On the first run, the graphics, palette, sound waveforms and tables it needs are extracted to assets/. The emulated board (--emulate) also needs namco51.zip and namco54.zip.

git clone https://github.com/monkeyx-net/galaga.git
cd galaga
cmake -S . -B build && cmake --build build -j
build/galaga --windowed --rom /path/to/galaga.zip

See the Galaga game page for the full controls, or get the source on GitHub.

$ < back to blog  |  RSS feed