Re-implementing an old DOS game in C++ 17

Back in 2016, I started a side project to reverse engineer the game Duke Nukem II and build an open source reimplementation of its engine from scratch – called Rigel Engine (Check it out on GitHub). Now, more than 2 1/2 years later, my version is complete enough to allow playing the entire shareware episode of the original game, offering a practically identical experience to running the original. Here’s a video showing off the first level:

So what can it do? Rigel Engine works as a drop-in replacement for the original DOS binary (NUKEM2.EXE). You can place it into the game directory and it will read all the data from there, or you can specify the path to the game data as a command-line argument. It builds and runs on Windows, Mac OS X, and Linux. Based on SDL and OpenGL 3/OpenGL ES 2, written in C++ 17.

It implements the game logic for all the enemies and game mechanics found in the Shareware episode, plus most of the menu system. Saved games and high scores from the original game can also be imported.

On top of that, it already offers some enhancements compared to running the original game:

Continue reading “Re-implementing an old DOS game in C++ 17”

Advertisements

State of the Project

I was originally planning to write this post shortly after the last one, but oh well – as these things go sometimes, I was busy with other stuff and didn’t get around to it 🙂 But, here it is finally. In the meantime, I’ve made a lot of progress on the project itself, and also gave a talk about it at a local C++ meetup. Now, let’s go back in time and have a look at how the project started.

A bit of history

The first commit to the public GitHub repository was on the 22 October 2016, but that was just a squashed copy of the private repo I was using before. The pre-GitHub history consists of another 247 commits, with the first one being on the 21 August. But taking that as the start of the project wouldn’t be entirely true either: That first commit already had about 1.6k lines of code. Before starting with Rigel Engine, I was working on another project, which was about making a level editor that would work with various Apogee games. I never got very far with it before abandoning the idea, but I reused some of the asset loading code for Rigel Engine. Not all of my work on the editor was focused on Duke, but it seems fair to say that the first pieces of code for the project date back to somewhere around the beginning of August 2016, where I was working on that editor.

Continue reading “State of the Project”

Introducing: The Rigel Engine Dev Blog

Inspired by projects like Omnispeak and Commander Genius, which are re-implementations of the Commander Keen games based on reverse engineering, I decided to start an re-implementation effort of my own. The game I chose to recreate is Duke Nukem II – one of the lesser known 2D side-scrollers that preceded Duke Nukem 3D. The original source code has apparently been lost, so reverse engineering is the only way to create a version of the game for modern systems.

I’ve been working on this project for a couple of months now (see the GitHub repo), and my version of the game is starting to become playable. Along the way, I’ve learnt a lot about the inner workings of the original game, but also put a lot of thought into the approach I want to take for various aspects of the game. My goal is to make my implementation match the original as close as possible in terms of feel and behavior, while having a modern architecture and easy to understand code behind the scenes. As it turns out, there are many interesting problems to solve on the way towards that goal. And all I’ve done so far is still just the beginning – there’s a lot of work to be done, many challenges still lie ahead.

So I’ve decided to start writing about the project on this blog. I’m planning to begin with a brief overview of the project’s current state and my rough roadmap for how to continue, followed by a series of posts detailing how the original implementation works. After that, I’ll try to regularly update on the progress I’m making with my version. But for now, let’s talk a bit more about the game itself, and why I’ve chosen it. If you don’t know the game, here’s a video of someone playing through the original game’s first level on DosBox: Continue reading “Introducing: The Rigel Engine Dev Blog”