RigelEngine: Reimplementing an old DOS game in modern C++


Details
Dear C++ Community,
our October meetup will be hosted by Ableton. Contrary to out usual habit the talk will start at 19:00 sharp this time, since we have to be out at 21:00. The number of spots are limited, so RSVP as soon as possible. And if you find out you won't make it to the meetup, please update your RSVP to free up your slot for others on the waiting list. There will be some drinks.
Nikolai Wuttke will talk about the RigelEngine, an re-implementation of an old DOS game in modern C++.
Our meetups run under the Berlin Code of Conduct (http://berlincodeofconduct.org/).
____________________________________
Abstract
In the early days of PC gaming, software was often interfacing directly with the hardware instead of going through OS abstractions. This was necessary to make fast and graphically intensive applications possible on the very limited hardware available at that time, but it also means that those games cannot be run anymore on modern operating systems without an emulator like DosBox. While emulation is great and allows us to keep running old software, it also has limitations and often requires additional setup/configuration work. For some very popular games of that time, like DOOM, the source code was later released, which not only made it possible to create ports in order to run those titles natively on modern systems, but also to add new features, enhance the graphics etc. Unfortunately, most games never had their sources published, and in many cases, even the original developers might not have them anymore. Still, it's possible to reverse engineer their behavior and create a completely new implementation based on that, which tries to recreate the original gameplay as close as possible. After reading about various re-implementation projects like this, I got inspired and decided to do the same for one game I really liked to play as a child: Duke Nukem II, the lesser known 2D platforming predecessor to Duke Nukem 3D. In this talk, I'm going to present my work-in-progress, from-scratch reimplementation of that game for modern operating systems. The goal of the project is to recreate the feel and behavior of the original DOS game as close as possible, but in a cross-platform way using OpenGL and other APIs/libraries, and also providing a smoother experience compared to using an emulator. The implementation is done in modern C++, with a modern architecture design based on the Entity-Component-Systems pattern. In order to reverse-engineer the game's logic without access to any source code, I'm reading the original executable's assembly code and analyzing video captures of the game running in an emulator. Based on what I learn from that, I re-implement that logic in the context of my own architecture. I will talk about the reverse-engineering process in detail, but also go into various C++-specific topics, for example:
• The Entity-Component-System architecture, advantages compared to object-oriented programming, implementation and available libraries for C++
• Using std::variant to simplify implementing A.I. state machines and a "script" interpreter
• Using concept-based polymorphism to implement the high-level game state (menu vs. in-game etc.)
• Performance-optimizations for the Raspberry PI (1st generation)
Finally, there will be a bunch of funny anecdotes and interesting hacks found in the original implementation to look forward to!
The project can be found on github:
https://github.com/lethal-guitar/RigelEngine

RigelEngine: Reimplementing an old DOS game in modern C++